Belle II Software development
AxialHitQuadTreeProcessor.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/legendre/quadtree/QuadTreeProcessor.h>
11#include <tracking/trackFindingCDC/legendre/precisionFunctions/PrecisionUtil.h>
12
13#include <tracking/trackingUtilities/numerics/LookupTable.h>
14
15#include <Math/Vector2D.h>
16
17#include <vector>
18
19namespace Belle2 {
24
25 namespace TrackingUtilities {
26 class CDCWireHit;
27 }
28
29 namespace TrackFindingCDC {
30
32 class AxialHitQuadTreeProcessor : public QuadTreeProcessor<long, float, const TrackingUtilities::CDCWireHit> {
33
34 public:
44 static std::vector<float> createCurvBound(YSpan curvSpan, int lastLevel);
45
46 public:
48 AxialHitQuadTreeProcessor(int lastLevel,
49 int seedLevel,
50 const XYSpans& ranges,
51 PrecisionUtil::PrecisionFunction precisionFunction);
52
58 AxialHitQuadTreeProcessor(const ROOT::Math::XYVector& localOrigin,
59 const YSpan& curvSpan,
61
62 protected: // Section of specialized functions
66 bool isLeaf(QuadTree* node) const final;
67
75 XYSpans createChild(QuadTree* node, int i, int j) const final;
76
83 bool isInNode(QuadTree* node, const TrackingUtilities::CDCWireHit* wireHit) const final;
84
95 void insertItemsInNodes(const std::vector<QuadTree*>& nodes,
96 const std::vector<Item*>& items) final;
97
98 protected: // Implementation details
109 bool checkDerivative(QuadTree* node, const TrackingUtilities::CDCWireHit* wireHit) const;
110
117 bool checkExtremum(QuadTree* node, const TrackingUtilities::CDCWireHit* wireHit) const;
118
119 public: // debug stuff
121 void drawHits(const std::vector<const TrackingUtilities::CDCWireHit*>& hits, unsigned int color = 46) const;
123 void drawNode(QuadTree* node) const;
124
125 private:
132 long xMin = 0;
133
135 long xMax = 0;
136
138 const ROOT::Math::XYVector* thetaVecMin = nullptr;
139
141 const ROOT::Math::XYVector* thetaVecMax = nullptr;
142
144 float rHitMinRight = 0;
145
147 float rHitMaxRight = 0;
148
150 float rHitMinLeft = 0;
151
153 float rHitMaxLeft = 0;
154
156 float rHitMinExtr = 0;
157
159 float rHitMaxExtr = 0;
160
162 bool derivativeOk = false;
163
165 bool hasExtremum = false;
166
168 bool extremumIsBetween = false;
169 };
170
172 struct NodeCache {
174 float yMin = 0;
175
177 float yMax = 0;
178
180 int iThetaSpan = 0;
181
184 };
185
187 std::vector<ThetaSpanCache> m_thetaSpanCaches;
188
190 std::vector<NodeCache> m_nodeCaches;
191
192 private:
195
197 ROOT::Math::XYVector m_localOrigin;
198
201
203 const double c_curlCurv = 0.02;
204
210 };
211 }
213}
void insertItemsInNodes(const std::vector< QuadTree * > &nodes, const std::vector< Item * > &items) final
Insert the hits into the given nodes sharing the parts of the containment check that do not depend on...
std::vector< ThetaSpanCache > m_thetaSpanCaches
Reusable buffer with the per theta span quantities - one entry per distinct theta span.
XYSpans createChild(QuadTree *node, int i, int j) const final
Return the new ranges.
ROOT::Math::XYVector m_localOrigin
Local origin on which the phase space coordinates are centered.
const double c_curlCurv
The curvature above which the trajectory is considered a curler.
const TrackingUtilities::LookupTable< ROOT::Math::XYVector > * m_cosSinLookupTable
Pinned lookup table for precomputed cosine and sine values.
bool m_twoSidedPhaseSpace
Indicator whether the two sided phases space insertion check should be used This option should automa...
bool checkDerivative(QuadTree *node, const TrackingUtilities::CDCWireHit *wireHit) const
Check derivative of the Legendre curve.
bool isLeaf(QuadTree *node) const final
lastLevel depends on curvature of the track candidate
void drawHits(const std::vector< const TrackingUtilities::CDCWireHit * > &hits, unsigned int color=46) const
Draw QuadTree node.
bool isInNode(QuadTree *node, const TrackingUtilities::CDCWireHit *wireHit) const final
Check whether hit belongs to the quadtree node:
bool checkExtremum(QuadTree *node, const TrackingUtilities::CDCWireHit *wireHit) const
Checks whether extreme point is located within QuadTree node's ranges.
AxialHitQuadTreeProcessor(int lastLevel, int seedLevel, const XYSpans &ranges, PrecisionUtil::PrecisionFunction precisionFunction)
Constructor.
PrecisionUtil::PrecisionFunction m_precisionFunction
Lambda which holds resolution function for the quadtree.
std::vector< NodeCache > m_nodeCaches
Reusable buffer with the per node quantities - one entry per node.
void drawNode(QuadTree *node) const
Draw QuadTree node.
static const TrackingUtilities::LookupTable< ROOT::Math::XYVector > & getCosSinLookupTable()
Get the standard lookup table containing equally spaces unit vectors (cos, sin)
static std::vector< float > createCurvBound(YSpan curvSpan, int lastLevel)
Constructs an array with the curvature bounds as generated by the default bin divisions.
std::function< double(double)> PrecisionFunction
Function type which is used for resolution calculations (resolution=f(curvature)) Takes a curvature v...
QuadTreeProcessor(int lastLevel, int seedLevel, const XYSpans &xySpans, bool debugOutput=false)
Class representing a hit wire in the central drift chamber.
Definition CDCWireHit.h:56
Class which holds precomputed values of a function.
Definition LookupTable.h:50
Abstract base class for different kinds of events.
Geometry of a node that is needed in the containment check.
int iThetaSpan
Index of the theta span of the node in the theta span cache.
bool needsDerivativeCheck
Indicator that the forward direction of the hit has to be checked for this node.
Quantities entering the node containment check that only depend on the hit and on the theta span of a...
bool extremumIsBetween
Indicator that the extremum is a candidate for the containment check.
float rHitMaxRight
Legendre curve of the right passage hypothesis at the upper theta bound.
long xMin
Lower theta bound of the nodes in this group as an index into the lookup table.
float rHitMaxExtr
Derivative of the Legendre curve at the upper theta bound.
float rHitMinExtr
Derivative of the Legendre curve at the lower theta bound.
bool hasExtremum
Indicator that the extremum of the Legendre curve lies within this theta span.
const ROOT::Math::XYVector * thetaVecMin
Unit vector (cos, sin) at the lower theta bound.
long xMax
Upper theta bound of the nodes in this group as an index into the lookup table.
const ROOT::Math::XYVector * thetaVecMax
Unit vector (cos, sin) at the upper theta bound.
float rHitMinRight
Legendre curve of the right passage hypothesis at the lower theta bound.
bool derivativeOk
Result of the derivative check for this theta span.
float rHitMaxLeft
Legendre curve of the left passage hypothesis at the upper theta bound.
float rHitMinLeft
Legendre curve of the left passage hypothesis at the lower theta bound.