Belle II Software development
AxialTrackCreatorSegmentHough Class Referenceabstract

Generates axial tracks from segments using the hough algorithm. More...

#include <AxialTrackCreatorSegmentHough.h>

Inheritance diagram for AxialTrackCreatorSegmentHough:
Findlet< const CDCSegment2D, CDCTrack > 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

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 initialize () final
 Initialize the findlet before event processing.
 
void apply (const std::vector< CDCSegment2D > &segments, std::vector< CDCTrack > &tracks) final
 Generates the tracks from the given segments into the output argument.
 
void terminate () final
 Cleanup the findlet after event processing.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
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.
 

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, CDCTrack >
 Type of the base class.
 
using SimpleSegmentPhi0ImpactCurvHoughTree = SimpleSegmentHoughTree< InPhi0ImpactCurvBox, c_phi0Divisions, c_impactDivisions, c_curvDivisions >
 Type of the hough space tree search.
 

Private Attributes

double m_param_minNHits = 40
 Parameter: Absolute minimal number of hits to make an axial track.
 
double m_param_minFractionNHits = 0.5
 Parameter: Minimal number of hits as a fraction of the total hits in the event.
 
int m_param_maxLevel = 12
 Parameter: Level of divisions in the hough space.
 
std::vector< float > m_param_curvBounds {{ -0.13, 0.13}}
 Parameter: Curvature bounds of the hough space.
 
std::vector< float > m_param_impactBounds {{ -100, 100}}
 Parameter: Impact parameter bounds of the hough space.
 
int m_param_discretePhi0Width = 2
 Parameter: Width of the phi0 bins at the lowest level of the hough space.
 
int m_param_discretePhi0Overlap = 1
 Parameter: Overlap of the phi0 bins at the lowest level of the hough space.
 
int m_param_discreteImpactWidth = 2
 Parameter: Width of the impact bins at the lowest level of the hough space.
 
int m_param_discreteImpactOverlap = 1
 Parameter: Overlap of the impact bins at the lowest level of the hough space.
 
int m_param_discreteCurvWidth = 2
 Parameter: Width of the curvature bins at the lowest level of the hough space.
 
int m_param_discreteCurvOverlap = 1
 Parameter: Overlap of the curvature bins at the lowest level of the hough space.
 
std::unique_ptr< SimpleSegmentPhi0ImpactCurvHoughTreem_houghTree
 The hough space tree search.
 
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.
 

Static Private Attributes

static const int c_phi0Divisions = 2
 Fixed parameter: Number of divisions in the phi0 direction.
 
static const int c_impactDivisions = 2
 Fixed parameter: Number of divisions in the impact direction.
 
static const int c_curvDivisions = 2
 Fixed parameter: Number of divisions in the curv direction.
 

Detailed Description

Generates axial tracks from segments using the hough algorithm.

Definition at line 30 of file AxialTrackCreatorSegmentHough.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.

◆ SimpleSegmentPhi0ImpactCurvHoughTree

◆ Super

using Super = Findlet<const CDCSegment2D, CDCTrack>
private

Type of the base class.

Definition at line 34 of file AxialTrackCreatorSegmentHough.h.

◆ ToVector

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

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

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 > &  segments,
std::vector< CDCTrack > &  tracks 
)
final

Generates the tracks from the given segments into the output argument.

Setting trajectories

Definition at line 125 of file AxialTrackCreatorSegmentHough.cc.

127{
128 m_houghTree->fell();
129
130 size_t nAxialHits = 0;
131 std::vector<const CDCSegment2D*> ptrAxialSegments;
132 ptrAxialSegments.reserve(segments.size());
133
134 for (const CDCSegment2D& segment : segments) {
135 if (segment.getStereoKind() == EStereoKind::c_Axial) {
136 ptrAxialSegments.push_back(&segment);
137 nAxialHits += segment.size();
138 }
139 }
140
141 m_houghTree->seed(ptrAxialSegments);
143
144 Weight minWeight = std::min(m_param_minNHits, nAxialHits * m_param_minFractionNHits);
145
146 using Candidate = std::pair<HoughBox, std::vector<const CDCSegment2D*> >;
147 std::vector<Candidate> candidates = m_houghTree->findBest(minWeight);
148
149 for (const Candidate& candidate : candidates) {
151 CDCObservations2D observations;
152
153 const HoughBox& foundHoughBox = candidate.first;
154 const std::vector<const CDCSegment2D*>& foundSegments = candidate.second;
155 for (const CDCSegment2D* segment : foundSegments) {
156 observations.appendRange(*segment);
157 }
158 CDCTrajectory2D trajectory2D = fitter.fit(observations);
159
160 // Check if the circle has been fitted reverse to the hough box by accident
161 {
162 double curv = trajectory2D.getCurvature();
163 const std::array<DiscreteCurv, 2>& curvs = foundHoughBox.getBounds<DiscreteCurv>();
164 float lowerCurv = *(curvs[0]);
165 float upperCurv = *(curvs[1]);
166 if (static_cast<double>(ESignUtil::common(lowerCurv, upperCurv)) * curv < 0) {
167 trajectory2D.reverse();
168 }
169 }
170
171 CDCTrack track;
172 for (const CDCSegment2D* segment : foundSegments) {
173 for (const CDCRecoHit2D& recoHit2D : *segment) {
174 track.push_back(CDCRecoHit3D::reconstruct(recoHit2D, trajectory2D));
175 }
176 }
177 track.sortByArcLength2D();
178
180 if (track.empty()) continue;
181 const CDCRecoHit3D& startRecoHit3D = track.front();
182 CDCTrajectory3D startTrajectory3D(trajectory2D);
183 startTrajectory3D.setLocalOrigin(startRecoHit3D.getRecoPos3D());
184 track.setStartTrajectory3D(startTrajectory3D);
185
186 const CDCRecoHit3D& endRecoHit3D = track.back();
187 CDCTrajectory3D endTrajectory3D(trajectory2D);
188 endTrajectory3D.setLocalOrigin(endRecoHit3D.getRecoPos3D());
189 track.setEndTrajectory3D(endTrajectory3D);
190
191 tracks.push_back(std::move(track));
192 }
193}
double m_param_minNHits
Parameter: Absolute minimal number of hits to make an axial track.
std::unique_ptr< SimpleSegmentPhi0ImpactCurvHoughTree > m_houghTree
The hough space tree search.
double m_param_minFractionNHits
Parameter: Minimal number of hits as a fraction of the total hits in the event.
Class serving as a storage of observed drift circles to present to the Riemann fitter.
std::size_t appendRange(const CDCSegment2D &segment2D)
Appends all reconstructed hits from the two dimensional segment.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
const Vector3D & getRecoPos3D() const
Getter for the 3d position of the hit.
Definition: CDCRecoHit3D.h:285
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
Definition: CDCRecoHit3D.cc:56
Class implementing the Riemann fit for two dimensional trajectory circle.
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Particle trajectory as it is seen in xy projection represented as a circle.
void reverse()
Reverses the trajectory in place.
double getCurvature() const
Getter for the curvature as seen from the xy projection.
Particle full three dimensional trajectory.
Representation for a discrete position in an array of discrete positions.
Definition: DiscreteValue.h:23
typename InBox::HoughBox HoughBox
Type of the hough box.
static ESign common(ESign n1, ESign n2)
Check if two values have a common sign.
Definition: ESign.h:57

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

◆ 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, CDCTrack >.

Definition at line 30 of file AxialTrackCreatorSegmentHough.cc.

32{
33 moduleParamList->addParameter(prefixed(prefix, "minNHits"),
35 "Absolute minimal number of hits to make an axial track.",
37
38 moduleParamList->addParameter(prefixed(prefix, "minFractionNHits"),
40 "Minimal number of hits as a fraction of the total hits in the event.",
42
43 moduleParamList->addParameter(prefixed(prefix, "maxLevel"),
45 "Level of divisions in the hough space.",
47
48 moduleParamList->addParameter(prefixed(prefix, "curvBounds"),
50 "Curvature bounds of the hough space.",
52
53 moduleParamList->addParameter(prefixed(prefix, "impactBounds"),
55 "Impact parameter bounds of the hough space.",
57
58 moduleParamList->addParameter(prefixed(prefix, "discretePhi0Width"),
60 "Width of the phi0 bins at the lowest level of the hough space.",
62
63 moduleParamList->addParameter(prefixed(prefix, "discretePhi0Overlap"),
65 "Overlap of the phi0 bins at the lowest level of the hough space.",
67
68 moduleParamList->addParameter(prefixed(prefix, "discreteImpactWidth"),
70 "Width of the impact bins at the lowest level of the hough space.",
72
73 moduleParamList->addParameter(prefixed(prefix, "discreteImpactOverlap"),
75 "Overlap of the impact bins at the lowest level of the hough space.",
77
78 moduleParamList->addParameter(prefixed(prefix, "discreteCurvWidth"),
80 "Width of the curvature bins at the lowest level of the hough space.",
82
83 moduleParamList->addParameter(prefixed(prefix, "discreteCurvOverlap"),
85 "Overlap of the curvature bins at the lowest level of the hough space.",
87
88}
int m_param_discreteImpactWidth
Parameter: Width of the impact bins at the lowest level of the hough space.
int m_param_discretePhi0Width
Parameter: Width of the phi0 bins at the lowest level of the hough space.
std::vector< float > m_param_curvBounds
Parameter: Curvature bounds of the hough space.
int m_param_discreteImpactOverlap
Parameter: Overlap of the impact bins at the lowest level of the hough space.
int m_param_discreteCurvOverlap
Parameter: Overlap of the curvature bins at the lowest level of the hough space.
int m_param_maxLevel
Parameter: Level of divisions in the hough space.
int m_param_discreteCurvWidth
Parameter: Width of the curvature bins at the lowest level of the hough space.
int m_param_discretePhi0Overlap
Parameter: Overlap of the phi0 bins at the lowest level of the hough space.
std::vector< float > m_param_impactBounds
Parameter: Impact parameter bounds of the hough space.
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, CDCTrack >.

Definition at line 25 of file AxialTrackCreatorSegmentHough.cc.

26{
27 return "Generates axial tracks from segments using a hough space over phi0 impact and curvature for the spares case.";
28}

◆ 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 findlet before event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 90 of file AxialTrackCreatorSegmentHough.cc.

91{
93
94 B2ASSERT("Need exactly two curv bound", m_param_curvBounds.size() == 2);
95 B2ASSERT("Need exactly two impact bound", m_param_impactBounds.size() == 2);
96
97 const size_t nPhi0Bins = std::pow(c_phi0Divisions, m_param_maxLevel);
98 const Phi0BinsSpec phi0BinsSpec(nPhi0Bins,
101
102 std::array<double, 2> impactBounds{{m_param_impactBounds.front(), m_param_impactBounds.back()}};
103 const size_t nImpactBins = std::pow(c_impactDivisions, m_param_maxLevel);
104 const ImpactBinsSpec impactBinsSpec(impactBounds[0],
105 impactBounds[1],
106 nImpactBins,
109
110 std::array<double, 2> curvBounds{{m_param_curvBounds.front(), m_param_curvBounds.back()}};
111 const size_t nCurvBins = std::pow(c_curvDivisions, m_param_maxLevel);
112 const CurvBinsSpec curvBinsSpec(curvBounds[0],
113 curvBounds[1],
114 nCurvBins,
117
118 m_houghTree = std::make_unique<SimpleSegmentPhi0ImpactCurvHoughTree>(m_param_maxLevel);
119 m_houghTree->assignArray<DiscretePhi0>(phi0BinsSpec.constructArray(), phi0BinsSpec.getNOverlap());
120 m_houghTree->assignArray<ContinuousImpact>(impactBounds, impactBinsSpec.getOverlap()); // Continuous
121 m_houghTree->assignArray<DiscreteCurv>(curvBinsSpec.constructArray(), curvBinsSpec.getNOverlap());
122 m_houghTree->initialize();
123}
static const int c_curvDivisions
Fixed parameter: Number of divisions in the curv direction.
static const int c_impactDivisions
Fixed parameter: Number of divisions in the impact direction.
static const int c_phi0Divisions
Fixed parameter: Number of divisions in the phi0 direction.
void initialize() override
Receive and dispatch signal before the start of the event processing.
Type to have values not based on discrete positions from an array.
Strategy to construct discrete curv points from discrete overlap specifications.
Definition: CurvRep.h:23
DiscreteCurv::Array constructArray() const
Constuct the array of discrete curv positions.
Definition: CurvRep.h:40
int getNOverlap() const
Getter for the overlap in discrete number of positions.
Definition: CurvRep.h:68
Strategy to construct discrete impact points from discrete overlap specifications.
Definition: ImpactRep.h:19
double getOverlap() const
Getter for the overlap in real impact to investigate the value that results from the discrete overlap...
Definition: ImpactRep.cc:45
Strategy to construct discrete phi0 points from discrete overlap specifications.
Definition: Phi0Rep.h:20
DiscretePhi0::Array constructArray() const
Constuct the array of discrete phi0 positions.
Definition: Phi0Rep.cc:23
int getNOverlap() const
Getter for the overlap in discrete number of positions.
Definition: Phi0Rep.h:47

◆ terminate()

void terminate ( )
finalvirtual

Cleanup the findlet after event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 195 of file AxialTrackCreatorSegmentHough.cc.

196{
197 m_houghTree->raze();
198 m_houghTree.reset();
200}
void terminate() override
Receive and dispatch Signal for termination of the event processing.

Member Data Documentation

◆ c_curvDivisions

const int c_curvDivisions = 2
staticprivate

Fixed parameter: Number of divisions in the curv direction.

Definition at line 93 of file AxialTrackCreatorSegmentHough.h.

◆ c_impactDivisions

const int c_impactDivisions = 2
staticprivate

Fixed parameter: Number of divisions in the impact direction.

Definition at line 90 of file AxialTrackCreatorSegmentHough.h.

◆ c_phi0Divisions

const int c_phi0Divisions = 2
staticprivate

Fixed parameter: Number of divisions in the phi0 direction.

Definition at line 87 of file AxialTrackCreatorSegmentHough.h.

◆ m_houghTree

std::unique_ptr<SimpleSegmentPhi0ImpactCurvHoughTree> m_houghTree
private

The hough space tree search.

Definition at line 101 of file AxialTrackCreatorSegmentHough.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_curvBounds

std::vector<float> m_param_curvBounds {{ -0.13, 0.13}}
private

Parameter: Curvature bounds of the hough space.

Definition at line 63 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_discreteCurvOverlap

int m_param_discreteCurvOverlap = 1
private

Parameter: Overlap of the curvature bins at the lowest level of the hough space.

Definition at line 84 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_discreteCurvWidth

int m_param_discreteCurvWidth = 2
private

Parameter: Width of the curvature bins at the lowest level of the hough space.

Definition at line 81 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_discreteImpactOverlap

int m_param_discreteImpactOverlap = 1
private

Parameter: Overlap of the impact bins at the lowest level of the hough space.

Definition at line 78 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_discreteImpactWidth

int m_param_discreteImpactWidth = 2
private

Parameter: Width of the impact bins at the lowest level of the hough space.

Definition at line 75 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_discretePhi0Overlap

int m_param_discretePhi0Overlap = 1
private

Parameter: Overlap of the phi0 bins at the lowest level of the hough space.

Definition at line 72 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_discretePhi0Width

int m_param_discretePhi0Width = 2
private

Parameter: Width of the phi0 bins at the lowest level of the hough space.

Definition at line 69 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_impactBounds

std::vector<float> m_param_impactBounds {{ -100, 100}}
private

Parameter: Impact parameter bounds of the hough space.

Definition at line 66 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_maxLevel

int m_param_maxLevel = 12
private

Parameter: Level of divisions in the hough space.

Definition at line 60 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_minFractionNHits

double m_param_minFractionNHits = 0.5
private

Parameter: Minimal number of hits as a fraction of the total hits in the event.

Definition at line 57 of file AxialTrackCreatorSegmentHough.h.

◆ m_param_minNHits

double m_param_minNHits = 40
private

Parameter: Absolute minimal number of hits to make an axial track.

Definition at line 54 of file AxialTrackCreatorSegmentHough.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: