Belle II Software development
LayerRelationFilter< AFilter > Class Template Reference

Relation filter the creation of relations. More...

#include <LayerRelationFilter.dcl.h>

Inheritance diagram for LayerRelationFilter< AFilter >:
RelationFilter< VXDHoughState > 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

 LayerRelationFilter ()
 Add the filter as listener.
 
 ~LayerRelationFilter ()
 Default destructor.
 
std::vector< VXDHoughState * > getPossibleTos (VXDHoughState *from, const std::vector< VXDHoughState * > &states) const final
 Return all states the given state is possible related to.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters of the filter.
 
TrackFindingCDC::Weight operator() (const VXDHoughState &from, const VXDHoughState &to) final
 Get the weight of the relation between from and to.
 
void beginRun () final
 Initialize the maximal ladder cache.
 
virtual std::vector< VXDHoughState * > getPossibleTos (VXDHoughState *from, const std::vector< VXDHoughState * > &objects) const
 Selects the objects possibly related to the given one from the given pool of objects.
 
virtual Weight operator() (const VXDHoughState &from, const VXDHoughState &to)
 Main filter method returning the weight of the neighborhood relation.
 
virtual std::vector< float > operator() (const std::vector< Relation< VXDHoughState > * > &objs) override
 Filter over a vector of relations.
 
Weight operator() (const Relation< VXDHoughState > &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.
 
virtual bool needsTruthInformation ()
 Indicates if the filter requires Monte Carlo information.
 
void initialize () override
 Receive and dispatch signal before the start of the event processing.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
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 = TrackFindingCDC::RelationFilter< VXDHoughState >
 The parent class.
 

Private Attributes

int m_hitJumping = 1
 Parameter: Make it possible to jump over N layers.
 
AFilter m_filter
 Filter for rejecting the states.
 
std::array< ushort, 7 > m_maximalLadderCache
 Cached number of ladders per layer.
 
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 happend before.
 
bool m_terminated = false
 Flag to keep track whether termination happend before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

template<class AFilter>
class Belle2::vxdHoughTracking::LayerRelationFilter< AFilter >

Relation filter the creation of relations.

Definition at line 24 of file LayerRelationFilter.dcl.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

The parent class.

Definition at line 26 of file LayerRelationFilter.dcl.h.

Constructor & Destructor Documentation

◆ LayerRelationFilter()

Add the filter as listener.

Definition at line 25 of file LayerRelationFilter.icc.h.

25 : Super()
26 {
28 }
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
TrackFindingCDC::RelationFilter< VXDHoughState > Super
The parent class.
AFilter m_filter
Filter for rejecting the states.

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

Receive and dispatch signal for the start of a new event.

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun
finalvirtual

Initialize the maximal ladder cache.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 40 of file LayerRelationFilter.icc.h.

41 {
43
44 // Fill maximum number cache
45 auto& geoCache = VXD::GeoCache::getInstance();
46 const auto& layers = geoCache.getLayers(VXD::SensorInfoBase::SensorType::SVD);
47 for (const auto& layerVXDID : layers) {
48 m_maximalLadderCache[layerVXDID.getLayerNumber()] = geoCache.getLadders(layerVXDID).size();
49 }
50 }
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
std::array< ushort, 7 > m_maximalLadderCache
Cached number of ladders per layer.

◆ 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 of the filter.

Reimplemented from Filter< AObject >.

Definition at line 31 of file LayerRelationFilter.icc.h.

32 {
33 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "hitJumping"), m_hitJumping,
34 "Make it possible to jump over N layers.", m_hitJumping);
35
36 m_filter.exposeParameters(moduleParamList, prefix);
37 }
int m_hitJumping
Parameter: Make it possible to jump over N layers.

◆ 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< VXDHoughState * > getPossibleTos ( VXDHoughState *  from,
const std::vector< VXDHoughState * > &  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 }

◆ getPossibleTos() [2/2]

std::vector< VXDHoughState * > getPossibleTos ( VXDHoughState from,
const std::vector< VXDHoughState * > &  states 
) const
final

Return all states the given state is possible related to.

Definition at line 57 of file LayerRelationFilter.icc.h.

58 {
59 std::vector<VXDHoughState*> possibleNextHits;
60 possibleNextHits.reserve(hits.size());
61
62 const VXDHoughState::DataCache& currentVXDHoughState = currentHit->getDataCache();
63 const unsigned int currentLayer = currentVXDHoughState.layer;
64 const unsigned int nextPossibleLayer = std::max(static_cast<int>(currentLayer) - 1 - m_hitJumping, 0);
65
66 for (VXDHoughState* nextHit : hits) {
67 if (currentHit == nextHit) {
68 continue;
69 }
70
71 const VXDHoughState::DataCache& nextVXDHoughState = nextHit->getDataCache();
72 const unsigned int nextLayer = nextVXDHoughState.layer;
73
74 if (std::max(currentLayer, nextPossibleLayer) >= nextLayer and nextLayer >= std::min(currentLayer, nextPossibleLayer)) {
75
76 if (currentLayer == nextLayer) {
77 // next layer is an overlap one, so lets return all hits from the same layer, that are on a
78 // ladder which is below the last added hit.
79 const unsigned int fromLadderNumber = currentVXDHoughState.ladder;
80 const unsigned int maximumLadderNumber = m_maximalLadderCache.at(currentLayer);
81
82 // the reason for this strange formula is the numbering scheme in the VXD.
83 // we first substract 1 from the ladder number to have a ladder counting from 0 to N - 1,
84 // then we add (PXD)/subtract(SVD) one to get to the next (overlapping) ladder and do a % N to also cope for the
85 // highest number. Then we add 1 again, to go from the counting from 0 .. N-1 to 1 .. N.
86 // The + maximumLadderNumber in between makes sure, we are not ending with negative numbers
87 const int direction = -1;
88 const unsigned int overlappingLadder =
89 ((fromLadderNumber + maximumLadderNumber - 1) + direction) % maximumLadderNumber + 1;
90
91 if (nextVXDHoughState.ladder != overlappingLadder) {
92 continue;
93 }
94
95 // Next we make sure to not have any cycles in our graph: we do this by defining only the halves of the
96 // sensor as overlapping. So if the first hit is coming from sensor 1 and the second from sensor 2,
97 // they are only related if the one from sensor 1 is on the half, that is pointing towards sensor 2
98 // and the one on sensor 2 is on the half that is pointing towards sensor 1.
99 //
100 // X X X
101 // ----|---- ----|---- ----|----
102 // This is fine: X This not: X This not: X
103 // ----|---- ----|---- ----|----
104 if (currentVXDHoughState.localNormalizedu > 0.2) {
105 continue;
106 }
107
108 if (nextVXDHoughState.localNormalizedu <= 0.8) {
109 continue;
110 }
111 }
112
113 possibleNextHits.push_back(nextHit);
114 }
115 }
116
117 return possibleNextHits;
118 }

◆ initialize()

void initialize ( )
overridevirtualinherited

Receive and dispatch signal before the start of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in UnionVarSet< AObject >, UnionVarSet< Object >, VariadicUnionVarSet< AVarSets >, ResultStorer< Belle2::CKFToPXDResult >, ResultStorer< Belle2::CKFToSVDResult >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >, OnVarSet< Filter< ATruthVarSet::Object > >, OnVarSet< Filter< AVarSet::Object > >, OnVarSet< BaseFacetFilter >, OnVarSet< BaseFacetRelationFilter >, OnVarSet< BaseAxialSegmentPairFilter >, OnVarSet< BaseSegmentRelationFilter >, OnVarSet< BaseTrackRelationFilter >, OnVarSet< BaseSegmentPairRelationFilter >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreArrayLoader< const Belle2::SpacePoint >, StoreArrayLoader< DataStoreInputTypeRefType >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RelationVarSet< ABaseVarSet >, QualityIndicatorFilter, TwoHitVirtualIPQIFilter, MultiHoughSpaceFastInterceptFinder, RawTrackCandCleaner< AHit >, RawTrackCandCleaner< Belle2::vxdHoughTracking::VXDHoughState >, RecoTrackStorer, ROIFinder, SingleHoughSpaceFastInterceptFinder, SpacePointLoaderAndPreparer, TrackCandidateOverlapResolver, and TrackCandidateResultRefiner.

Definition at line 15 of file CompositeProcessingSignalListener.cc.

16{
19 psl->initialize();
20 }
21}
virtual void initialize()
Receive signal before the start of the event processing.

◆ needsTruthInformation()

◆ operator()() [1/7]

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

Weight operator() ( const Relation< VXDHoughState > &  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 }
virtual Weight operator()(const VXDHoughState &from, const VXDHoughState &to)
Main filter method returning the weight of the neighborhood relation.

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

◆ operator()() [5/7]

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

Filter over a vector of relations.

We need to override it since derrived 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 }

◆ operator()() [6/7]

Weight operator() ( const VXDHoughState &  from,
const VXDHoughState &  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()() [7/7]

TrackFindingCDC::Weight operator() ( const VXDHoughState from,
const VXDHoughState to 
)
final

Get the weight of the relation between from and to.

Definition at line 121 of file LayerRelationFilter.icc.h.

122 {
123 return m_filter(std::make_pair(&from, &to));
124 }

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

AFilter m_filter
private

Filter for rejecting the states.

Definition at line 53 of file LayerRelationFilter.dcl.h.

◆ m_hitJumping

int m_hitJumping = 1
private

Parameter: Make it possible to jump over N layers.

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

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happend 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_maximalLadderCache

std::array<ushort, 7> m_maximalLadderCache
private

Cached number of ladders per layer.

Definition at line 55 of file LayerRelationFilter.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 happend before.

Definition at line 55 of file ProcessingSignalListener.h.


The documentation for this class was generated from the following files: