File indexing completed on 2024-04-06 12:31:40
0001 #ifndef _TRACKER_GLOBALTRAJECTORYPARAMETERS_H_
0002 #define _TRACKER_GLOBALTRAJECTORYPARAMETERS_H_
0003
0004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0005 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0006 #include "DataFormats/TrajectoryState/interface/TrackCharge.h"
0007 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0008
0009 class MagneticField;
0010
0011
0012
0013
0014
0015 class GlobalTrajectoryParameters {
0016 public:
0017
0018 GlobalTrajectoryParameters()
0019 : theField(nullptr), theX(), theP(), theCharge(0) {}
0020
0021
0022
0023
0024 GlobalTrajectoryParameters(const GlobalPoint& aX,
0025 const GlobalVector& aP,
0026 TrackCharge aCharge,
0027 const MagneticField* fieldProvider)
0028 : theField(fieldProvider), theX(aX), theP(aP), theCharge(aCharge) {
0029 setCache();
0030 }
0031
0032 GlobalTrajectoryParameters(const GlobalPoint& aX,
0033 const GlobalVector& aP,
0034 TrackCharge aCharge,
0035 const MagneticField* fieldProvider,
0036 GlobalVector fieldValue)
0037 : theField(fieldProvider), theX(aX), theP(aP), cachedMagneticField(fieldValue), theCharge(aCharge) {}
0038
0039
0040
0041
0042
0043
0044 GlobalTrajectoryParameters(const GlobalPoint& aX,
0045 const GlobalVector& direction,
0046 float transverseCurvature,
0047 int,
0048 const MagneticField* fieldProvider);
0049
0050 GlobalTrajectoryParameters(const GlobalPoint& aX,
0051 const GlobalVector& direction,
0052 float transverseCurvature,
0053 int,
0054 const MagneticField* fieldProvider,
0055 GlobalVector fieldValue);
0056
0057
0058
0059
0060 GlobalPoint position() const { return theX; }
0061
0062
0063
0064
0065 GlobalVector momentum() const { return theP; }
0066
0067 GlobalVector direction() const { return theP.unit(); }
0068
0069
0070
0071
0072 TrackCharge charge() const { return theCharge; }
0073
0074
0075
0076
0077 float signedInverseMomentum() const { return theCharge / theP.mag(); }
0078
0079
0080
0081
0082 float signedInverseTransverseMomentum() const { return theCharge / theP.perp(); }
0083
0084
0085
0086
0087
0088
0089 float transverseCurvature() const {
0090 return -2.99792458e-3f * signedInverseTransverseMomentum() * cachedMagneticField.z();
0091 }
0092
0093
0094
0095
0096
0097 AlgebraicVector6 vector() const {
0098 return AlgebraicVector6(theX.x(), theX.y(), theX.z(), theP.x(), theP.y(), theP.z());
0099 }
0100
0101 GlobalVector magneticFieldInInverseGeV(const GlobalPoint& x) const;
0102 GlobalVector magneticFieldInInverseGeV() const { return 2.99792458e-3f * cachedMagneticField; }
0103
0104 GlobalVector magneticFieldInTesla() const { return cachedMagneticField; }
0105
0106 const MagneticField& magneticField() const { return *theField; }
0107
0108 private:
0109 void setCache();
0110
0111 private:
0112 const MagneticField* theField;
0113 GlobalPoint theX;
0114 GlobalVector theP;
0115 GlobalVector cachedMagneticField;
0116 signed char theCharge;
0117 };
0118
0119 #endif