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 CDCFacet > 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

 MCFacetFilter (bool allowReverse=true)
 Constructor also setting the switch, if the reversed version of a facet (in comparison to MC truth) shall be accepted.
 
Weight operator() (const 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 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 24 of file MCFacetFilter.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

using Super = MCSymmetric<BaseFacetFilter>
private

Type of the super class.

Definition at line 27 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 25 of file MCFacetFilter.cc.

26 : Super(allowReverse)
27{
28}
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}
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() [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(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 CDCFacet >.

◆ needsTruthInformation() [2/2]

bool needsTruthInformation ( )
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< const CDCFacet >.

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

64 {
65 return true;
66 }

◆ operator()() [1/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()() [2/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()() [3/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()() [4/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()() [5/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 }

◆ operator()() [6/7]

Weight operator() ( const CDCFacet & facet)
finalvirtual

Main filter method returning the weight of the facet.

Returns NAN, if the cell shall be rejected.

Reimplemented from Filter< const CDCFacet >.

Definition at line 30 of file MCFacetFilter.cc.

31{
32 const int maxInTrackHitIdDifference = 3;
33 bool isCorrectFacet = operator()(facet, maxInTrackHitIdDifference);
34
35 bool isCorrectReverseFacet =
36 this->getAllowReverse() and operator()(facet.reversed(), maxInTrackHitIdDifference);
37
38 if (isCorrectFacet) {
39 if (facet.getFitLine()->isInvalid()) {
40 facet.adjustFitLine();
41 }
42 return 3.0;
43 } else if (isCorrectReverseFacet) {
44 if (facet.getFitLine()->isInvalid()) {
45 facet.adjustFitLine();
46 }
47 return -3.0;
48 } else {
49 return NAN;
50 }
51}
void adjustFitLine() const
Adjusts the contained fit line to touch such that it touches the first and third hit.
Definition CDCFacet.cc:61
const UncertainParameterLine2D & getFitLine() const
Getter for the contained line fit information.
Definition CDCFacet.h:61
Weight operator()(const CDCFacet &facet) final
Main filter method returning the weight of the facet.
bool isInvalid() const
Check it the line is in an invalid state.

◆ operator()() [7/7]

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

Indicated if the oriented triple is a correct hypotheses.

Definition at line 53 of file MCFacetFilter.cc.

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

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