File indexing completed on 2024-04-06 12:31:40
0001 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
0002 #include "MagneticField/Engine/interface/MagneticField.h"
0003 #include "FWCore/Utilities/interface/Likely.h"
0004
0005 GlobalTrajectoryParameters::GlobalTrajectoryParameters(const GlobalPoint& aX,
0006 const GlobalVector& direction,
0007 float transverseCurvature,
0008 int,
0009 const MagneticField* fieldProvider)
0010 : theField(fieldProvider), theX(aX) {
0011 cachedMagneticField = theField->inTesla(theX);
0012 float bza = -2.99792458e-3f * cachedMagneticField.z();
0013 float qbpi = bza / (direction.perp() * transverseCurvature);
0014 theP = direction * std::abs(qbpi);
0015 theCharge = qbpi > 0.f ? 1 : -1;
0016 }
0017
0018 GlobalTrajectoryParameters::GlobalTrajectoryParameters(const GlobalPoint& aX,
0019 const GlobalVector& direction,
0020 float transverseCurvature,
0021 int,
0022 const MagneticField* fieldProvider,
0023 GlobalVector fieldValue)
0024 : theField(fieldProvider), theX(aX), cachedMagneticField(fieldValue) {
0025 float bza = -2.99792458e-3f * cachedMagneticField.z();
0026 float qbpi = bza / (direction.perp() * transverseCurvature);
0027 theP = direction * std::abs(qbpi);
0028 theCharge = qbpi > 0.f ? 1 : -1;
0029 }
0030
0031 void GlobalTrajectoryParameters::setCache() {
0032 cachedMagneticField = theField ? theField->inTesla(theX) : GlobalVector(0, 0, 0);
0033 }
0034
0035 GlobalVector GlobalTrajectoryParameters::magneticFieldInInverseGeV(const GlobalPoint& x) const {
0036 return 2.99792458e-3f * theField->inTesla(x);
0037 }
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050