Belle II Software development
MCSegmentTripleRelationFilter Class Reference

Class filtering the neighborhood of segment triples with monte carlo information. More...

#include <MCSegmentTripleRelationFilter.h>

Inheritance diagram for MCSegmentTripleRelationFilter:
MCSymmetric< BaseSegmentTripleRelationFilter > BaseSegmentTripleRelationFilter RelationFilter< const CDCSegmentTriple > Filter< Relation< const CDCSegmentTriple > > 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

 MCSegmentTripleRelationFilter (bool allowReverse=true)
 Constructor.
 
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 &fromTriple, const CDCSegmentTriple &toTriple) final
 Main filter method returning the weight of the neighborhood relation.
 
void setAllowReverse (bool allowReverse) override
 Setter for the allow reverse parameter.
 
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.
 
bool getAllowReverse () const
 Getter for the allow reverse parameter.
 
bool getAllowReverse () const
 Getter for the allow reverse parameter.
 
std::vector< const CDCSegmentTriple * > getPossibleTos (const CDCSegmentTriple *from, const std::vector< const CDCSegmentTriple * > &segmentTriples) const final
 Returns the segment triples form the range that continue on the to site of the given segment triple.
 
virtual std::vector< const CDCSegmentTriple * > getPossibleTos (const CDCSegmentTriple *from, const std::vector< const CDCSegmentTriple * > &objects) const
 Selects the objects possibly related to the given one from the given pool of objects.
 
virtual Weight operator() (const const CDCSegmentTriple &from, const const CDCSegmentTriple &to)
 Main filter method returning the weight of the neighborhood relation.
 
virtual std::vector< float > operator() (const std::vector< Relation< const CDCSegmentTriple > * > &objs) override
 Filter over a vector of relations.
 
Weight operator() (const Relation< const CDCSegmentTriple > &relation) override
 Main filter method overriding the filter interface method.
 
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<BaseSegmentTripleRelationFilter>
 Type of the super class.
 

Private Attributes

MCSegmentTripleFilter m_mcSegmentTripleFilter
 Instance of the Monte Carlo segment triple filter for rejection of false cells.
 
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.
 
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

Class filtering the neighborhood of segment triples with monte carlo information.

Definition at line 23 of file MCSegmentTripleRelationFilter.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 27 of file MCSegmentTripleRelationFilter.h.

Constructor & Destructor Documentation

◆ MCSegmentTripleRelationFilter()

MCSegmentTripleRelationFilter ( bool allowReverse = true)
explicit

Constructor.

Definition at line 20 of file MCSegmentTripleRelationFilter.cc.

20 :
21 m_mcSegmentTripleFilter(allowReverse)
22{
24}
MCSegmentTripleFilter m_mcSegmentTripleFilter
Instance of the Monte Carlo segment triple filter for rejection 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() [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()

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.

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

Definition at line 26 of file MCSegmentTripleRelationFilter.cc.

28{
29 m_mcSegmentTripleFilter.exposeParameters(moduleParamList, prefix);
30}

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

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ getPossibleTos() [1/2]

std::vector< const CDCSegmentTriple * > getPossibleTos ( const CDCSegmentTriple * from,
const std::vector< const CDCSegmentTriple * > & segmentTriples ) const
finalinherited

Returns the segment triples form the range that continue on the to site of the given segment triple.

Definition at line 30 of file BaseSegmentTripleRelationFilter.cc.

33{
34 assert(std::is_sorted(segmentTriples.begin(), segmentTriples.end(), LessOf<Deref>()) &&
35 "Expected segment triples to be sorted");
36
37 const CDCSegment2D* endSegment = from->getEndSegment();
38
39 ConstVectorRange<const CDCSegmentTriple*> neighbors{
40 std::equal_range(segmentTriples.begin(), segmentTriples.end(), &endSegment, LessOf<Deref>())};
41 return {neighbors.begin(), neighbors.end()};
42}
const CDCAxialSegment2D * getEndSegment() const
Getter for the end axial segment.

◆ getPossibleTos() [2/2]

std::vector< const CDCSegmentTriple * > getPossibleTos ( const CDCSegmentTriple * from,
const std::vector< const CDCSegmentTriple * > & objects ) const
virtualinherited

Selects the objects possibly related to the given one from the given pool of objects.

Definition at line 39 of file RelationFilter.icc.h.

30 {
31 return objects;
32 }

◆ initialize()

void initialize ( )
finalvirtual

Initialize the before event processing.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 32 of file MCSegmentTripleRelationFilter.cc.

33{
36}
void setAllowReverse(bool allowReverse) override
Setter for the allow reverse parameter.

◆ needsTruthInformation() [1/2]

bool needsTruthInformation ( )
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< Relation< const CDCSegmentTriple > >.

◆ needsTruthInformation() [2/2]

bool needsTruthInformation ( )
finalvirtualinherited

Indicates that the filter requires Monte Carlo information.

Reimplemented from Filter< Relation< const CDCSegmentTriple > >.

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.

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

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

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

Weight operator() ( const CDCSegmentTriple & fromTriple,
const CDCSegmentTriple & toTriple )
final

Main filter method returning the weight of the neighborhood relation.

Return NAN if relation shall be rejected.

Definition at line 38 of file MCSegmentTripleRelationFilter.cc.

40{
41 if (fromTriple.getEndSegment() != toTriple.getStartSegment()) return NAN;
42
43 Weight mcFromTripleWeight = m_mcSegmentTripleFilter(fromTriple);
44 Weight mcToTripleWeight = m_mcSegmentTripleFilter(toTriple);
45
46 ESign fromFBInfo = sign(mcFromTripleWeight);
47 ESign toFBInfo = sign(mcToTripleWeight);
48
49 if (not isValid(fromFBInfo) or not isValid(toFBInfo) or fromFBInfo != toFBInfo) return NAN;
50
51 ESign commonFBInfo = fromFBInfo;
52
53 Weight overlapWeight = toTriple.getStartSegment()->size();
54 return commonFBInfo > 0 ? overlapWeight : -overlapWeight;
55}
const CDCAxialSegment2D * getStartSegment() const
Getter for the start axial segment.
ESign
Enumeration for the distinct sign values of floating point variables.
Definition ESign.h:27
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.

◆ operator()() [5/7]

Weight operator() ( const const CDCSegmentTriple & from,
const const CDCSegmentTriple & to )
virtualinherited

Main filter method returning the weight of the neighborhood relation.

Return always returns NAN to reject all segment neighbors.

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

37 {
38 return 1;
39 }

◆ operator()() [6/7]

Weight operator() ( const Relation< const CDCSegmentTriple > & relation)
overrideinherited

Main filter method overriding the filter interface method.

Checks the validity of the pointers in the relation and unpacks the relation to the method implementing the rejection.

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

43 {
44 const AObject* from = relation.getFrom();
45 const AObject* to = relation.getTo();
46
47 if (from == to) return NAN; // Prevent relation to same.
48 if ((from == nullptr) or (to == nullptr)) return NAN;
49 return operator()(*from, *to);
50 }

◆ operator()() [7/7]

virtual std::vector< float > operator() ( const std::vector< Relation< const CDCSegmentTriple > * > & objs)
inlineoverridevirtualinherited

Filter over a vector of relations.

We need to override it since derived relation classes do not implement a call with a pointer to a relation.

Definition at line 51 of file RelationFilter.dcl.h.

52 {
53 std::vector<float> out(objs.size());
54 for (size_t iObj = 0; iObj < objs.size(); iObj += 1) {
55 if (objs[iObj]) {
56 out[iObj] = operator()(*objs[iObj]);
57 } else {
58 out[iObj] = NAN;
59 }
60 }
61 return out;
62 }

◆ setAllowReverse()

void setAllowReverse ( bool allowReverse)
inlineoverridevirtual

Setter for the allow reverse parameter.

Reimplemented from MCSymmetric< BaseSegmentTripleRelationFilter >.

Definition at line 48 of file MCSegmentTripleRelationFilter.h.

49 {
50 Super::setAllowReverse(allowReverse);
51 m_mcSegmentTripleFilter.setAllowReverse(allowReverse);
52 }

◆ terminate()

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_mcSegmentTripleFilter

MCSegmentTripleFilter m_mcSegmentTripleFilter
private

Instance of the Monte Carlo segment triple filter for rejection of false cells.

Definition at line 56 of file MCSegmentTripleRelationFilter.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

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

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: