Belle II Software development
CDCTrajectory3D.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/geometry/UncertainHelix.h>
11#include <tracking/trackFindingCDC/geometry/Helix.h>
12#include <tracking/trackFindingCDC/geometry/HelixParameters.h>
13
14#include <tracking/trackFindingCDC/geometry/Vector3D.h>
15#include <tracking/trackFindingCDC/geometry/Vector2D.h>
16
17#include <tracking/trackFindingCDC/numerics/ESign.h>
18
19#include <TMath.h>
20#include <cmath>
21#include <cstddef>
22#include <iosfwd>
23
24namespace genfit {
25 class TrackCand;
26}
27
28namespace Belle2 {
33 class MCParticle;
34
35 namespace TrackFindingCDC {
36 class CDCTrajectory2D;
37 class CDCTrajectorySZ;
38
39 class WireLine;
40
41 class UncertainPerigeeCircle;
42 class UncertainSZLine;
43
46
47 public:
51 , m_localHelix()
52 {
53 }
54
56 explicit CDCTrajectory3D(const UncertainHelix& helix)
57 : m_localOrigin(0.0, 0.0, 0.0)
58 , m_localHelix(helix)
59 , m_flightTime(0.0)
60 {
61 }
62
64 explicit CDCTrajectory3D(const Helix& helix) : CDCTrajectory3D(UncertainHelix(helix))
65 {
66 }
67
69 CDCTrajectory3D(const Vector3D& localOrigin,
70 const UncertainHelix& localHelix,
71 double flightTime = NAN)
72 : m_localOrigin(localOrigin)
73 , m_localHelix(localHelix)
74 , m_flightTime(flightTime)
75 {
76 }
77
80 CDCTrajectory3D(const CDCTrajectory2D& trajectory2D, const CDCTrajectorySZ& trajectorySZ);
81
86 explicit CDCTrajectory3D(const CDCTrajectory2D& trajectory2D);
87
94 CDCTrajectory3D(const Vector3D& pos3D,
95 double time,
96 const Vector3D& mom3D,
97 double charge,
98 double bZ);
99
102 CDCTrajectory3D(const Vector3D& pos3D, double time, const Vector3D& mom3D, double charge);
103
105 CDCTrajectory3D(const MCParticle& mcParticle, double bZ);
106
108 explicit CDCTrajectory3D(const MCParticle& mcParticle);
109
111 CDCTrajectory3D(const genfit::TrackCand& gfTrackCand, double bZ);
112
114 explicit CDCTrajectory3D(const genfit::TrackCand& gfTrackCand);
115
116 public:
118 bool isInvalid() const
119 {
120 return m_localHelix->isInvalid();
121 }
122
124 bool isFitted() const
125 {
126 return not isInvalid();
127 }
128
130 void clear()
131 {
132 m_localOrigin.set(0.0, 0.0, 0.0);
134 m_flightTime = NAN;
135 }
136
137 public:
139 bool fillInto(genfit::TrackCand& trackCand) const;
140
142 bool fillInto(genfit::TrackCand& gfTrackCand, double bZ) const;
143
146
147 public:
149 void reverse()
150 {
153 }
154
157 {
159 }
160
168 Vector3D reconstruct3D(const WireLine& wireLine, double distance = 0.0) const;
169
178 double calcArcLength2D(const Vector3D& point) const
179 {
180 return getLocalHelix()->circleXY().arcLengthTo((point - getLocalOrigin()).xy());
181 }
182
184 double getArcLength2DPeriod() const
185 {
187 }
188
189 public:
195 double shiftPeriod(int nPeriods);
196
197 public:
199 ESign getChargeSign() const;
200
202 double getAbsMom3D(double bZ) const;
203
205 double getAbsMom3D() const;
206
208 Vector3D getMom3DAtSupport(const double bZ) const
209 {
211 }
212
215 {
217 }
218
221 {
222 return getLocalHelix()->tangential();
223 }
224
228 {
229 return getLocalHelix()->perigee() + getLocalOrigin();
230 }
231
234 {
236 }
237
240 {
241 return getLocalHelix()->centerXY() + m_localOrigin.xy();
242 }
243
244 public:
247 bool isCurler(double factor = 1) const;
248
251 {
252 return std::fabs(getGlobalImpact() + 2 * getLocalHelix()->radiusXY());
253 }
254
257 {
258 return std::fabs(getGlobalImpact());
259 }
260
262 double getGlobalImpact() const
263 {
265 }
266
267 public:
270
273
276
279
282
285 {
286 return getLocalHelix().covariance(iRow, iCol);
287 }
288
292 {
293 return getLocalHelix().variance(i);
294 }
295
297 double getTanLambda() const
298 {
299 return getLocalHelix()->tanLambda();
300 }
301
303 double getCurvatureXY() const
304 {
305 return getLocalHelix()->curvatureXY();
306 }
307
309 double getPValue() const
310 {
311 return TMath::Prob(getChi2(), getNDF());
312 }
313
315 double getChi2() const
316 {
317 return getLocalHelix().chi2();
318 }
319
321 void setChi2(const double chi2)
322 {
323 return m_localHelix.setChi2(chi2);
324 }
325
327 size_t getNDF() const
328 {
329 return getLocalHelix().ndf();
330 }
331
333 void setNDF(std::size_t ndf)
334 {
335 return m_localHelix.setNDF(ndf);
336 }
337
340 {
341 return m_localHelix;
342 }
343
345 void setLocalHelix(const UncertainHelix& localHelix)
346 {
347 m_localHelix = localHelix;
348 }
349
352 {
353 return m_localOrigin;
354 }
355
361 double setLocalOrigin(const Vector3D& localOrigin);
362
364 double getFlightTime() const
365 {
366 return m_flightTime;
367 }
368
370 void setFlightTime(double flightTime)
371 {
372 m_flightTime = flightTime;
373 }
374 private:
378
382
384 double m_flightTime = NAN;
385 };
386
388 std::ostream& operator<<(std::ostream& output, const CDCTrajectory3D& trajectory3D);
389 }
391}
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Particle trajectory as it is seen in xy projection represented as a circle.
Particle full three dimensional trajectory.
UncertainPerigeeCircle getLocalCircle() const
Getter for the circle in local coordinates.
Vector3D getMom3DAtSupport(const double bZ) const
Get the momentum at the start point of the trajectory.
double calcArcLength2D(const Vector3D &point) const
Calculate the travel distance from the start position of the trajectory.
Vector3D reconstruct3D(const WireLine &wireLine, double distance=0.0) const
Gives the three dimensional point which is on the dirft circle away from the wire line.
Vector3D m_localOrigin
Memory for local coordinate origin of the circle representing the trajectory in global coordinates.
double getMaximalCylindricalR() const
Getter for the maximal distance from the origin.
double getLocalCovariance(EHelixParameter iRow, EHelixParameter iCol) const
Getter for an individual element of the covariance matrix of the local helix parameters.
bool fillInto(genfit::TrackCand &trackCand) const
Copies the trajectory information to the Genfit track candidate.
double getAbsMom3D() const
Get the estimation for the absolute value of the transvers momentum.
CovarianceMatrix< 6 > getCartesianCovariance(double bZ) const
Convert the helix parameters to the cartesian coordinates x,y,z,px,py,pz.
PerigeeCircle getGlobalCircle() const
Getter for the circle in global coordinates.
bool isInvalid() const
Checks if the trajectory is already set to a valid value.
CDCTrajectory3D reversed() const
Returns the reverse trajectory as a copy.
double getGlobalImpact() const
Getter for the signed impact parameter of the trajectory.
void reverse()
Reverses the trajectory in place.
double getFlightTime() const
Getter for the time when the particle reached the support point position.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
ESign getChargeSign() const
Gets the charge sign of the trajectory.
CDCTrajectory3D(const Helix &helix)
conversion constructor to make that one stupid test work
double getChi2() const
Getter for the chi2 value of the fit.
double getPValue() const
Getter for p-value.
double shiftPeriod(int nPeriods)
Adjusts the z0 to the one that lies n periods forward.
bool isCurler(double factor=1) const
Checks if the trajectory leaves the outer radius of the CDC times the given tolerance factor.
double getLocalVariance(EHelixParameter i) const
Getter for an individual diagonal element of the covariance matrix of the local helix parameters.
bool isFitted() const
Checks if the trajectory has already been set to a valid value.
double getMinimalCylindricalR() const
Getter for the minimal distance from the origin.
UncertainSZLine getLocalSZLine() const
Getter for the sz line starting from the local origin.
double getCurvatureXY() const
Getter for the curvature as seen from the xy projection.
CDCTrajectory3D()
Default constructor for ROOT compatibility.
Vector3D getFlightDirection3DAtSupport() const
Get the unit momentum at the start point of the trajectory.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
const UncertainHelix & getLocalHelix() const
Getter for the helix in local coordinates.
Vector3D getGlobalPerigee() const
Getter for the closest approach on the trajectory to the global origin.
double getTanLambda() const
Getter for the slope of z over the transverse travel distance s.
Vector3D getMom3DAtSupport() const
Get the momentum at the start point of the trajectory.
double getArcLength2DPeriod() const
Getter for the arc length for one round trip around the trajectory.
void setNDF(std::size_t ndf)
Setter for the number of degrees of freedom of the helix fit.
UncertainHelix m_localHelix
Memory for the generalized circle describing the trajectory in coordinates from the local origin.
Vector2D getGlobalCenter() const
Getter for the center of the helix in global coordinates.
CDCTrajectory3D(const Vector3D &localOrigin, const UncertainHelix &localHelix, double flightTime=NAN)
Constructs a trajectory from a local helix taken as relative to the given origin.
double setLocalOrigin(const Vector3D &localOrigin)
Setter for the origin of the local coordinate system.
void clear()
Clears all information from this trajectoy.
void setFlightTime(double flightTime)
Setter for the time when the particle reached the support point position.
void setChi2(const double chi2)
Setter for the chi square value of the helix fit.
CDCTrajectory3D(const UncertainHelix &helix)
Constructs a trajectory from a helix with reference point equivalent to the origin.
size_t getNDF() const
Getter for the number of degrees of freedom of the helix fit.
void setLocalHelix(const UncertainHelix &localHelix)
Setter for the helix that describes the trajectory in local coordinates.
const Vector3D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
double m_flightTime
Memory for the estimation of the time at which the particle arrived at the support point.
Vector3D getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
Linear trajectory in sz space.
Extension of the generalized circle also caching the perigee coordinates.
Definition: Helix.h:28
Vector3D tangential() const
Getter for the unit three dimensional tangential vector at the perigee point of the helix.
Definition: Helix.h:289
bool isInvalid() const
Indicates if the stored parameter combination designates a valid helix.
Definition: Helix.h:74
double distanceXY(const Vector2D &point) const
Calculates the distance of the line parallel to the z axes through the given point.
Definition: Helix.h:138
Vector3D closestXY(const Vector2D &pointXY) const
Calculates the point on the helix with the smallest perpendicular (xy) distance.
Definition: Helix.h:125
double tanLambda() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:240
double curvatureXY() const
Getter for the signed curvature in the xy projection.
Definition: Helix.h:204
double arcLength2DPeriod() const
Getter for the arc length of one trip around the helix.
Definition: Helix.h:265
Vector3D perigee() const
Getter for the perigee point of the helix.
Definition: Helix.h:234
Vector2D centerXY() const
Getter for the central point of the helix.
Definition: Helix.h:283
const PerigeeCircle & circleXY() const
Getter for the projection into xy space.
Definition: Helix.h:320
Extension of the generalized circle also caching the perigee coordinates.
Definition: PerigeeCircle.h:36
double arcLengthTo(const Vector2D &point) const
Calculates the arc length between the perigee and the given point.
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
A general helix class including a covariance matrix.
double variance(const EHelixParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
void reverse()
Flips the orientation of the circle in place.
double covariance(const EHelixParameter &iRow, const EHelixParameter &iCol) const
Getter for individual elements of the covariance matrix.
void invalidate()
Sets all circle parameters to zero and the covariance matrix to something noninformative.
double chi2() const
Getter for the chi square value of the helix fit.
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the helix fit.
void setChi2(const double chi2)
Setter for the chi square value of the helix fit.
std::size_t ndf() const
Getter for the number of degrees of freediom used in the helix fit.
Adds an uncertainty matrix to the circle in perigee parameterisation.
A line in sz where s is the transverse travel distance as seen in the xy projection with uncertaintie...
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
A three dimensional vector.
Definition: Vector3D.h:33
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
void set(const double first, const double second, const double third)
Setter for all three coordinates.
Definition: Vector3D.h:520
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:31
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:27
EHelixParameter
Enumeration to address the individual helix parameters in a vector or matrix.
Abstract base class for different kinds of events.