Belle II Software development
MCSegmentPairFilter Class Reference

Filter for the construction of axial to stereo segment pairs based on MC information. More...

#include <MCSegmentPairFilter.h>

Inheritance diagram for MCSegmentPairFilter:
MCSymmetric< BaseSegmentPairFilter > Filter< CDCSegmentPair > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object
 Type of the object to be analysed.
 
using Interface
 Mark this class as the basic interface.
 

Public Member Functions

 MCSegmentPairFilter (bool allowReverse=true)
 Constructor.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the set of parameters of the filter to the module parameter list.
 
Weight operator() (const CDCSegmentPair &segmentPair) final
 Checks if a axial stereo segment pair is a good combination.
 
void initialize () override
 Initialize the before event processing.
 
void initialize () override
 Initialize the before event processing.
 
void beginEvent () override
 Signal the beginning of a new event.
 
void beginEvent () override
 Signal the beginning of a new event.
 
bool needsTruthInformation () final
 Indicates that the filter requires Monte Carlo information.
 
bool needsTruthInformation () final
 Indicates that the filter requires Monte Carlo information.
 
virtual void setAllowReverse (bool allowReverse)
 Setter for the allow reverse parameter.
 
virtual void setAllowReverse (bool allowReverse)
 Setter for the allow reverse parameter.
 
bool getAllowReverse () const
 Getter for the allow reverse parameter.
 
bool getAllowReverse () const
 Getter for the allow reverse parameter.
 
Weight operator() (const Object *obj)
 Function to evaluate the object.
 
virtual std::vector< float > operator() (const std::vector< Object * > &objs)
 Function to evaluate a vector of objects Base implementation applies the function to each object.
 
virtual Weight operator() (const Object &obj)
 Function to evaluate the object.
 
Weight operator() (const Object *obj)
 Function to evaluate the object.
 
virtual std::vector< float > operator() (const std::vector< Object * > &objs)
 Function to evaluate a vector of objects Base implementation applies the function to each object.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
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 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.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = MCSymmetric<BaseSegmentPairFilter>
 Type of the super class.
 

Private Attributes

bool m_param_requireRLPure = true
 Parameter : Switch to require the segment combination contain mostly correct rl information.
 
int m_param_minSegmentSize = 4
 Parameter : Minimum segment size to pass as monte carlo truth.
 
bool m_param_allowReverse
 Switch to indicate if the reversed version of the object shall also be accepted (default is true).
 
bool m_param_allowReverse
 Switch to indicate if the reversed version of the object shall also be accepted (default is true).
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happened before.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
bool m_terminated
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Filter for the construction of axial to stereo segment pairs based on MC information.

Definition at line 22 of file MCSegmentPairFilter.h.

Member Typedef Documentation

◆ Interface

using Interface
inherited

Mark this class as the basic interface.

Definition at line 38 of file Filter.dcl.h.

◆ Object

using Object
inherited

Type of the object to be analysed.

Definition at line 35 of file Filter.dcl.h.

◆ Super

Type of the super class.

Definition at line 26 of file MCSegmentPairFilter.h.

Constructor & Destructor Documentation

◆ MCSegmentPairFilter()

MCSegmentPairFilter ( bool allowReverse = true)
explicit

Constructor.

Definition at line 24 of file MCSegmentPairFilter.cc.

25 : Super(allowReverse)
26{
27}
MCSymmetric< BaseSegmentPairFilter > Super
Type of the super class.

Member Function Documentation

◆ addProcessingSignalListener() [1/2]

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ addProcessingSignalListener() [2/2]

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Base class for filters on a generic object type.
Definition Filter.dcl.h:31

◆ beginEvent() [1/2]

void beginEvent ( )
overridevirtualinherited

Signal the beginning of a new event.

Reimplemented from CompositeProcessingSignalListener.

◆ beginEvent() [2/2]

void beginEvent ( )
overridevirtualinherited

Signal the beginning of a new event.

Reimplemented from CompositeProcessingSignalListener.

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

57 {
58 CDCMCManager::getInstance().fill();
59 Super::beginEvent();
60 }

◆ beginRun() [1/2]

void beginRun ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in DATCONSVDClusterizer, LayerPXDRelationFilter< AFilter, APrefilter >, LayerPXDRelationFilter< TrackFindingCDC::ChooseableFilter< PXDPairFilterFactory > >, LayerPXDRelationFilter< TrackFindingCDC::ChooseableFilter< PXDPairFilterFactory > >, LayerSVDRelationFilter< AFilter, APrefilter >, LayerSVDRelationFilter< TrackFindingCDC::ChooseableFilter< SVDPairFilterFactory > >, LayerSVDRelationFilter< TrackFindingCDC::ChooseableFilter< SVDPairFilterFactory > >, SectorMapBasedSVDPairFilter, SimplePXDStateFilter, SimpleSVDStateFilter, CutsFromDBWireHitFilter, MVA< Filter< AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, WireHitCreator, FourHitFilter, LayerRelationFilter< AFilter >, LayerRelationFilter< TrackFindingCDC::ChooseableFilter< RelationFilterFactory > >, LayerRelationFilter< TrackFindingCDC::ChooseableFilter< RelationFilterFactory > >, QualityIndicatorFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, ThreeHitFilter, TrackCandidateResultRefiner, TwoHitVirtualIPFilter, and TwoHitVirtualIPQIFilter.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
virtual void beginRun()
Receive signal for the beginning of a new run.
ProcessingSignalListener()
Allow default construction.

◆ beginRun() [2/2]

void beginRun ( )
overrideinherited

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

Definition at line 33 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
void beginRun() override
Receive and dispatch signal for the beginning of a new run.

◆ endRun() [1/2]

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ endRun() [2/2]

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 )
finalvirtual

Expose the set of parameters of the filter to the module parameter list.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 29 of file MCSegmentPairFilter.cc.

31{
32 Super::exposeParameters(moduleParamList, prefix);
33 moduleParamList->addParameter(prefixed(prefix, "requireRLPure"),
35 "Switch to require the segment combination contain mostly correct rl information",
37
38
39 moduleParamList->addParameter(prefixed(prefix, "minSegmentSize"),
41 "Minimum segment size to pass as monte carlo truth",
43
44}
bool m_param_requireRLPure
Parameter : Switch to require the segment combination contain mostly correct rl information.
int m_param_minSegmentSize
Parameter : Minimum segment size to pass as monte carlo truth.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getAllowReverse()

bool getAllowReverse ( ) const
inherited

Getter for the allow reverse parameter.

Definition at line 53 of file MCSymmetricFilter.icc.h.

76 {
77 return m_param_allowReverse;
78 }

◆ getNProcessingSignalListener() [1/2]

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ getNProcessingSignalListener() [2/2]

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize() [1/2]

void initialize ( )
overridevirtualinherited

Initialize the before event processing.

Reimplemented from CompositeProcessingSignalListener.

◆ initialize() [2/2]

void initialize ( )
overridevirtualinherited

Initialize the before event processing.

Reimplemented from CompositeProcessingSignalListener.

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

50 {
51 CDCMCManager::getInstance().requireTruthInformation();
52 Super::initialize();
53 }

◆ needsTruthInformation() [1/2]

bool needsTruthInformation ( )
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< CDCSegmentPair >.

◆ needsTruthInformation() [2/2]

bool needsTruthInformation ( )
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< CDCSegmentPair >.

Definition at line 46 of file MCSymmetricFilter.icc.h.

64 {
65 return true;
66 }

◆ operator()() [1/6]

Weight operator() ( const Object & obj)
virtualinherited

Function to evaluate the object.

Base implementation accepts all objects.

Parameters
objThe object to be accepted or rejected.
Returns
A finite float value if the object is accepted. NAN if the object is rejected.

Definition at line 59 of file Filter.icc.h.

47 {
48 return 1;
49 }

◆ operator()() [2/6]

Weight operator() ( const Object * obj)
inherited

Function to evaluate the object.

Base implementation accepts all objects, except nullptr.

Parameters
objThe object to be accepted or rejected.
Returns
A finit float value if the object is accepted. NAN if the object is rejected. Nullptr is always rejected.

◆ operator()() [3/6]

Weight operator() ( const Object * obj)
inherited

Function to evaluate the object.

Base implementation accepts all objects, except nullptr.

Parameters
objThe object to be accepted or rejected.
Returns
A finit float value if the object is accepted. NAN if the object is rejected. Nullptr is always rejected.

Definition at line 69 of file Filter.icc.h.

53 {
54 return obj ? operator()(*obj) : NAN;
55 }

◆ operator()() [4/6]

virtual std::vector< float > operator() ( const std::vector< Object * > & objs)
virtualinherited

Function to evaluate a vector of objects Base implementation applies the function to each object.

Can be optimized for MVA filters

Parameters
objsA vector of pointers to objects
Returns
A vector of float or NAN values. See above

◆ operator()() [5/6]

std::vector< float > operator() ( const std::vector< Object * > & objs)
virtualinherited

Function to evaluate a vector of objects Base implementation applies the function to each object.

Can be optimized for MVA filters

Parameters
objsA vector of pointers to objects
Returns
A vector of float or NAN values. See above

Definition at line 77 of file Filter.icc.h.

59 {
60 std::vector<float> out;
61 for (const auto& obj : objs) {
62 out.push_back(operator()(obj));
63 }
64 return out;
65 }

◆ operator()() [6/6]

Weight operator() ( const CDCSegmentPair & segmentPair)
finalvirtual

Checks if a axial stereo segment pair is a good combination.

Reimplemented from Filter< CDCSegmentPair >.

Definition at line 46 of file MCSegmentPairFilter.cc.

47{
48 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
49 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
50
51 assert(ptrFromSegment);
52 assert(ptrToSegment);
53
54 const CDCSegment2D& fromSegment = *ptrFromSegment;
55 const CDCSegment2D& toSegment = *ptrToSegment;
56
57 if (static_cast<int>(fromSegment.size()) < m_param_minSegmentSize or
58 static_cast<int>(toSegment.size()) < m_param_minSegmentSize) {
59 return NAN;
60 }
61
62 const CDCMCSegment2DLookUp& mcSegmentLookUp = CDCMCSegment2DLookUp::getInstance();
63
64 // Check if the segments are aligned correctly along the Monte Carlo track
65 EForwardBackward pairFBInfo =
67 ? mcSegmentLookUp.areAlignedInMCTrackWithRLCheck(ptrFromSegment, ptrToSegment)
68 : mcSegmentLookUp.areAlignedInMCTrack(ptrFromSegment, ptrToSegment);
69
70 if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
71
72 if (pairFBInfo == EForwardBackward::c_Forward or
73 (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
74 // Final check for the distance between the segment
75 Index fromNPassedSuperLayers = mcSegmentLookUp.getLastNPassedSuperLayers(ptrFromSegment);
76 if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
77
78 Index toNPassedSuperLayers = mcSegmentLookUp.getFirstNPassedSuperLayers(ptrToSegment);
79 if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
80
81 if (abs(fromNPassedSuperLayers - toNPassedSuperLayers) > 1) return NAN;
82
83 // Do fits
84 if (not segmentPair.getTrajectory3D().isFitted()) {
85 CDCTrajectory3D mcTrajectory3D = mcSegmentLookUp.getTrajectory3D(ptrFromSegment);
86 if (pairFBInfo == EForwardBackward::c_Backward) {
87 mcTrajectory3D.reverse();
88 }
89 segmentPair.setTrajectory3D(mcTrajectory3D);
90 }
91 return static_cast<double>(pairFBInfo) * static_cast<Weight>(fromSegment.size() + toSegment.size());
92 }
93 return NAN;
94}
Index getLastNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the last hit the collection of hits which has the Monte C...
EForwardBackward areAlignedInMCTrackWithRLCheck(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
EForwardBackward areAlignedInMCTrack(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
Index getFirstNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the first hit the collection of hits which has the Monte ...
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
const CDCSegment2D * getToSegment() const
Getter for the to segment.
void setTrajectory3D(const CDCTrajectory3D &trajectory3D) const
Setter for the three dimensional trajectory.
CDCTrajectory3D & getTrajectory3D() const
Getter for the three dimensional trajectory.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
void reverse()
Reverses the trajectory in place.
bool isFitted() const
Checks if the trajectory has already been set to a valid value.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.

◆ setAllowReverse()

void setAllowReverse ( bool allowReverse)
virtualinherited

Setter for the allow reverse parameter.

Definition at line 50 of file MCSymmetricFilter.icc.h.

70 {
71 m_param_allowReverse = allowReverse;
72 }

◆ terminate() [1/2]

◆ terminate() [2/2]

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.

Member Data Documentation

◆ m_initialized [1/2]

bool m_initialized
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initialized [2/2]

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs [1/2]

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_initializedAs [2/2]

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_param_allowReverse [1/2]

bool m_param_allowReverse
privateinherited

Switch to indicate if the reversed version of the object shall also be accepted (default is true).

Definition at line 57 of file MCSymmetricFilter.dcl.h.

◆ m_param_allowReverse [2/2]

bool m_param_allowReverse
privateinherited

Switch to indicate if the reversed version of the object shall also be accepted (default is true).

Definition at line 57 of file MCSymmetricFilter.dcl.h.

◆ m_param_minSegmentSize

int m_param_minSegmentSize = 4
private

Parameter : Minimum segment size to pass as monte carlo truth.

Definition at line 43 of file MCSegmentPairFilter.h.

◆ m_param_requireRLPure

bool m_param_requireRLPure = true
private

Parameter : Switch to require the segment combination contain mostly correct rl information.

Definition at line 40 of file MCSegmentPairFilter.h.

◆ m_subordinaryProcessingSignalListeners [1/2]

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_subordinaryProcessingSignalListeners [2/2]

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 [1/2]

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_terminated [2/2]

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.


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