Belle II Software  release-05-02-19
CDCTrajectory3D.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/geometry/UncertainHelix.h>
13 #include <tracking/trackFindingCDC/geometry/Helix.h>
14 #include <tracking/trackFindingCDC/geometry/HelixParameters.h>
15 
16 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
17 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
18 
19 #include <tracking/trackFindingCDC/numerics/ESign.h>
20 
21 #include <TMath.h>
22 #include <cmath>
23 #include <cstddef>
24 #include <iosfwd>
25 
26 namespace genfit {
27  class TrackCand;
28 }
29 
30 namespace Belle2 {
35  class MCParticle;
36 
37  namespace TrackFindingCDC {
38  class CDCTrajectory2D;
39  class CDCTrajectorySZ;
40 
41  class WireLine;
42 
43  class UncertainPerigeeCircle;
44  class UncertainSZLine;
45 
48 
49  public:
52  : m_localOrigin()
53  , m_localHelix()
54  {
55  }
56 
58  explicit CDCTrajectory3D(const UncertainHelix& helix)
59  : m_localOrigin(0.0, 0.0, 0.0)
60  , m_localHelix(helix)
61  , m_flightTime(0.0)
62  {
63  }
64 
66  explicit CDCTrajectory3D(const Helix& helix) : CDCTrajectory3D(UncertainHelix(helix))
67  {
68  }
69 
71  CDCTrajectory3D(const Vector3D& localOrigin,
72  const UncertainHelix& localHelix,
73  double flightTime = NAN)
74  : m_localOrigin(localOrigin)
75  , m_localHelix(localHelix)
76  , m_flightTime(flightTime)
77  {
78  }
79 
82  CDCTrajectory3D(const CDCTrajectory2D& trajectory2D, const CDCTrajectorySZ& trajectorySZ);
83 
88  explicit CDCTrajectory3D(const CDCTrajectory2D& trajectory2D);
89 
96  CDCTrajectory3D(const Vector3D& pos3D,
97  double time,
98  const Vector3D& mom3D,
99  double charge,
100  double bZ);
101 
104  CDCTrajectory3D(const Vector3D& pos3D, double time, const Vector3D& mom3D, double charge);
105 
107  CDCTrajectory3D(const MCParticle& mcParticle, double bZ);
108 
110  explicit CDCTrajectory3D(const MCParticle& mcParticle);
111 
113  CDCTrajectory3D(const genfit::TrackCand& gfTrackCand, double bZ);
114 
116  explicit CDCTrajectory3D(const genfit::TrackCand& gfTrackCand);
117 
118  public:
120  bool isInvalid() const
121  {
122  return m_localHelix->isInvalid();
123  }
124 
126  bool isFitted() const
127  {
128  return not isInvalid();
129  }
130 
132  void clear()
133  {
134  m_localOrigin.set(0.0, 0.0, 0.0);
136  m_flightTime = NAN;
137  }
138 
139  public:
141  bool fillInto(genfit::TrackCand& trackCand) const;
142 
144  bool fillInto(genfit::TrackCand& gfTrackCand, double bZ) const;
145 
148 
149  public:
151  void reverse()
152  {
155  }
156 
159  {
161  }
162 
170  Vector3D reconstruct3D(const WireLine& wireLine, double distance = 0.0) const;
171 
180  double calcArcLength2D(const Vector3D& point) const
181  {
182  return getLocalHelix()->circleXY().arcLengthTo((point - getLocalOrigin()).xy());
183  }
184 
186  double getArcLength2DPeriod() const
187  {
188  return getLocalHelix()->arcLength2DPeriod();
189  }
190 
191  public:
197  double shiftPeriod(int nPeriods);
198 
199  public:
201  ESign getChargeSign() const;
202 
204  double getAbsMom3D(double bZ) const;
205 
207  double getAbsMom3D() const;
208 
210  Vector3D getMom3DAtSupport(const double bZ) const
211  {
213  }
214 
217  {
219  }
220 
223  {
224  return getLocalHelix()->tangential();
225  }
226 
230  {
231  return getLocalHelix()->perigee() + getLocalOrigin();
232  }
233 
236  {
238  }
239 
242  {
243  return getLocalHelix()->centerXY() + m_localOrigin.xy();
244  }
245 
246  public:
249  bool isCurler(double factor = 1) const;
250 
252  double getMaximalCylindricalR() const
253  {
254  return std::fabs(getGlobalImpact() + 2 * getLocalHelix()->radiusXY());
255  }
256 
258  double getMinimalCylindricalR() const
259  {
260  return std::fabs(getGlobalImpact());
261  }
262 
264  double getGlobalImpact() const
265  {
267  }
268 
269  public:
272 
275 
278 
281 
284 
287  {
288  return getLocalHelix().covariance(iRow, iCol);
289  }
290 
294  {
295  return getLocalHelix().variance(i);
296  }
297 
299  double getTanLambda() const
300  {
301  return getLocalHelix()->tanLambda();
302  }
303 
305  double getCurvatureXY() const
306  {
307  return getLocalHelix()->curvatureXY();
308  }
309 
311  double getPValue() const
312  {
313  return TMath::Prob(getChi2(), getNDF());
314  }
315 
317  double getChi2() const
318  {
319  return getLocalHelix().chi2();
320  }
321 
323  void setChi2(const double chi2)
324  {
325  return m_localHelix.setChi2(chi2);
326  }
327 
329  size_t getNDF() const
330  {
331  return getLocalHelix().ndf();
332  }
333 
335  void setNDF(std::size_t ndf)
336  {
337  return m_localHelix.setNDF(ndf);
338  }
339 
342  {
343  return m_localHelix;
344  }
345 
347  void setLocalHelix(const UncertainHelix& localHelix)
348  {
349  m_localHelix = localHelix;
350  }
351 
353  const Vector3D& getLocalOrigin() const
354  {
355  return m_localOrigin;
356  }
357 
363  double setLocalOrigin(const Vector3D& localOrigin);
364 
366  double getFlightTime() const
367  {
368  return m_flightTime;
369  }
370 
372  void setFlightTime(double flightTime)
373  {
374  m_flightTime = flightTime;
375  }
376  private:
380 
384 
386  double m_flightTime = NAN;
387  };
388 
390  std::ostream& operator<<(std::ostream& output, const CDCTrajectory3D& trajectory3D);
391  }
393 }
Belle2::TrackFindingCDC::CDCTrajectory3D::getTanLambda
double getTanLambda() const
Getter for the slope of z over the transverse travel distance s.
Definition: CDCTrajectory3D.h:299
Belle2::TrackFindingCDC::Helix::perigee
Vector3D perigee() const
Getter for the perigee point of the helix.
Definition: Helix.h:244
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::CDCTrajectory3D::CDCTrajectory3D
CDCTrajectory3D(const Vector3D &localOrigin, const UncertainHelix &localHelix, double flightTime=NAN)
Constructs a trajectory from a local helix taken as relative to the given origin.
Definition: CDCTrajectory3D.h:71
Belle2::TrackFindingCDC::Helix::isInvalid
bool isInvalid() const
Indicates if the stored parameter combination designates a valid helix.
Definition: Helix.h:84
Belle2::TrackFindingCDC::UncertainHelix::chi2
double chi2() const
Getter for the chi square value of the helix fit.
Definition: UncertainHelix.h:273
Belle2::TrackFindingCDC::CDCTrajectory3D::CDCTrajectory3D
CDCTrajectory3D()
Default constructor for ROOT compatibility.
Definition: CDCTrajectory3D.h:51
Belle2::TrackFindingCDC::Helix::curvatureXY
double curvatureXY() const
Getter for the signed curvature in the xy projection.
Definition: Helix.h:214
Belle2::TrackFindingCDC::CDCTrajectory3D::m_flightTime
double m_flightTime
Memory for the estimation of the time at which the particle arrived at the support point.
Definition: CDCTrajectory3D.h:386
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
genfit::TrackCand
Track candidate – seed values and indices.
Definition: TrackCand.h:69
Belle2::TrackFindingCDC::CDCTrajectory3D::getCurvatureXY
double getCurvatureXY() const
Getter for the curvature as seen from the xy projection.
Definition: CDCTrajectory3D.h:305
Belle2::TrackFindingCDC::Helix::centerXY
Vector2D centerXY() const
Getter for the central point of the helix.
Definition: Helix.h:293
Belle2::TrackFindingCDC::UncertainSZLine
A line in sz where s is the transverse travel distance as seen in the xy projection with uncertaintie...
Definition: UncertainSZLine.h:38
Belle2::TrackFindingCDC::PerigeeCircle::arcLengthTo
double arcLengthTo(const Vector2D &point) const
Calculates the arc length between the perigee and the given point.
Definition: PerigeeCircle.cc:238
Belle2::TrackFindingCDC::UncertainHelix::setChi2
void setChi2(const double chi2)
Setter for the chi square value of the helix fit.
Definition: UncertainHelix.h:279
Belle2::TrackFindingCDC::UncertainHelix::reverse
void reverse()
Flips the orientation of the circle in place.
Definition: UncertainHelix.h:307
Belle2::TrackFindingCDC::UncertainHelix::ndf
std::size_t ndf() const
Getter for the number of degrees of freediom used in the helix fit.
Definition: UncertainHelix.h:285
Belle2::TrackFindingCDC::CDCTrajectory3D::isFitted
bool isFitted() const
Checks if the trajectory has already been set to a valid value.
Definition: CDCTrajectory3D.h:126
Belle2::TrackFindingCDC::CDCTrajectory3D::getLocalSZLine
UncertainSZLine getLocalSZLine() const
Getter for the sz line starting from the local origin.
Definition: CDCTrajectory3D.cc:364
Belle2::TrackFindingCDC::CDCTrajectory3D::m_localOrigin
Vector3D m_localOrigin
Memory for local coordinate origin of the circle representing the trajectory in global coordinates.
Definition: CDCTrajectory3D.h:379
Belle2::TrackFindingCDC::CDCTrajectory3D::setLocalOrigin
double setLocalOrigin(const Vector3D &localOrigin)
Setter for the origin of the local coordinate system.
Definition: CDCTrajectory3D.cc:369
Belle2::TrackFindingCDC::Helix
Extension of the generalized circle also caching the perigee coordinates.
Definition: Helix.h:38
genfit
Defines for I/O streams used for error and debug printing.
Definition: AlignablePXDRecoHit.h:19
Belle2::TrackFindingCDC::CDCTrajectory3D::setLocalHelix
void setLocalHelix(const UncertainHelix &localHelix)
Setter for the helix that describes the trajectory in local coordinates.
Definition: CDCTrajectory3D.h:347
Belle2::TrackFindingCDC::Helix::tanLambda
double tanLambda() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:250
Belle2::TrackFindingCDC::ESignUtil::ESign
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:37
Belle2::TrackFindingCDC::CDCTrajectory3D::getMom3DAtSupport
Vector3D getMom3DAtSupport(const double bZ) const
Get the momentum at the start point of the trajectory.
Definition: CDCTrajectory3D.h:210
Belle2::TrackFindingCDC::CDCTrajectorySZ
Linear trajectory in sz space.
Definition: CDCTrajectorySZ.h:41
Belle2::TrackFindingCDC::CDCTrajectory3D::shiftPeriod
double shiftPeriod(int nPeriods)
Adjusts the z0 to the one that lies n periods forward.
Definition: CDCTrajectory3D.cc:329
Belle2::TrackFindingCDC::CDCTrajectory3D::m_localHelix
UncertainHelix m_localHelix
Memory for the generalized circle describing the trajectory in coordinates from the local origin.
Definition: CDCTrajectory3D.h:383
Belle2::TrackFindingCDC::CDCTrajectory3D::reversed
CDCTrajectory3D reversed() const
Returns the reverse trajectory as a copy.
Definition: CDCTrajectory3D.h:158
Belle2::TrackFindingCDC::Helix::arcLength2DPeriod
double arcLength2DPeriod() const
Getter for the arc length of one trip around the helix.
Definition: Helix.h:275
Belle2::TrackFindingCDC::CDCTrajectory3D::getLocalCovariance
double getLocalCovariance(EHelixParameter iRow, EHelixParameter iCol) const
Getter for an individual element of the covariance matrix of the local helix parameters.
Definition: CDCTrajectory3D.h:286
Belle2::TrackFindingCDC::CDCTrajectory3D::reconstruct3D
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.
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::CDCTrajectory3D::getGlobalCenter
Vector2D getGlobalCenter() const
Getter for the center of the helix in global coordinates.
Definition: CDCTrajectory3D.h:241
Belle2::TrackFindingCDC::CDCTrajectory3D::getLocalVariance
double getLocalVariance(EHelixParameter i) const
Getter for an individual diagonal element of the covariance matrix of the local helix parameters.
Definition: CDCTrajectory3D.h:293
Belle2::TrackFindingCDC::CDCTrajectory3D::fillInto
bool fillInto(genfit::TrackCand &trackCand) const
Copies the trajectory information to the Genfit track candidate.
Definition: CDCTrajectory3D.cc:263
Belle2::TrackFindingCDC::CDCTrajectory3D::calcArcLength2D
double calcArcLength2D(const Vector3D &point) const
Calculate the travel distance from the start position of the trajectory.
Definition: CDCTrajectory3D.h:180
Belle2::TrackFindingCDC::CDCTrajectory3D::getTrajectory2D
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
Definition: CDCTrajectory3D.cc:336
Belle2::TrackFindingCDC::CDCTrajectory3D::getPValue
double getPValue() const
Getter for p-value.
Definition: CDCTrajectory3D.h:311
Belle2::TrackFindingCDC::CDCTrajectory3D::clear
void clear()
Clears all information from this trajectoy.
Definition: CDCTrajectory3D.h:132
Belle2::TrackFindingCDC::UncertainPerigeeCircle
Adds an uncertainty matrix to the circle in perigee parameterisation.
Definition: UncertainPerigeeCircle.h:39
Belle2::TrackFindingCDC::CDCTrajectory3D::getAbsMom3D
double getAbsMom3D() const
Get the estimation for the absolute value of the transvers momentum.
Definition: CDCTrajectory3D.cc:319
Belle2::TrackFindingCDC::CDCTrajectory3D::getTrajectorySZ
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
Definition: CDCTrajectory3D.cc:343
Belle2::TrackFindingCDC::UncertainHelix::covariance
double covariance(const EHelixParameter &iRow, const EHelixParameter &iCol) const
Getter for individual elements of the covariance matrix.
Definition: UncertainHelix.h:261
Belle2::TrackFindingCDC::CDCTrajectory3D::getMom3DAtSupport
Vector3D getMom3DAtSupport() const
Get the momentum at the start point of the trajectory.
Definition: CDCTrajectory3D.h:216
Belle2::TrackFindingCDC::CDCTrajectory3D::getMaximalCylindricalR
double getMaximalCylindricalR() const
Getter for the maximal distance from the origin.
Definition: CDCTrajectory3D.h:252
Belle2::TrackFindingCDC::CDCTrajectory3D::getCartesianCovariance
CovarianceMatrix< 6 > getCartesianCovariance(double bZ) const
Convert the helix parameters to the cartesian coordinates x,y,z,px,py,pz.
Definition: CDCTrajectory3D.cc:291
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::WireLine
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:41
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::Helix::distanceXY
double distanceXY(const Vector2D &point) const
Calculates the distance of the line parallel to the z axes through the given point.
Definition: Helix.h:148
Belle2::TrackFindingCDC::UncertainHelix::invalidate
void invalidate()
Sets all circle parameters to zero and the covariance matrix to something noninformative.
Definition: UncertainHelix.h:297
Belle2::TrackFindingCDC::PerigeeCircle
Extension of the generalized circle also caching the perigee coordinates.
Definition: PerigeeCircle.h:46
Belle2::TrackFindingCDC::UncertainHelix::variance
double variance(const EHelixParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
Definition: UncertainHelix.h:267
Belle2::TrackFindingCDC::CDCTrajectory3D::getGlobalCircle
PerigeeCircle getGlobalCircle() const
Getter for the circle in global coordinates.
Definition: CDCTrajectory3D.cc:351
Belle2::TrackFindingCDC::Helix::circleXY
const PerigeeCircle & circleXY() const
Getter for the projection into xy space.
Definition: Helix.h:330
Belle2::TrackFindingCDC::CDCTrajectory3D::getLocalOrigin
const Vector3D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
Definition: CDCTrajectory3D.h:353
Belle2::TrackFindingCDC::CDCTrajectory3D::getNDF
size_t getNDF() const
Getter for the number of degrees of freedom of the helix fit.
Definition: CDCTrajectory3D.h:329
Belle2::TrackFindingCDC::CDCTrajectory3D::isCurler
bool isCurler(double factor=1) const
Checks if the trajectory leaves the outer radius of the CDC times the given tolerance factor.
Definition: CDCTrajectory3D.cc:299
Belle2::TrackFindingCDC::CDCTrajectory3D::setFlightTime
void setFlightTime(double flightTime)
Setter for the time when the particle reached the support point position.
Definition: CDCTrajectory3D.h:372
Belle2::TrackFindingCDC::Vector3D::xy
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:500
Belle2::TrackFindingCDC::CDCTrajectory3D::getSupport
Vector3D getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
Definition: CDCTrajectory3D.h:229
Belle2::TrackFindingCDC::UncertainHelix::setNDF
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the helix fit.
Definition: UncertainHelix.h:291
Belle2::TrackFindingCDC::CDCTrajectory3D::setChi2
void setChi2(const double chi2)
Setter for the chi square value of the helix fit.
Definition: CDCTrajectory3D.h:323
Belle2::TrackFindingCDC::CDCTrajectory3D::getFlightDirection3DAtSupport
Vector3D getFlightDirection3DAtSupport() const
Get the unit momentum at the start point of the trajectory.
Definition: CDCTrajectory3D.h:222
Belle2::TrackFindingCDC::Helix::tangential
Vector3D tangential() const
Getter for the unit three dimensional tangential vector at the perigee point of the helix.
Definition: Helix.h:299
Belle2::TrackFindingCDC::CDCTrajectory3D::CDCTrajectory3D
CDCTrajectory3D(const Helix &helix)
conversion constructor to make that one stupid test work
Definition: CDCTrajectory3D.h:66
Belle2::TrackFindingCDC::CDCTrajectory3D::getGlobalImpact
double getGlobalImpact() const
Getter for the signed impact parameter of the trajectory.
Definition: CDCTrajectory3D.h:264
Belle2::TrackFindingCDC::CDCTrajectory3D::getChargeSign
ESign getChargeSign() const
Gets the charge sign of the trajectory.
Definition: CDCTrajectory3D.cc:305
Belle2::TrackFindingCDC::CDCTrajectory3D::setNDF
void setNDF(std::size_t ndf)
Setter for the number of degrees of freedom of the helix fit.
Definition: CDCTrajectory3D.h:335
Belle2::TrackFindingCDC::CDCTrajectory3D::getLocalCircle
UncertainPerigeeCircle getLocalCircle() const
Getter for the circle in local coordinates.
Definition: CDCTrajectory3D.cc:359
Belle2::TrackFindingCDC::CDCTrajectory3D::getChi2
double getChi2() const
Getter for the chi2 value of the fit.
Definition: CDCTrajectory3D.h:317
Belle2::TrackFindingCDC::PlainMatrix
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:50
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::TrackFindingCDC::Vector3D::set
void set(const double first, const double second, const double third)
Setter for all three coordinates.
Definition: Vector3D.h:512
Belle2::TrackFindingCDC::CDCTrajectory3D::reverse
void reverse()
Reverses the trajectory in place.
Definition: CDCTrajectory3D.h:151
Belle2::TrackFindingCDC::CDCTrajectory3D::getGlobalPerigee
Vector3D getGlobalPerigee() const
Getter for the closest approach on the trajectory to the global origin.
Definition: CDCTrajectory3D.h:235
Belle2::TrackFindingCDC::UncertainHelix
A general helix class including a covariance matrix.
Definition: UncertainHelix.h:44
Belle2::TrackFindingCDC::CDCTrajectory3D::isInvalid
bool isInvalid() const
Checks if the trajectory is already set to a valid value.
Definition: CDCTrajectory3D.h:120
Belle2::TrackFindingCDC::CDCTrajectory3D::getFlightTime
double getFlightTime() const
Getter for the time when the particle reached the support point position.
Definition: CDCTrajectory3D.h:366
Belle2::TrackFindingCDC::CDCTrajectory3D::CDCTrajectory3D
CDCTrajectory3D(const UncertainHelix &helix)
Constructs a trajectory from a helix with reference point equivalent to the origin.
Definition: CDCTrajectory3D.h:58
Belle2::TrackFindingCDC::CDCTrajectory3D::getArcLength2DPeriod
double getArcLength2DPeriod() const
Getter for the arc length for one round trip around the trajectory.
Definition: CDCTrajectory3D.h:186
Belle2::TrackFindingCDC::CDCTrajectory3D::getLocalHelix
const UncertainHelix & getLocalHelix() const
Getter for the helix in local coordinates.
Definition: CDCTrajectory3D.h:341
Belle2::TrackFindingCDC::NHelixParameterIndices::EHelixParameter
EHelixParameter
Enumeration to address the individual helix parameters in a vector or matrix.
Definition: HelixParameters.h:37
Belle2::TrackFindingCDC::CDCTrajectory3D
Particle full three dimensional trajectory.
Definition: CDCTrajectory3D.h:47
Belle2::TrackFindingCDC::CDCTrajectory3D::getMinimalCylindricalR
double getMinimalCylindricalR() const
Getter for the minimal distance from the origin.
Definition: CDCTrajectory3D.h:258
Belle2::TrackFindingCDC::Helix::closestXY
Vector3D closestXY(const Vector2D &pointXY) const
Calculates the point on the helix with the smallest perpendicular (xy) distance.
Definition: Helix.h:135