Belle II Software development
MCFacetFilter Class Reference

Filter for the construction of good facets based on Monte Carlo information. More...

#include <MCFacetFilter.h>

Inheritance diagram for MCFacetFilter:
MCSymmetric< BaseFacetFilter > Filter< const TrackingUtilities::CDCFacet > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

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

Public Member Functions

 MCFacetFilter (bool allowReverse=true)
 Constructor also setting the switch, if the reversed version of a facet (in comparison to MC truth) shall be accepted.
 
TrackingUtilities::Weight operator() (const TrackingUtilities::CDCFacet &facet) final
 Main filter method returning the weight of the facet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the set of parameters of the filter to the module parameter list.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the set of parameters of the filter to the module parameter list.
 
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<BaseFacetFilter>
 Type of the super class.
 

Private Member Functions

bool operator() (const TrackingUtilities::CDCRLWireHitTriple &rlWireHitTriple, int maxInTrackHitIdDifference)
 Indicated if the oriented triple is a correct hypotheses.
 

Private Attributes

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 good facets based on Monte Carlo information.

Definition at line 26 of file MCFacetFilter.h.

Member Typedef Documentation

◆ Interface [1/2]

using Interface
inherited

Mark this class as the basic interface.

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

◆ Interface [2/2]

using Interface
inherited

Mark this class as the basic interface.

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

◆ Object [1/2]

using Object
inherited

Type of the object to be analysed.

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

◆ Object [2/2]

using Object
inherited

Type of the object to be analysed.

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

◆ Super

using Super = MCSymmetric<BaseFacetFilter>
private

Type of the super class.

Definition at line 29 of file MCFacetFilter.h.

Constructor & Destructor Documentation

◆ MCFacetFilter()

MCFacetFilter ( bool allowReverse = true)
explicit

Constructor also setting the switch, if the reversed version of a facet (in comparison to MC truth) shall be accepted.

Definition at line 26 of file MCFacetFilter.cc.

27 : Super(allowReverse)
28{
29}
MCSymmetric< BaseFacetFilter > 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}
This class is used to select pairs, triplets... of objects.
Definition Filter.h:34

◆ 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< TrackingUtilities::ChooseableFilter< PXDPairFilterFactory > >, LayerPXDRelationFilter< TrackingUtilities::ChooseableFilter< PXDPairFilterFactory > >, LayerSVDRelationFilter< AFilter, APrefilter >, LayerSVDRelationFilter< TrackingUtilities::ChooseableFilter< SVDPairFilterFactory > >, LayerSVDRelationFilter< TrackingUtilities::ChooseableFilter< SVDPairFilterFactory > >, SectorMapBasedSVDPairFilter, SimplePXDStateFilter, SimpleSVDStateFilter, CutsFromDBWireHitFilter, WireHitCreator, MVA< Filter< AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, FourHitFilter, LayerRelationFilter< AFilter >, LayerRelationFilter< TrackingUtilities::ChooseableFilter< RelationFilterFactory > >, LayerRelationFilter< TrackingUtilities::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.

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

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

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

Reimplemented from CompositeProcessingSignalListener.

◆ exposeParameters() [2/2]

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

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

Reimplemented from CompositeProcessingSignalListener.

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

39 {
40 Super::exposeParameters(moduleParamList, prefix);
41 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "allowReverse"),
42 m_param_allowReverse,
43 "Indication whether the reverse to the truth is accepted"
44 "preserving the propagation reversal symmetry.",
45 m_param_allowReverse);
46 }

◆ 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< const TrackingUtilities::CDCFacet >.

◆ needsTruthInformation() [2/2]

bool needsTruthInformation ( )
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< const TrackingUtilities::CDCFacet >.

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

64 {
65 return true;
66 }

◆ operator()() [1/7]

Weight operator() ( const TrackingUtilities::CDCFacet & facet)
finalvirtual

Main filter method returning the weight of the facet.

Returns NAN, if the cell shall be rejected.

Reimplemented from Filter< const TrackingUtilities::CDCFacet >.

Definition at line 31 of file MCFacetFilter.cc.

32{
33 const int maxInTrackHitIdDifference = 3;
34 bool isCorrectFacet = operator()(facet, maxInTrackHitIdDifference);
35
36 bool isCorrectReverseFacet =
37 this->getAllowReverse() and operator()(facet.reversed(), maxInTrackHitIdDifference);
38
39 if (isCorrectFacet) {
40 if (facet.getFitLine()->isInvalid()) {
41 facet.adjustFitLine();
42 }
43 return 3.0;
44 } else if (isCorrectReverseFacet) {
45 if (facet.getFitLine()->isInvalid()) {
46 facet.adjustFitLine();
47 }
48 return -3.0;
49 } else {
50 return NAN;
51 }
52}
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCFacet &facet) final
Main filter method returning the weight of the facet.

◆ operator()() [2/7]

bool operator() ( const TrackingUtilities::CDCRLWireHitTriple & rlWireHitTriple,
int maxInTrackHitIdDifference )
private

Indicated if the oriented triple is a correct hypotheses.

Definition at line 54 of file MCFacetFilter.cc.

56{
57 const CDCMCHitLookUp& mcHitLookUp = CDCMCHitLookUp::getInstance();
58
59 const CDCWireHit& startWireHit = rlWireHitTriple.getStartWireHit();
60 const CDCWireHit& middleWireHit = rlWireHitTriple.getMiddleWireHit();
61 const CDCWireHit& endWireHit = rlWireHitTriple.getEndWireHit();
62
63 // First check if the track ids are in agreement
64 ITrackType startMCTrackId = mcHitLookUp.getMCTrackId(startWireHit.getHit());
65 ITrackType middleMCTrackId = mcHitLookUp.getMCTrackId(middleWireHit.getHit());
66 ITrackType endMCTrackId = mcHitLookUp.getMCTrackId(endWireHit.getHit());
67
68 if (startMCTrackId == INVALID_ITRACK or
69 middleMCTrackId == INVALID_ITRACK or
70 endMCTrackId == INVALID_ITRACK) {
71 return false;
72 }
73
74 if (not(startMCTrackId == middleMCTrackId and middleMCTrackId == endMCTrackId)) {
75 return false;
76 }
77
78 int startInTrackId = mcHitLookUp.getInTrackId(startWireHit.getHit());
79 int middleInTrackId = mcHitLookUp.getInTrackId(middleWireHit.getHit());
80 int endInTrackId = mcHitLookUp.getInTrackId(endWireHit.getHit());
81
82 int startToMiddleInTrackDistance = middleInTrackId - startInTrackId;
83 int middleToEndInTrackDistance = endInTrackId - middleInTrackId;
84
85 // Now check the alignment in track
86 bool distanceInTrackIsSufficientlyLow =
87 0 < startToMiddleInTrackDistance and startToMiddleInTrackDistance <= maxInTrackHitIdDifference and
88 0 < middleToEndInTrackDistance and middleToEndInTrackDistance <= maxInTrackHitIdDifference;
89
90
91 if (not distanceInTrackIsSufficientlyLow) return false;
92
93 // Now check the right left information in track
94 ERightLeft startRLInfo = rlWireHitTriple.getStartRLInfo();
95 ERightLeft middleRLInfo = rlWireHitTriple.getMiddleRLInfo();
96 ERightLeft endRLInfo = rlWireHitTriple.getEndRLInfo();
97
98 ERightLeft mcStartRLInfo = mcHitLookUp.getRLInfo(startWireHit.getHit());
99 ERightLeft mcMiddleRLInfo = mcHitLookUp.getRLInfo(middleWireHit.getHit());
100 ERightLeft mcEndRLInfo = mcHitLookUp.getRLInfo(endWireHit.getHit());
101
102 if (startRLInfo == mcStartRLInfo and middleRLInfo == mcMiddleRLInfo and endRLInfo == mcEndRLInfo) {
103 return true;
104 } else {
105 return false;
106 }
107}
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
TrackingUtilities::Index getInTrackId(const CDCHit *ptrHit) const
Returns the position of the wire hit in the track along the travel direction.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
TrackingUtilities::ERightLeft getRLInfo(const CDCHit *ptrHit) const
Returns the true right left passage information.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition CDCWireHit.h:162
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition ERightLeft.h:25

◆ operator()() [3/7]

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()() [4/7]

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()() [5/7]

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()() [6/7]

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()() [7/7]

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 }

◆ 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.

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_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: