Belle II Software development
SegmentPairCreator Class Referenceabstract

Class providing construction combinatorics for the axial stereo segment pairs. More...

#include <SegmentPairCreator.h>

Inheritance diagram for SegmentPairCreator:
Findlet< const CDCSegment2D, CDCSegmentPair > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invokation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 Vector types that should be served to apply on invokation.
 

Public Member Functions

 SegmentPairCreator ()
 Constructor adding the filter as a subordinary processing signal listener.
 
std::string getDescription () final
 Short description of the findlet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
void apply (const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCSegmentPair > &segmentPairs) final
 Main method constructing pairs in adjacent super layers.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void initialize () override
 Receive and dispatch signal before the start of the event processing.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
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 Types

using ToVector = typename ToVectorImpl< T >::Type
 Short hand for ToRangeImpl.
 

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 = Findlet< const CDCSegment2D, CDCSegmentPair >
 Type of the base class.
 

Private Member Functions

void create (const std::vector< const CDCSegment2D * > &fromSegments, const std::vector< const CDCSegment2D * > &toSegments, std::vector< CDCSegmentPair > &segmentPairs)
 Creates segment pairs from a combination of from segments and to segments.
 

Private Attributes

bool m_param_axialBridging = false
 Parameter : Switch to enable the search for axial to axial pairs to enable more stable reconstruction of the middle stereo.
 
AxialSegmentPairCreator m_axialSegmentPairCreator
 Findlet responsible for the creation of axial axial segment pairs.
 
ChooseableSegmentPairFilter m_segmentPairFilter
 The filter to be used for the segment pair generation.
 
std::array< std::vector< const CDCSegment2D * >, ISuperLayerUtil::c_Nm_segmentsBySuperLayer
 Structure for the segments grouped by super layer id.
 
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

Class providing construction combinatorics for the axial stereo segment pairs.

Definition at line 34 of file SegmentPairCreator.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes = std::tuple<AIOTypes...>
inherited

Types that should be served to apply on invokation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors = std::tuple< std::vector<AIOTypes>... >
inherited

Vector types that should be served to apply on invokation.

Definition at line 53 of file Findlet.h.

◆ Super

using Super = Findlet<const CDCSegment2D, CDCSegmentPair>
private

Type of the base class.

Definition at line 38 of file SegmentPairCreator.h.

◆ ToVector

using ToVector = typename ToVectorImpl<T>::Type
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ SegmentPairCreator()

Constructor adding the filter as a subordinary processing signal listener.

Definition at line 26 of file SegmentPairCreator.cc.

27{
30}
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
ChooseableSegmentPairFilter m_segmentPairFilter
The filter to be used for the segment pair generation.
AxialSegmentPairCreator m_axialSegmentPairCreator
Findlet responsible for the creation of axial axial segment pairs.

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.

◆ apply()

void apply ( const std::vector< CDCSegment2D > &  inputSegments,
std::vector< CDCSegmentPair > &  segmentPairs 
)
final

Main method constructing pairs in adjacent super layers.

Definition at line 49 of file SegmentPairCreator.cc.

51{
52 segmentPairs.reserve(500);
53
54 // Group the segments by their super layer id
55 for (std::vector<const CDCSegment2D*>& segmentsInSuperLayer : m_segmentsBySuperLayer) {
56 segmentsInSuperLayer.clear();
57 }
58
59 for (const CDCSegment2D& segment : inputSegments) {
60 if (segment.empty()) continue;
61 ISuperLayer iSuperLayer = segment.front().getISuperLayer();
62 if (not ISuperLayerUtil::isInvalid(iSuperLayer)) {
63 const CDCSegment2D* ptrSegment = &segment;
64 m_segmentsBySuperLayer[iSuperLayer].push_back(ptrSegment);
65 }
66 }
67
68 // Make pairs of closeby superlayers
69 for (ISuperLayer iSuperLayer = 0; iSuperLayer < ISuperLayerUtil::c_N; ++iSuperLayer) {
70 const std::vector<const CDCSegment2D*>& fromSegments = m_segmentsBySuperLayer[iSuperLayer];
71
72 // Make pairs of this superlayer and the superlayer more to the inside
73 ISuperLayer iSuperLayerIn = ISuperLayerUtil::getNextInwards(iSuperLayer);
74 if (ISuperLayerUtil::isInCDC(iSuperLayerIn)) {
75 const std::vector<const CDCSegment2D*>& toSegments = m_segmentsBySuperLayer[iSuperLayerIn];
76 create(fromSegments, toSegments, segmentPairs);
77 }
78
79 // Make pairs of this superlayer and the superlayer more to the outside
80 ISuperLayer iSuperLayerOut = ISuperLayerUtil::getNextOutwards(iSuperLayer);
81 if (ISuperLayerUtil::isInCDC(iSuperLayerOut)) {
82 const std::vector<const CDCSegment2D*>& toSegments = m_segmentsBySuperLayer[iSuperLayerOut];
83 create(fromSegments, toSegments, segmentPairs);
84 }
85 }
86
87 std::sort(segmentPairs.begin(), segmentPairs.end());
88
89 if (not m_param_axialBridging) return;
90
91 // Memory for the axial axial segment pairs.
92 std::vector<CDCAxialSegmentPair> axialSegmentPairs;
93
94 // Create the axial to axial bridges
95 m_axialSegmentPairCreator.apply(inputSegments, axialSegmentPairs);
96
97 // Make pairs by splitting the axial segment pairs and using the *common* fit as the 3d reconstruction bases
98 for (const CDCAxialSegmentPair& axialSegmentPair : axialSegmentPairs) {
99 const CDCSegment2D* startSegment = axialSegmentPair.getStartSegment();
100 const CDCSegment2D* endSegment = axialSegmentPair.getEndSegment();
101
102 CDCTrajectory2D startCommonTrajectory = axialSegmentPair.getTrajectory2D();
103 if (not startCommonTrajectory.isFitted()) continue;
104
105 CDCTrajectory2D startTrajectory2D = startSegment->getTrajectory2D();
106 startCommonTrajectory.setLocalOrigin(startTrajectory2D.getLocalOrigin());
107 startSegment->setTrajectory2D(startCommonTrajectory);
108 std::vector<const CDCSegment2D*> startSegments{startSegment};
109
110 CDCTrajectory2D endCommonTrajectory = axialSegmentPair.getTrajectory2D();
111 CDCTrajectory2D endTrajectory2D = endSegment->getTrajectory2D();
112 endCommonTrajectory.setLocalOrigin(endTrajectory2D.getLocalOrigin());
113 endSegment->setTrajectory2D(endCommonTrajectory);
114 std::vector<const CDCSegment2D*> endSegments{endSegment};
115
116 if (startSegment->getISuperLayer() == endSegment->getISuperLayer()) {
117 ISuperLayer iSuperLayerCommon = startSegment->getISuperLayer();
118
119 ISuperLayer iSuperLayerIn = ISuperLayerUtil::getNextInwards(iSuperLayerCommon);
120 if (ISuperLayerUtil::isInCDC(iSuperLayerIn)) {
121 const std::vector<const CDCSegment2D*>& middleSegments = m_segmentsBySuperLayer[iSuperLayerIn];
122 create(startSegments, middleSegments, segmentPairs);
123 create(middleSegments, endSegments, segmentPairs);
124 }
125
126 ISuperLayer iSuperLayerOut = ISuperLayerUtil::getNextOutwards(iSuperLayerCommon);
127 if (ISuperLayerUtil::isInCDC(iSuperLayerOut)) {
128 const std::vector<const CDCSegment2D*>& middleSegments = m_segmentsBySuperLayer[iSuperLayerOut];
129 create(startSegments, middleSegments, segmentPairs);
130 create(middleSegments, endSegments, segmentPairs);
131 }
132
133 } else {
134 ISuperLayer iSuperLayerMiddle =
135 (startSegment->getISuperLayer() + endSegment->getISuperLayer()) / 2;
136 const std::vector<const CDCSegment2D*>& middleSegments = m_segmentsBySuperLayer[iSuperLayerMiddle];
137 create(startSegments, middleSegments, segmentPairs);
138 create(middleSegments, endSegments, segmentPairs);
139 }
140 startSegment->setTrajectory2D(startTrajectory2D);
141 endSegment->setTrajectory2D(endTrajectory2D);
142 }
143
144 auto lessPairAndgreaterWeight = [](const CDCSegmentPair & lhs, const CDCSegmentPair & rhs) {
145 if (lhs < rhs) return true;
146 if (rhs < lhs) return false;
147 return lhs.getAutomatonCell().getCellWeight() > rhs.getAutomatonCell().getCellWeight();
148 };
149
150 std::sort(segmentPairs.begin(), segmentPairs.end(), lessPairAndgreaterWeight);
151
152 // auto samePair = [](const CDCSegmentPair& lhs, const CDCSegmentPair& rhs) {
153 // if (lhs < rhs) return false;
154 // if (rhs < lhs) return false;
155 // return true;
156 // };
157 // erase_unique(segmentPairs, samePair);
158}
Weight getCellWeight() const
Getter for the cell weight.
void apply(const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCAxialSegmentPair > &axialSegmentPairs) final
Main method constructing pairs in adjacent super layers.
Class representing a pair of reconstructed axial segements in adjacent superlayer.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Class representing a pair of one reconstructed axial segement and one stereo segment in adjacent supe...
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
Particle trajectory as it is seen in xy projection represented as a circle.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
bool isFitted() const
Checks if the circle is already set to a valid value.
const Vector2D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
void create(const std::vector< const CDCSegment2D * > &fromSegments, const std::vector< const CDCSegment2D * > &toSegments, std::vector< CDCSegmentPair > &segmentPairs)
Creates segment pairs from a combination of from segments and to segments.
bool m_param_axialBridging
Parameter : Switch to enable the search for axial to axial pairs to enable more stable reconstruction...
std::array< std::vector< const CDCSegment2D * >, ISuperLayerUtil::c_N > m_segmentsBySuperLayer
Structure for the segments grouped by super layer id.
static const ISuperLayer c_N
Constant representing the total number of cdc superlayers.
Definition: ISuperLayer.h:56
static ISuperLayer getNextInwards(ISuperLayer iSuperLayer)
Returns the super layer that is inside of the given super layer.
Definition: ISuperLayer.cc:63
static bool isInvalid(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...
Definition: ISuperLayer.cc:38
static ISuperLayer getNextOutwards(ISuperLayer iSuperLayer)
Returns the super layer that is outside of the given super layer.
Definition: ISuperLayer.cc:72
static bool isInCDC(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...
Definition: ISuperLayer.cc:43

◆ 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 ( )
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}
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ create()

void create ( const std::vector< const CDCSegment2D * > &  fromSegments,
const std::vector< const CDCSegment2D * > &  toSegments,
std::vector< CDCSegmentPair > &  segmentPairs 
)
private

Creates segment pairs from a combination of from segments and to segments.

Definition at line 160 of file SegmentPairCreator.cc.

163{
164 CDCSegmentPair segmentPair;
165 for (const CDCSegment2D* ptrFromSegment : fromSegments) {
166 for (const CDCSegment2D* ptrToSegment : toSegments) {
167
168 if (ptrFromSegment == ptrToSegment) continue;
169 segmentPair.setSegments(ptrFromSegment, ptrToSegment);
170 segmentPair.clearTrajectory3D();
171
172 Weight pairWeight = m_segmentPairFilter(segmentPair);
173 if (not std::isnan(pairWeight)) {
174 segmentPair.getAutomatonCell().setCellWeight(pairWeight);
175 segmentPairs.push_back(segmentPair);
176 }
177 }
178 }
179}
void setCellWeight(Weight weight)
Setter for the cell weight.
void setSegments(const CDCSegment2D *fromSegment, const CDCSegment2D *toSegment)
Setter for both segments simultaniously.
void clearTrajectory3D() const
Invalides the currently stored trajectory information.

◆ 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 Findlet< const CDCSegment2D, CDCSegmentPair >.

Definition at line 37 of file SegmentPairCreator.cc.

38{
39 m_segmentPairFilter.exposeParameters(moduleParamList, prefix);
40 m_axialSegmentPairCreator.exposeParameters(moduleParamList, prefixed("Axial", prefix));
41
42 moduleParamList->addParameter(prefixed(prefix, "axialBridging"),
44 "Switch to enable the search for axial to axial pairs "
45 "to enable more stable reconstruction of the middle stereo",
47}
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription()

std::string getDescription ( )
finalvirtual

Short description of the findlet.

Reimplemented from Findlet< const CDCSegment2D, CDCSegmentPair >.

Definition at line 32 of file SegmentPairCreator.cc.

33{
34 return "Creates axial stereo segment pairs from a set of segments filtered by some acceptance criterion";
35}

◆ 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

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.

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

AxialSegmentPairCreator m_axialSegmentPairCreator
private

Findlet responsible for the creation of axial axial segment pairs.

Definition at line 66 of file SegmentPairCreator.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_param_axialBridging

bool m_param_axialBridging = false
private

Parameter : Switch to enable the search for axial to axial pairs to enable more stable reconstruction of the middle stereo.

Definition at line 62 of file SegmentPairCreator.h.

◆ m_segmentPairFilter

ChooseableSegmentPairFilter m_segmentPairFilter
private

The filter to be used for the segment pair generation.

Definition at line 69 of file SegmentPairCreator.h.

◆ m_segmentsBySuperLayer

std::array<std::vector<const CDCSegment2D*>, ISuperLayerUtil::c_N> m_segmentsBySuperLayer
private

Structure for the segments grouped by super layer id.

Definition at line 73 of file SegmentPairCreator.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: