Belle II Software prerelease-11-00-00e
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#include <tracking/trackingUtilities/geometry/Vector2D.h>
15
16#include <vector>
17
18namespace Belle2 {
23
24 namespace TrackingUtilities {
25 class CDCWireHit;
26 }
27
28 namespace TrackFindingCDC {
29
31 class AxialHitQuadTreeProcessor : public QuadTreeProcessor<long, float, const TrackingUtilities::CDCWireHit> {
32
33 public:
43 static std::vector<float> createCurvBound(YSpan curvSpan, int lastLevel);
44
45 public:
47 AxialHitQuadTreeProcessor(int lastLevel,
48 int seedLevel,
49 const XYSpans& ranges,
50 PrecisionUtil::PrecisionFunction precisionFunction);
51
58 const YSpan& curvSpan,
60
61 protected: // Section of specialized functions
65 bool isLeaf(QuadTree* node) const final;
66
74 XYSpans createChild(QuadTree* node, int i, int j) const final;
75
82 bool isInNode(QuadTree* node, const TrackingUtilities::CDCWireHit* wireHit) const final;
83
94 void insertItemsInNodes(const std::vector<QuadTree*>& nodes,
95 const std::vector<Item*>& items) final;
96
97 protected: // Implementation details
108 bool checkDerivative(QuadTree* node, const TrackingUtilities::CDCWireHit* wireHit) const;
109
116 bool checkExtremum(QuadTree* node, const TrackingUtilities::CDCWireHit* wireHit) const;
117
118 public: // debug stuff
120 void drawHits(std::vector<const TrackingUtilities::CDCWireHit*> hits, unsigned int color = 46) const;
122 void drawNode(QuadTree* node) const;
123
124 private:
131 long xMin = 0;
132
134 long xMax = 0;
135
138
141
143 float rHitMinRight = 0;
144
146 float rHitMaxRight = 0;
147
149 float rHitMinLeft = 0;
150
152 float rHitMaxLeft = 0;
153
155 float rHitMinExtr = 0;
156
158 float rHitMaxExtr = 0;
159
161 bool derivativeOk = false;
162
164 bool hasExtremum = false;
165
167 bool extremumIsBetween = false;
168 };
169
171 struct NodeCache {
173 float yMin = 0;
174
176 float yMax = 0;
177
179 int iThetaSpan = 0;
180
183 };
184
186 std::vector<ThetaSpanCache> m_thetaSpanCaches;
187
189 std::vector<NodeCache> m_nodeCaches;
190
191 private:
194
197
200
202 const double c_curlCurv = 0.02;
203
209 };
210 }
212}
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.
const double c_curlCurv
The curvature above which the trajectory is considered a curler.
bool m_twoSidedPhaseSpace
Indicator whether the two sided phases space insertion check should be used This option should automa...
void drawHits(std::vector< const TrackingUtilities::CDCWireHit * > hits, unsigned int color=46) const
Draw QuadTree node.
TrackingUtilities::Vector2D m_localOrigin
Local origin on which the phase space coordinates are centered.
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
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.
static const TrackingUtilities::LookupTable< TrackingUtilities::Vector2D > & getCosSinLookupTable()
Get the standard lookup table containing equally spaces unit vectors (cos, sin)
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 std::vector< float > createCurvBound(YSpan curvSpan, int lastLevel)
Constructs an array with the curvature bounds as generated by the default bin divisions.
const TrackingUtilities::LookupTable< TrackingUtilities::Vector2D > * m_cosSinLookupTable
Pinned lookup table for precomputed cosine and sine values.
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:58
Class which holds precomputed values of a function.
Definition LookupTable.h:50
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition Vector2D.h:36
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.
const TrackingUtilities::Vector2D * thetaVecMax
Unit vector (cos, sin) at the upper theta bound.
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.
long xMax
Upper theta bound of the nodes in this group as an index into the lookup table.
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.
const TrackingUtilities::Vector2D * thetaVecMin
Unit vector (cos, sin) at the lower theta bound.
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.