Belle II Software development
IterativeChi2BasedEventTimeExtractor Class Referencefinalabstract

Class to iteratively extract the event t0 using the chi-squared approach. More...

#include <IterativeChi2BasedEventTimeExtractor.h>

Inheritance diagram for IterativeChi2BasedEventTimeExtractor:
IterativeEventTimeExtractor< Chi2BasedEventTimeExtractor > BaseEventTimeExtractor< RecoTrack * > Findlet< AIOTypes... > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes
 Types that should be served to apply on invocation.
 
using IOTypes
 Types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 

Public Member Functions

void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override final
 Expose our parameters to the super module.
 
void apply (std::vector< RecoTrack * > &recoTracks) override final
 Timing extraction for this findlet.
 
void apply (std::vector< RecoTrack * > &recoTracks) override final
 Timing extraction for this findlet.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
bool wasSuccessful () const
 Returns true if the last run t0 extraction was successful.
 
bool wasSuccessful () const
 Returns true if the last run t0 extraction was successful.
 
virtual void initialize () override
 Initialize the event t0 store obj ptr.
 
virtual void initialize () override
 Initialize the event t0 store obj ptr.
 
virtual void beginEvent () override
 Create the event t0 store obj ptr.
 
virtual void beginEvent () override
 Create the event t0 store obj ptr.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector
 Short hand for ToRangeImpl.
 
using ToVector
 Short hand for ToRangeImpl.
 

Protected Member Functions

void resetEventT0 () const
 Reset the t0 value to cached value if it exists or clear it otherwise.
 
void resetEventT0 () const
 Reset the t0 value to cached value if it exists or clear it otherwise.
 
void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Protected Attributes

StoreObjPtr< EventT0m_eventT0
 Pointer to the storage of the eventwise T0 estimation in the data store.
 
StoreObjPtr< EventT0m_eventT0
 Pointer to the storage of the eventwise T0 estimation in the data store.
 
bool m_wasSuccessful
 Variable to show that the execution was successful.
 
bool m_wasSuccessful
 Variable to show that the execution was successful.
 

Private Types

using Super = IterativeEventTimeExtractor<Chi2BasedEventTimeExtractor>
 Type of the base class.
 

Private Attributes

unsigned int m_param_maxIterations
 Parameter: how many iterations should be done maximally?
 
unsigned int m_param_maxIterations
 Parameter: how many iterations should be done maximally?
 
unsigned int m_param_minIterations
 Parameter: how many iterations should be done minimally?
 
unsigned int m_param_minIterations
 Parameter: how many iterations should be done minimally?
 
double m_param_minimalDeltaT0
 Parameter: What is the final precision?
 
double m_param_minimalDeltaT0
 Parameter: What is the final precision?
 
bool m_param_abortOnUnsuccessfulStep
 Parameter: abort if a single iteration is not working.
 
bool m_param_abortOnUnsuccessfulStep
 Parameter: abort if a single iteration is not working.
 
bool m_param_useLastEventT0
 Parameter: use the last event t0 instead of the best one.
 
bool m_param_useLastEventT0
 Parameter: use the last event t0 instead of the best one.
 
Chi2BasedEventTimeExtractor m_findlet
 The subfindlet.
 
Chi2BasedEventTimeExtractor m_findlet
 The subfindlet.
 
std::vector< EventT0::EventT0Componentm_eventT0WithQuality
 Pool for the event t0s with chi2.
 
std::vector< EventT0::EventT0Componentm_eventT0WithQuality
 Pool for the event t0s with chi2.
 
bool m_param_overwriteExistingEstimation
 Parameter if it is fine to overwrite the current EventT0.
 
bool m_param_overwriteExistingEstimation
 Parameter if it is fine to overwrite the current EventT0.
 
std::optional< EventT0::EventT0Componentm_eventT0Before
 Storage for the event t0 before this module ran.
 
std::optional< EventT0::EventT0Componentm_eventT0Before
 Storage for the event t0 before this module ran.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Class to iteratively extract the event t0 using the chi-squared approach.

Definition at line 23 of file IterativeChi2BasedEventTimeExtractor.h.

Member Typedef Documentation

◆ IOTypes [1/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOTypes [2/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors [1/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ IOVectors [2/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Type of the base class.

Definition at line 26 of file IterativeChi2BasedEventTimeExtractor.h.

◆ ToVector [1/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

◆ ToVector [2/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Class to extract the event t0.

◆ apply()

void apply ( std::vector< RecoTrack * > & recoTracks)
finaloverrideinherited

Timing extraction for this findlet.

Definition at line 40 of file IterativeEventTimeExtractor.icc.h.

30 {
31 m_wasSuccessful = false;
32
33 m_eventT0WithQuality.clear();
34
35 TimeExtractionUtils::addEventT0WithQuality(recoTracks, m_eventT0, m_eventT0WithQuality);
36
37 unsigned int iteration = 0;
38 for (; iteration < m_param_maxIterations; iteration++) {
39 // The findlet will set the final event t0, but will probably not add any temporary event t0s, which is fine as we will do so.
40 m_findlet.apply(recoTracks);
41
42 bool breakLoop = false;
43 if (m_findlet.wasSuccessful()) {
44
45 if (not m_eventT0WithQuality.empty()) {
46 const double deltaT0 = std::abs(m_eventT0->getEventT0() - m_eventT0WithQuality.back().eventT0);
47 if (deltaT0 < m_param_minimalDeltaT0 and iteration >= m_param_minIterations) {
48 breakLoop = true;
49 }
50 }
51 TimeExtractionUtils::addEventT0WithQuality(recoTracks, m_eventT0, m_eventT0WithQuality);
52 } else if (m_param_abortOnUnsuccessfulStep) {
53 B2DEBUG(25, "Aborting because time extraction was not successful.");
54 breakLoop = true;
55 }
56
57 if (breakLoop) {
58 break;
59 }
60 }
61
62 if (not m_eventT0WithQuality.empty() and iteration != m_param_maxIterations) {
63 if (m_param_useLastEventT0) {
64 m_eventT0->addTemporaryEventT0(m_eventT0WithQuality.back());
65 m_eventT0->setEventT0(m_eventT0WithQuality.back());
66 } else {
67 // Look for the best event t0 (with the smallest chi2)
68 const auto& bestEventT0 = std::max_element(m_eventT0WithQuality.begin(), m_eventT0WithQuality.end(),
69 [](const auto & lhs, const auto & rhs) {
70 return lhs.quality < rhs.quality;
71 });
72 m_eventT0->setEventT0(*bestEventT0);
73 }
74 m_wasSuccessful = true;
75 }
76 }

◆ beginEvent() [1/2]

virtual void beginEvent ( )
overridevirtualinherited

Create the event t0 store obj ptr.

Reimplemented from ProcessingSignalListener.

◆ beginEvent() [2/2]

void beginEvent ( )
overridevirtualinherited

Create the event t0 store obj ptr.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file BaseEventTimeExtractor.icc.h.

46 {
47 Super::beginEvent();
48
49 m_wasSuccessful = false;
50
51 if (not m_eventT0.isValid()) {
52 m_eventT0.create();
53 }
54
55 m_eventT0Before = m_eventT0->getEventT0Component();
56 }

◆ beginRun()

void beginRun ( )
overrideinherited

Receive and dispatch signal for the beginning of a new run.

Definition at line 33 of file CompositeProcessingSignalListener.cc.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

◆ exposeParameters()

void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
inlinefinaloverridevirtual

Expose our parameters to the super module.

Reimplemented from BaseEventTimeExtractor< RecoTrack * >.

Definition at line 29 of file IterativeChi2BasedEventTimeExtractor.h.

30 {
31 Super::exposeParameters(moduleParamList, prefix);
32
33 moduleParamList->getParameter<bool>(TrackFindingCDC::prefixed(prefix, "useLastEventT0")).setDefaultValue(false);
34 }

◆ getDescription() [1/2]

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ getDescription() [2/2]

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize() [1/2]

virtual void initialize ( )
overridevirtualinherited

Initialize the event t0 store obj ptr.

Reimplemented from ProcessingSignalListener.

◆ initialize() [2/2]

void initialize ( )
overridevirtualinherited

Initialize the event t0 store obj ptr.

Reimplemented from ProcessingSignalListener.

Definition at line 36 of file BaseEventTimeExtractor.icc.h.

39 {
40 Super::initialize();
41 m_eventT0.registerInDataStore();
42 }

◆ resetEventT0()

void resetEventT0 ( ) const
protectedinherited

Reset the t0 value to cached value if it exists or clear it otherwise.

Definition at line 43 of file BaseEventTimeExtractor.icc.h.

60 {
61 if (m_eventT0Before) {
62 m_eventT0->setEventT0(*m_eventT0Before);
63 } else {
64 m_eventT0->clearEventT0();
65 }
66 }

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
void terminate() override
Receive and dispatch Signal for termination of the event processing.

◆ wasSuccessful()

bool wasSuccessful ( ) const
inherited

Returns true if the last run t0 extraction was successful.

Definition at line 30 of file BaseEventTimeExtractor.icc.h.

22 {
23 return m_wasSuccessful;
24 }

Member Data Documentation

◆ m_eventT0 [1/2]

StoreObjPtr<EventT0> m_eventT0
protectedinherited

Pointer to the storage of the eventwise T0 estimation in the data store.

Definition at line 46 of file BaseEventTimeExtractor.dcl.h.

◆ m_eventT0 [2/2]

StoreObjPtr<EventT0> m_eventT0
protectedinherited

Pointer to the storage of the eventwise T0 estimation in the data store.

Definition at line 46 of file BaseEventTimeExtractor.dcl.h.

◆ m_eventT0Before [1/2]

std::optional<EventT0::EventT0Component> m_eventT0Before
privateinherited

Storage for the event t0 before this module ran.

Definition at line 56 of file BaseEventTimeExtractor.dcl.h.

◆ m_eventT0Before [2/2]

std::optional<EventT0::EventT0Component> m_eventT0Before
privateinherited

Storage for the event t0 before this module ran.

Definition at line 56 of file BaseEventTimeExtractor.dcl.h.

◆ m_eventT0WithQuality [1/2]

std::vector<EventT0::EventT0Component> m_eventT0WithQuality
privateinherited

Pool for the event t0s with chi2.

Definition at line 56 of file IterativeEventTimeExtractor.dcl.h.

◆ m_eventT0WithQuality [2/2]

std::vector<EventT0::EventT0Component> m_eventT0WithQuality
privateinherited

Pool for the event t0s with chi2.

Definition at line 56 of file IterativeEventTimeExtractor.dcl.h.

◆ m_findlet [1/2]

Chi2BasedEventTimeExtractor m_findlet
privateinherited

The subfindlet.

Definition at line 54 of file IterativeEventTimeExtractor.dcl.h.

◆ m_findlet [2/2]

Chi2BasedEventTimeExtractor m_findlet
privateinherited

The subfindlet.

Definition at line 54 of file IterativeEventTimeExtractor.dcl.h.

◆ m_initialized

bool m_initialized
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_param_abortOnUnsuccessfulStep [1/2]

bool m_param_abortOnUnsuccessfulStep
privateinherited

Parameter: abort if a single iteration is not working.

Definition at line 50 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_abortOnUnsuccessfulStep [2/2]

bool m_param_abortOnUnsuccessfulStep
privateinherited

Parameter: abort if a single iteration is not working.

Definition at line 50 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_maxIterations [1/2]

unsigned int m_param_maxIterations
privateinherited

Parameter: how many iterations should be done maximally?

Definition at line 44 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_maxIterations [2/2]

unsigned int m_param_maxIterations
privateinherited

Parameter: how many iterations should be done maximally?

Definition at line 44 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_minimalDeltaT0 [1/2]

double m_param_minimalDeltaT0
privateinherited

Parameter: What is the final precision?

Definition at line 48 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_minimalDeltaT0 [2/2]

double m_param_minimalDeltaT0
privateinherited

Parameter: What is the final precision?

Definition at line 48 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_minIterations [1/2]

unsigned int m_param_minIterations
privateinherited

Parameter: how many iterations should be done minimally?

Definition at line 46 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_minIterations [2/2]

unsigned int m_param_minIterations
privateinherited

Parameter: how many iterations should be done minimally?

Definition at line 46 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_overwriteExistingEstimation [1/2]

bool m_param_overwriteExistingEstimation
privateinherited

Parameter if it is fine to overwrite the current EventT0.

Definition at line 53 of file BaseEventTimeExtractor.dcl.h.

◆ m_param_overwriteExistingEstimation [2/2]

bool m_param_overwriteExistingEstimation
privateinherited

Parameter if it is fine to overwrite the current EventT0.

Definition at line 53 of file BaseEventTimeExtractor.dcl.h.

◆ m_param_useLastEventT0 [1/2]

bool m_param_useLastEventT0
privateinherited

Parameter: use the last event t0 instead of the best one.

Definition at line 52 of file IterativeEventTimeExtractor.dcl.h.

◆ m_param_useLastEventT0 [2/2]

bool m_param_useLastEventT0
privateinherited

Parameter: use the last event t0 instead of the best one.

Definition at line 52 of file IterativeEventTimeExtractor.dcl.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_wasSuccessful [1/2]

bool m_wasSuccessful
protectedinherited

Variable to show that the execution was successful.

Definition at line 49 of file BaseEventTimeExtractor.dcl.h.

◆ m_wasSuccessful [2/2]

bool m_wasSuccessful
protectedinherited

Variable to show that the execution was successful.

Definition at line 49 of file BaseEventTimeExtractor.dcl.h.


The documentation for this class was generated from the following file: