 |
Belle II Software
release-05-01-25
|
10 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
12 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
13 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
15 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCBFieldUtil.h>
17 #include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
19 #include <tracking/trackFindingCDC/geometry/UncertainHelix.h>
20 #include <tracking/trackFindingCDC/geometry/Helix.h>
21 #include <tracking/trackFindingCDC/geometry/HelixParameters.h>
22 #include <tracking/trackFindingCDC/geometry/UncertainPerigeeCircle.h>
23 #include <tracking/trackFindingCDC/geometry/UncertainSZLine.h>
24 #include <tracking/trackFindingCDC/geometry/PerigeeCircle.h>
26 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
27 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
29 #include <tracking/trackFindingCDC/numerics/ESign.h>
30 #include <tracking/trackFindingCDC/numerics/Quadratic.h>
32 #include <tracking/trackFindingCDC/numerics/CovarianceMatrixUtil.h>
33 #include <tracking/trackFindingCDC/numerics/JacobianMatrixUtil.h>
34 #include <tracking/trackFindingCDC/numerics/TMatrixConversion.h>
36 #include <genfit/TrackCand.h>
38 #include <mdst/dataobjects/MCParticle.h>
40 #include <framework/gearbox/Const.h>
42 #include <TMatrixDSym.h>
48 using namespace TrackFindingCDC;
52 : m_localOrigin(trajectory2D.getLocalOrigin())
53 , m_localHelix(trajectory2D.getLocalCircle(), trajectorySZ.getSZLine())
54 , m_flightTime(trajectory2D.getFlightTime())
68 : m_localOrigin(pos3D)
69 , m_localHelix(
CDCBFieldUtil::absMom2DToCurvature(mom3D.xy().norm(), charge, bZ),
82 : CDCTrajectory3D(pos3D, time, mom3D, charge, CDCBFieldUtil::getBFieldZ(pos3D))
107 gfTrackCand.getChargeSeed(),
119 const TMatrixDSym& seedCov = gfTrackCand.
getCovSeed();
120 CovarianceMatrix<6> cov6 = TMatrixConversion::fromTMatrix<6>(seedCov);
123 JacobianMatrix<6, 6> jacobianRot = JacobianMatrixUtil::zero<6, 6>();
127 const double pt = hypot2(px, py);
129 const double cosPhi0 = px / pt;
130 const double sinPhi0 = py / pt;
133 jacobianRot(iX, iX) = cosPhi0;
134 jacobianRot(iX, iY) = sinPhi0;
135 jacobianRot(iY, iX) = -sinPhi0;
136 jacobianRot(iY, iY) = cosPhi0;
137 jacobianRot(iZ, iZ) = 1.0;
139 jacobianRot(iPx, iPx) = cosPhi0;
140 jacobianRot(iPx, iPy) = sinPhi0;
141 jacobianRot(iPy, iPx) = -sinPhi0;
142 jacobianRot(iPy, iPy) = cosPhi0;
143 jacobianRot(iPz, iPz) = 1.0;
149 JacobianMatrix<5, 6> jacobianReduce = JacobianMatrixUtil::zero<5, 6>();
151 const double invPt = 1 / pt;
152 const double invPtSquared = invPt * invPt;
155 const double charge = gfTrackCand.getChargeSeed();
157 using namespace NHelixParameterIndices;
158 jacobianReduce(
c_Curv, iPx) =
charge * invPtSquared / alpha ;
159 jacobianReduce(
c_Phi0, iPy) = invPt;
160 jacobianReduce(
c_I, iY) = 1;
161 jacobianReduce(
c_TanL, iPx) = - pz * invPtSquared;
162 jacobianReduce(
c_TanL, iPz) = invPt;
163 jacobianReduce(
c_Z0, iZ) = 1;
167 const HelixCovariance& helixCovariance = cov5;
170 m_localHelix.setHelixCovariance(helixCovariance);
179 CovarianceMatrix<6> calculateCovarianceMatrix(
const UncertainHelix& localHelix,
184 const double impactXY = localHelix->impactXY();
185 const Vector2D& phi0Vec = localHelix->phi0Vec();
187 const double cosPhi0 = phi0Vec.
x();
188 const double sinPhi0 = phi0Vec.y();
190 const double curvatureXY = localHelix->curvatureXY();
191 const double tanLambda = localHelix->tanLambda();
203 CovarianceMatrix<5> cov5 = localHelix.helixCovariance();
207 JacobianMatrix<6, 5> jacobianInflate = JacobianMatrixUtil::zero<6, 5>();
210 const double chargeAlphaCurv = charge * alpha * curvatureXY;
211 const double chargeAlphaCurv2 = charge * alpha * std::pow(curvatureXY, 2);
213 const double invChargeAlphaCurv = 1.0 / chargeAlphaCurv;
214 const double invChargeAlphaCurv2 = 1.0 / chargeAlphaCurv2;
216 using namespace NHelixParameterIndices;
218 jacobianInflate(iX,
c_Phi0) = -impactXY;
219 jacobianInflate(iY,
c_I) = 1.0;
220 jacobianInflate(iZ,
c_Z0) = 1.0;
224 jacobianInflate(iPx,
c_Curv) = 0;
225 jacobianInflate(iPy,
c_Phi0) = momentum.cylindricalR();
226 jacobianInflate(iPz,
c_Curv) = 0;
227 jacobianInflate(iPz,
c_TanL) = momentum.cylindricalR();
229 jacobianInflate(iPx,
c_Curv) = invChargeAlphaCurv2;
230 jacobianInflate(iPy,
c_Phi0) = - invChargeAlphaCurv;
231 jacobianInflate(iPz,
c_Curv) = tanLambda * invChargeAlphaCurv2;
232 jacobianInflate(iPz,
c_TanL) = - invChargeAlphaCurv;
239 JacobianMatrix<6, 6> jacobianRot = JacobianMatrixUtil::zero<6, 6>();
242 jacobianRot(iX, iX) = cosPhi0;
243 jacobianRot(iX, iY) = -sinPhi0;
244 jacobianRot(iY, iX) = sinPhi0;
245 jacobianRot(iY, iY) = cosPhi0;
246 jacobianRot(iZ, iZ) = 1.0;
248 jacobianRot(iPx, iPx) = cosPhi0;
249 jacobianRot(iPx, iPy) = -sinPhi0;
250 jacobianRot(iPy, iPx) = sinPhi0;
251 jacobianRot(iPy, iPy) = cosPhi0;
252 jacobianRot(iPz, iPz) = 1.0;
283 const CovarianceMatrix<6> cov6 = calculateCovarianceMatrix(
getLocalHelix(), momentum, charge, bZ);
296 return calculateCovarianceMatrix(
getLocalHelix(), momentum, charge, bZ);
313 double factor2DTo3D = hypot2(1, tanLambda);
316 return factor2DTo3D * absMom2D;
323 double factor2DTo3D = hypot2(1, tanLambda);
326 return factor2DTo3D * absMom2D;
373 double arcLength3D = arcLength2D * factor2DTo3D;
382 return output <<
"Local origin : " << trajectory3D.
getLocalOrigin() <<
", "
static double getAlphaFromBField(double bField)
Translater from magnetic field strength in Tesla to the alpha value.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
bool hasNAN() const
Checks if one of the coordinates is NAN.
double shiftPeriod(int nPeriods)
Adjust the arclength measure to start n periods later.
double getTanLambda() const
Getter for the slope of z over the transverse travel distance s.
HepGeom::Vector3D< double > Vector3D
3D Vector
static CovarianceMatrix< M > transported(const JacobianMatrix< M, N > &jacobian, const CovarianceMatrix< N > &cov)
Return a copy of the covariance matrix transported with the given jacobian matrix.
float getCharge() const
Return the particle charge defined in TDatabasePDG.
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
UncertainPerigeeCircle uncertainCircleXY() const
Projects the helix into the xy plain carrying over the relevant parts of the convariance matrix.
CDCTrajectory3D()
Default constructor for ROOT compatibility.
void passiveMoveBy(const Vector2D &bySZ)
Moves the coordinate system by the vector by and calculates the new sz line and its covariance matrix...
double curvatureXY() const
Getter for the signed curvature in the xy projection.
double m_flightTime
Memory for the estimation of the time at which the particle arrived at the support point.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Track candidate – seed values and indices.
A line in sz where s is the transverse travel distance as seen in the xy projection with uncertaintie...
@ c_Curv
Constant to address the curvature in the xy plane.
UncertainSZLine getLocalSZLine() const
Getter for the sz line starting from the local origin.
double getTimeSeed() const
Get the time at which the seed state is defined.
void setCovSeed(const TMatrixDSym &cov6D)
set the covariance matrix seed (6D).
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
Vector3D m_localOrigin
Memory for local coordinate origin of the circle representing the trajectory in global coordinates.
double setLocalOrigin(const Vector3D &localOrigin)
Setter for the origin of the local coordinate system.
@ c_TanL
Constant to address the tan lambda dip out of the xy plane.
double tanLambda() const
Getter for the proportinality factor from arc length in xy space to z.
ESign
Enumeration for the distinct sign values of floating point variables.
bool isValid(ESign s)
Returns true if sign is ESign::c_Plus, ESign::c_Minus or ESign::c_Zero.
Linear trajectory in sz space.
double shiftPeriod(int nPeriods)
Adjusts the z0 to the one that lies n periods forward.
UncertainHelix m_localHelix
Memory for the generalized circle describing the trajectory in coordinates from the local origin.
Particle trajectory as it is seen in xy projection represented as a circle.
static ESign ccwInfoToChargeSign(ERotation ccwInfo)
Conversion helper from clockwise or counterclockwise travel to the charge sign.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
TVector3 getPosSeed() const
get the seed value for track: pos.
bool fillInto(genfit::TrackCand &trackCand) const
Copies the trajectory information to the Genfit track candidate.
static double curvatureToAbsMom2D(double curvature, double bZ)
Conversion helper for two dimensional curvature to momenta.
static const double speedOfLight
[cm/ns]
double calcArcLength2D(const Vector3D &point) const
Calculate the travel distance from the start position of the trajectory.
@ c_Z0
Constant to address the z start position.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
Adds an uncertainty matrix to the circle in perigee parameterisation.
double getAbsMom3D() const
Get the estimation for the absolute value of the transvers momentum.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
Vector3D getMom3DAtSupport() const
Get the momentum at the start point of the trajectory.
double getMaximalCylindricalR() const
Getter for the maximal distance from the origin.
CovarianceMatrix< 6 > getCartesianCovariance(double bZ) const
Convert the helix parameters to the cartesian coordinates x,y,z,px,py,pz.
Abstract base class for different kinds of events.
A three dimensional vector.
TVector3 getProductionVertex() const
Return production vertex position.
Extension of the generalized circle also caching the perigee coordinates.
PerigeeCircle getGlobalCircle() const
Getter for the circle in global coordinates.
const Vector3D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
static void transport(const JacobianMatrix< N, N > &jacobian, CovarianceMatrix< N > &cov)
Transport the covariance matrix inplace with the given jacobian matrix.
bool isCurler(double factor=1) const
Checks if the trajectory leaves the outer radius of the CDC times the given tolerance factor.
Vector3D getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
static double getBFieldZ()
Getter for the signed magnetic field stength in z direction at the origin ( in Tesla )
Vector3D getFlightDirection3DAtSupport() const
Get the unit momentum at the start point of the trajectory.
const TMatrixDSym & getCovSeed() const
get the covariance matrix seed (6D).
static TMatrixDSym toTMatrix(const CovarianceMatrix< N > &cov)
Translate the covariance matrix to the TMatrix representation.
ESign getChargeSign() const
Gets the charge sign of the trajectory.
TVector3 getMomentum() const
Return momentum.
UncertainPerigeeCircle getLocalCircle() const
Getter for the circle in local coordinates.
@ c_I
Constant to address the impact parameter.
const TVectorD & getStateSeed() const
Returns the 6D seed state; should be in global coordinates.
A matrix implementation to be used as an interface typ through out the track finder.
A Class to store the Monte Carlo particle information.
void passiveMoveBy(const Vector3D &by)
Moves the coordinate system by the vector by and calculates the new perigee and its covariance matrix...
double getFlightTime() const
Getter for the time when the particle reached the support point position.
double getOuterCylindricalR() const
Getter for the outer radius of the outer most wire layer.
Helper functions to interact with the magnetic field.
UncertainSZLine uncertainSZLine() const
Reduces the helix to an sz line carrying over the relevant parts of the convariance matrix.
const UncertainHelix & getLocalHelix() const
Getter for the helix in local coordinates.
@ c_Phi0
Constant to address the azimuth angle of the direction of flight.
Particle full three dimensional trajectory.
void setPosMomSeed(const TVector3 &pos, const TVector3 &mom, const double charge)
sets the state to seed the track fitting.
Class representating the sense wire arrangement in the whole of the central drift chamber.
float getProductionTime() const
Return production time in ns.
TVector3 getMomSeed() const
get the seed value for track: mom.