Belle II Software development
MCSegmentTripleFilter Class Reference

Filter for the construction of segment triples based on Monte Carlo information. More...

#include <MCSegmentTripleFilter.h>

Inheritance diagram for MCSegmentTripleFilter:
MCSymmetric< BaseSegmentTripleFilter > Filter< CDCSegmentTriple > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object = CDCSegmentTriple
 Type of the object to be analysed.
 
using Interface = Filter< CDCSegmentTriple >
 Mark this class as the basic interface.
 

Public Member Functions

 MCSegmentTripleFilter (bool allowReverse=true)
 Constructor initializing the symmetry flag.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
void initialize () final
 Initialize the before event processing.
 
Weight operator() (const CDCSegmentTriple &segmentTriple) final
 Check if the segment triple is aligned in the Monte Carlo track. Signals NAN if not.
 
void setAllowReverse (bool allowReverse) override
 Setter for the allow reverse parameter.
 
void beginEvent () override
 Signal the beginning of a new event.
 
bool needsTruthInformation () final
 Indicates that the filter requires Monte Carlo information.
 
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< BaseSegmentTripleFilter >
 Type of the super class.
 

Private Member Functions

void setTrajectoryOf (const CDCSegmentTriple &segmentTriple) const
 Sets the trajectories of the segment triple from Monte Carlo information. Is executed for good segment triples.
 

Private Attributes

MCAxialSegmentPairFilter m_mcAxialSegmentPairFilter
 Instance of the cell filter to reject neighborhoods of false cells.
 
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 segment triples based on Monte Carlo information.

Definition at line 27 of file MCSegmentTripleFilter.h.

Member Typedef Documentation

◆ Interface

using Interface = Filter<CDCSegmentTriple >
inherited

Mark this class as the basic interface.

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

◆ Object

using Object = CDCSegmentTriple
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 31 of file MCSegmentTripleFilter.h.

Constructor & Destructor Documentation

◆ MCSegmentTripleFilter()

MCSegmentTripleFilter ( bool  allowReverse = true)
explicit

Constructor initializing the symmetry flag.

Definition at line 28 of file MCSegmentTripleFilter.cc.

28 :
29 Super(allowReverse),
30 m_mcAxialSegmentPairFilter(allowReverse)
31{
33}
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
MCSymmetric< BaseSegmentTripleFilter > Super
Type of the super class.
MCAxialSegmentPairFilter m_mcAxialSegmentPairFilter
Instance of the cell filter to reject neighborhoods of false cells.

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

Expose the parameters to a module.

Reimplemented from Filter< CDCSegmentTriple >.

Definition at line 35 of file MCSegmentTripleFilter.cc.

37{
38 m_mcAxialSegmentPairFilter.exposeParameters(moduleParamList, prefix);
39}
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.

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

Initialize the before event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 41 of file MCSegmentTripleFilter.cc.

42{
45}
void setAllowReverse(bool allowReverse) override
Setter for the allow reverse parameter.
void initialize() override
Initialize the before event processing.
bool getAllowReverse() const
Getter for the allow reverse parameter.

◆ needsTruthInformation()

bool needsTruthInformation
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< CDCSegmentTriple >.

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

64 {
65 return true;
66 }

◆ operator()() [1/4]

Weight operator() ( const CDCSegmentTriple segmentTriple)
final

Check if the segment triple is aligned in the Monte Carlo track. Signals NAN if not.

Recheck the axial axial compatibility

Definition at line 47 of file MCSegmentTripleFilter.cc.

48{
49 const CDCAxialSegment2D* ptrStartSegment = segmentTriple.getStartSegment();
50 const CDCStereoSegment2D* ptrMiddleSegment = segmentTriple.getMiddleSegment();
51 const CDCAxialSegment2D* ptrEndSegment = segmentTriple.getEndSegment();
52
53 const CDCAxialSegment2D& startSegment = *ptrStartSegment;
54 const CDCAxialSegment2D& middleSegment = *ptrMiddleSegment;
55 const CDCAxialSegment2D& endSegment = *ptrEndSegment;
56
58 Weight pairWeight =
59 m_mcAxialSegmentPairFilter(CDCAxialSegmentPair(ptrStartSegment, ptrEndSegment));
60
61 if (std::isnan(pairWeight)) return NAN;
62
64
65 // Check if the segments are aligned correctly along the Monte Carlo track
66 EForwardBackward startToMiddleFBInfo = mcSegmentLookUp.areAlignedInMCTrack(ptrStartSegment, ptrMiddleSegment);
67 if (startToMiddleFBInfo == EForwardBackward::c_Invalid) return NAN;
68
69 EForwardBackward middleToEndFBInfo = mcSegmentLookUp.areAlignedInMCTrack(ptrMiddleSegment, ptrEndSegment);
70 if (middleToEndFBInfo == EForwardBackward::c_Invalid) return NAN;
71
72
73 if (startToMiddleFBInfo != middleToEndFBInfo) return NAN;
74
75
76 if ((startToMiddleFBInfo == EForwardBackward::c_Forward and middleToEndFBInfo == EForwardBackward::c_Forward) or
77 (getAllowReverse() and startToMiddleFBInfo == EForwardBackward::c_Backward and middleToEndFBInfo == EForwardBackward::c_Backward)) {
78
79 // Do fits
80 setTrajectoryOf(segmentTriple);
81
82 Weight cellWeight = startSegment.size() + middleSegment.size() + endSegment.size();
83 return startToMiddleFBInfo > 0 ? cellWeight : -cellWeight;
84 }
85
86 return NAN;
87}
Class representing a pair of reconstructed axial segments in adjacent superlayer.
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...
Specialisation of the lookup for the truth values of two dimensional segments.
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
const CDCStereoSegment2D * getMiddleSegment() const
Getter for the middle stereo segment.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end axial segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start axial segment.
void setTrajectoryOf(const CDCSegmentTriple &segmentTriple) const
Sets the trajectories of the segment triple from Monte Carlo information. Is executed for good segmen...
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.

◆ operator()() [2/4]

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

53 {
54 return 1;
55 }

◆ operator()() [3/4]

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

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 86 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)
inlineoverridevirtual

Setter for the allow reverse parameter.

Reimplemented from MCSymmetric< BaseSegmentTripleFilter >.

Definition at line 53 of file MCSegmentTripleFilter.h.

54 {
55 Super::setAllowReverse(allowReverse);
57 }
virtual void setAllowReverse(bool allowReverse)
Setter for the allow reverse parameter.

◆ setTrajectoryOf()

void setTrajectoryOf ( const CDCSegmentTriple segmentTriple) const
private

Sets the trajectories of the segment triple from Monte Carlo information. Is executed for good segment triples.

Definition at line 91 of file MCSegmentTripleFilter.cc.

92{
93 if (segmentTriple.getTrajectorySZ().isFitted()) {
94 // SZ trajectory has been fitted before. Skipping
95 // A fit sz trajectory implies a 2d trajectory to be fitted, but not the other way around
96 return;
97 }
98
99 const CDCAxialSegment2D* ptrStartSegment = segmentTriple.getStartSegment();
100 if (not ptrStartSegment) {
101 B2WARNING("Start segment of segmentTriple is nullptr. Could not set fits.");
102 return;
103 }
104
106
107 CDCTrajectory3D trajectory3D = mcSegmentLookUp.getTrajectory3D(ptrStartSegment);
108 segmentTriple.setTrajectory3D(trajectory3D);
109}
CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
void setTrajectory3D(const CDCTrajectory3D &trajectory3D) const
Setter for the three dimensional helix trajectory.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the linear trajectory in the sz direction.
Particle full three dimensional trajectory.
bool isFitted() const
Indicates if the line has been fitted.

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

MCAxialSegmentPairFilter m_mcAxialSegmentPairFilter
private

Instance of the cell filter to reject neighborhoods of false cells.

Definition at line 61 of file MCSegmentTripleFilter.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: