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< AObject > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object = AObject
 Type of the object to be analysed.
 
using Interface = Filter< AObject >
 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 initialize () override
 Initialize the before event processing.
 
void beginEvent () override
 Signal the beginning of a new event.
 
bool needsTruthInformation () final
 Indicates that the filter requires Monte Carlo information.
 
virtual void setAllowReverse (bool allowReverse)
 Setter for the allow reverse parameter.
 
bool getAllowReverse () const
 Getter for the allow reverse parameter.
 
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 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 Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
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).
 
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_terminated = false
 Flag to keep track whether termination happened before.
 
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 = Filter<AObject>
inherited

Mark this class as the basic interface.

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

◆ Object

using Object = AObject
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.
Definition: MCFacetFilter.h:27

Member Function Documentation

◆ addProcessingSignalListener()

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.

◆ beginEvent()

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

void beginRun ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in LayerRelationFilter< AFilter >, FourHitFilter, QualityIndicatorFilter, ThreeHitFilter, TwoHitVirtualIPFilter, TwoHitVirtualIPQIFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, and TrackCandidateResultRefiner.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ endRun()

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.

◆ exposeParameters()

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

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

Reimplemented from Filter< AObject >.

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
inherited

Getter for the allow reverse parameter.

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

76 {
78 }
bool m_param_allowReverse
Switch to indicate if the reversed version of the object shall also be accepted (default is true).

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

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

bool needsTruthInformation
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< AObject >.

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

64 {
65 return true;
66 }

◆ operator()() [1/5]

Weight operator() ( const CDCFacet facet)
final

Main filter method returning the weight of the facet.

Returns NAN, if the cell shall be rejected.

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 getAllowReverse() const
Getter for the allow reverse parameter.
bool isInvalid() const
Check it the line is in an invalid state.

◆ operator()() [2/5]

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}
Interface class to the Monte Carlo information for individual hits.
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.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
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

◆ operator()() [3/5]

◆ operator()() [4/5]

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 58 of file Filter.icc.h.

59 {
60 return obj ? operator()(*obj) : NAN;
61 }
virtual Weight operator()(const Object &obj)
Function to evaluate the object.
Definition: Filter.icc.h:52

◆ operator()() [5/5]

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 64 of file Filter.icc.h.

65 {
66 std::vector<float> out;
67 for (const auto& obj : objs) {
68 out.push_back(operator()(obj));
69 }
70 return out;
71 }

◆ 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()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

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

Member Data Documentation

◆ m_initialized

bool m_initialized = false
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_allowReverse

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

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

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: