CMS 3D CMS Logo

PerigeeLinearizedTrackState.cc
Go to the documentation of this file.
8 
10  GlobalPoint paramPt(theLinPoint);
11 
12  thePredState = builder(theTSOS, paramPt);
14  return;
15 
16  double field = theTrack.field()->inInverseGeV(thePredState.theState().position()).z();
17 
18  if ((std::abs(theCharge) < 1e-5) || (fabs(field) < 1.e-10)) {
19  //neutral track
21  } else {
22  //charged track
24  }
25 
26  jacobiansAvailable = true;
27 }
28 
30  const PerigeeLinearizedTrackState* otherP = dynamic_cast<const PerigeeLinearizedTrackState*>(&other);
31  if (otherP == nullptr) {
32  throw VertexException("PerigeeLinearizedTrackState: don't know how to compare myself to non-perigee track state");
33  }
34  return (otherP->track() == theTrack);
35 }
36 
38  const PerigeeLinearizedTrackState* otherP = dynamic_cast<const PerigeeLinearizedTrackState*>(other.get());
39  if (otherP == nullptr) {
40  throw VertexException("PerigeeLinearizedTrackState: don't know how to compare myself to non-perigee track state");
41  }
42  return (otherP->track() == theTrack);
43 }
44 
46  const GlobalPoint& newLP) const {
48 }
49 
51  const GlobalPoint& vertexPosition,
52  const AlgebraicVector3& vectorParameters,
53  const AlgebraicSymMatrix66& covarianceMatrix) const {
55  vectorParameters, vertexPosition, charge(), covarianceMatrix, theTrack.field());
56  return RefCountedRefittedTrackState(new PerigeeRefittedTrackState(refittedTSCP, vectorParameters));
57 }
58 
59 std::vector<PerigeeLinearizedTrackState::RefCountedLinearizedTrackState> PerigeeLinearizedTrackState::components()
60  const {
61  std::vector<RefCountedLinearizedTrackState> result;
62  result.reserve(1);
63  result.push_back(RefCountedLinearizedTrackState(const_cast<PerigeeLinearizedTrackState*>(this)));
64  return result;
65 }
66 
68  const RefCountedRefittedTrackState& theRefittedState) const {
69  auto p = theRefittedState->position();
70  AlgebraicVector3 vertexPosition(p.x(), p.y(), p.z());
71  AlgebraicVector3 momentum = theRefittedState->momentumVector();
72  if ((momentum(2) * predictedStateMomentumParameters()(2) < 0) && (fabs(momentum(2)) > M_PI / 2)) {
74  momentum(2) -= 2 * M_PI;
76  momentum(2) += 2 * M_PI;
77  }
78  AlgebraicVectorN param = constantTerm() + positionJacobian() * vertexPosition + momentumJacobian() * momentum;
79  if (param(2) > M_PI)
80  param(2) -= 2 * M_PI;
81  if (param(2) < -M_PI)
82  param(2) += 2 * M_PI;
83 
84  return param;
85 }
86 
88  if (parameters(2) > M_PI)
89  parameters(2) -= 2 * M_PI;
90  if (parameters(2) < -M_PI)
91  parameters(2) += 2 * M_PI;
92 }
93 
95  GlobalPoint paramPt(theLinPoint);
96  //tarjectory parameters
97  double field = theTrack.field()->inInverseGeV(thePredState.theState().position()).z();
98  double signTC = -theCharge;
99 
100  double thetaAtEP = thePredState.perigeeParameters().theta();
101  double phiAtEP = thePredState.perigeeParameters().phi();
102  double ptAtEP = thePredState.pt();
103  double transverseCurvatureAtEP = field / ptAtEP * signTC;
104 
105  double x_v = thePredState.theState().position().x();
106  double y_v = thePredState.theState().position().y();
107  double z_v = thePredState.theState().position().z();
108  double X = x_v - paramPt.x() - sin(phiAtEP) / transverseCurvatureAtEP;
109  double Y = y_v - paramPt.y() + cos(phiAtEP) / transverseCurvatureAtEP;
110  double SS = X * X + Y * Y;
111  double S = sqrt(SS);
112 
113  // The track parameters at the expansion point
114 
115  theExpandedParams[0] = transverseCurvatureAtEP;
116  theExpandedParams[1] = thetaAtEP;
117  theExpandedParams[3] = 1 / transverseCurvatureAtEP - signTC * S;
118  double phiFEP;
119  if (std::abs(X) > std::abs(Y)) {
120  double signX = (X > 0.0 ? +1.0 : -1.0);
121  phiFEP = -signTC * signX * acos(signTC * Y / S);
122  } else {
123  phiFEP = asin(-signTC * X / S);
124  if ((signTC * Y) < 0.0)
125  phiFEP = M_PI - phiFEP;
126  }
127  if (phiFEP > M_PI)
128  phiFEP -= 2 * M_PI;
129  theExpandedParams[2] = phiFEP;
130  theExpandedParams[4] =
131  z_v - paramPt.z() - (phiAtEP - theExpandedParams[2]) / tan(thetaAtEP) / transverseCurvatureAtEP;
132 
133  // The Jacobian: (all at the expansion point)
134  // [i,j]
135  // i = 0: rho , 1: theta, 2: phi_p, 3: epsilon, 4: z_p
136  // j = 0: x_v, 1: y_v, 2: z_v
137 
138  thePositionJacobian(2, 0) = -Y / (SS);
139  thePositionJacobian(2, 1) = X / (SS);
140  thePositionJacobian(3, 0) = -signTC * X / S;
141  thePositionJacobian(3, 1) = -signTC * Y / S;
142  thePositionJacobian(4, 0) = thePositionJacobian(2, 0) / tan(thetaAtEP) / transverseCurvatureAtEP;
143  thePositionJacobian(4, 1) = thePositionJacobian(2, 1) / tan(thetaAtEP) / transverseCurvatureAtEP;
144  thePositionJacobian(4, 2) = 1;
145 
146  // [i,j]
147  // i = 0: rho , 1: theta, 2: phi_p, 3: epsilon, 4: z_p
148  // j = 0: rho, 1: theta, 2: phi_v
149  theMomentumJacobian(0, 0) = 1;
150  theMomentumJacobian(1, 1) = 1;
151 
152  theMomentumJacobian(2, 0) =
153  -(X * cos(phiAtEP) + Y * sin(phiAtEP)) / (SS * transverseCurvatureAtEP * transverseCurvatureAtEP);
154 
155  theMomentumJacobian(2, 2) = (Y * cos(phiAtEP) - X * sin(phiAtEP)) / (SS * transverseCurvatureAtEP);
156 
157  theMomentumJacobian(3, 0) =
158  (signTC * (Y * cos(phiAtEP) - X * sin(phiAtEP)) / S - 1) / (transverseCurvatureAtEP * transverseCurvatureAtEP);
159 
160  theMomentumJacobian(3, 2) = signTC * (X * cos(phiAtEP) + Y * sin(phiAtEP)) / (S * transverseCurvatureAtEP);
161 
162  theMomentumJacobian(4, 0) =
163  (phiAtEP - theExpandedParams[2]) / tan(thetaAtEP) / (transverseCurvatureAtEP * transverseCurvatureAtEP) +
164  theMomentumJacobian(2, 0) / tan(thetaAtEP) / transverseCurvatureAtEP;
165 
166  theMomentumJacobian(4, 1) =
167  (phiAtEP - theExpandedParams[2]) * (1 + 1 / (tan(thetaAtEP) * tan(thetaAtEP))) / transverseCurvatureAtEP;
168 
169  theMomentumJacobian(4, 2) = (theMomentumJacobian(2, 2) - 1) / tan(thetaAtEP) / transverseCurvatureAtEP;
170 
171  // And finally the residuals:
172 
173  auto p = thePredState.theState().position();
174  AlgebraicVector3 expansionPoint(p.x(), p.y(), p.z());
175  AlgebraicVector3 momentumAtExpansionPoint(transverseCurvatureAtEP, thetaAtEP, phiAtEP);
176 
178  theMomentumJacobian * momentumAtExpansionPoint);
179 }
180 
182  GlobalPoint paramPt(theLinPoint);
183 
184  //tarjectory parameters
185  double thetaAtEP = thePredState.theState().momentum().theta();
186  double phiAtEP = thePredState.theState().momentum().phi();
187  double ptAtEP = thePredState.theState().momentum().perp();
188 
189  double x_v = thePredState.theState().position().x();
190  double y_v = thePredState.theState().position().y();
191  double z_v = thePredState.theState().position().z();
192  double X = x_v - paramPt.x();
193  double Y = y_v - paramPt.y();
194 
195  // The track parameters at the expansion point
196 
197  theExpandedParams(0) = 1 / ptAtEP;
198  theExpandedParams(1) = thetaAtEP;
199  theExpandedParams(2) = phiAtEP;
200  theExpandedParams(3) = X * sin(phiAtEP) - Y * cos(phiAtEP);
201  theExpandedParams(4) = z_v - paramPt.z() - (X * cos(phiAtEP) + Y * sin(phiAtEP)) / tan(thetaAtEP);
202 
203  // The Jacobian: (all at the expansion point)
204  // [i,j]
205  // i = 0: rho = 1/pt , 1: theta, 2: phi_p, 3: epsilon, 4: z_p
206  // j = 0: x_v, 1: y_v, 2: z_v
207 
208  thePositionJacobian(3, 0) = sin(phiAtEP);
209  thePositionJacobian(3, 1) = -cos(phiAtEP);
210  thePositionJacobian(4, 0) = -cos(phiAtEP) / tan(thetaAtEP);
211  thePositionJacobian(4, 1) = -sin(phiAtEP) / tan(thetaAtEP);
212  thePositionJacobian(4, 2) = 1;
213 
214  // [i,j]
215  // i = 0: rho = 1/pt , 1: theta, 2: phi_p, 3: epsilon, 4: z_p
216  // j = 0: rho = 1/pt , 1: theta, 2: phi_v
217 
218  theMomentumJacobian(0, 0) = 1;
219  theMomentumJacobian(1, 1) = 1;
220  theMomentumJacobian(2, 2) = 1;
221 
222  theMomentumJacobian(3, 2) = X * cos(phiAtEP) + Y * sin(phiAtEP);
223 
224  theMomentumJacobian(4, 1) = theMomentumJacobian(3, 2) * (1 + 1 / (tan(thetaAtEP) * tan(thetaAtEP)));
225 
226  theMomentumJacobian(4, 2) = (X * sin(phiAtEP) - Y * cos(phiAtEP)) / tan(thetaAtEP);
227 
228  // And finally the residuals:
229 
230  auto p = thePredState.theState().position();
231  AlgebraicVector3 expansionPoint(p.x(), p.y(), p.z());
232  AlgebraicVector3 momentumAtExpansionPoint(1. / ptAtEP, thetaAtEP, phiAtEP);
233 
235  theMomentumJacobian * momentumAtExpansionPoint);
236 }
Likely.h
PerigeeLinearizedTrackState::checkParameters
void checkParameters(AlgebraicVector5 &parameters) const override
Definition: PerigeeLinearizedTrackState.cc:87
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
PerigeeLinearizedTrackState::jacobiansAvailable
bool jacobiansAvailable
Definition: PerigeeLinearizedTrackState.h:170
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
PerigeeLinearizedTrackState::createRefittedTrackState
RefCountedRefittedTrackState createRefittedTrackState(const GlobalPoint &vertexPosition, const AlgebraicVector3 &vectorParameters, const AlgebraicSymMatrix66 &covarianceMatrix) const override
Definition: PerigeeLinearizedTrackState.cc:50
PerigeeLinearizedTrackState::track
reco::TransientTrack track() const override
Definition: PerigeeLinearizedTrackState.h:52
PerigeeLinearizedTrackState::computeJacobians
void computeJacobians() const
Definition: PerigeeLinearizedTrackState.cc:9
MessageLogger.h
PerigeeLinearizedTrackState::theMomentumJacobian
AlgebraicMatrix53 theMomentumJacobian
Definition: PerigeeLinearizedTrackState.h:162
VertexException
Common base class.
Definition: VertexException.h:12
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
LinearizedTrackState< 5 >::charge
virtual TrackCharge charge() const=0
X
#define X(str)
Definition: MuonsGrabber.cc:38
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
PerigeeLinearizedTrackState::theTSOS
const TrajectoryStateOnSurface theTSOS
Definition: PerigeeLinearizedTrackState.h:160
PerigeeLinearizedTrackState::constantTerm
const AlgebraicVector5 & constantTerm() const override
Definition: PerigeeLinearizedTrackState.h:176
PerigeeLinearizedTrackState::thePositionJacobian
AlgebraicMatrix53 thePositionJacobian
Definition: PerigeeLinearizedTrackState.h:162
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
PerigeeLinearizedTrackState::theConstantTerm
AlgebraicVector5 theConstantTerm
Definition: PerigeeLinearizedTrackState.h:164
PerigeeLinearizedTrackState::momentumJacobian
const AlgebraicMatrix53 & momentumJacobian() const override
Definition: PerigeeLinearizedTrackState.h:194
PerigeeLinearizedTrackState::theTrack
reco::TransientTrack theTrack
Definition: PerigeeLinearizedTrackState.h:159
PerigeeRefittedTrackState
Definition: PerigeeRefittedTrackState.h:18
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
PerigeeLinearizedTrackState::positionJacobian
const AlgebraicMatrix53 & positionJacobian() const override
Definition: PerigeeLinearizedTrackState.h:185
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
PerigeeRefittedTrackState.h
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
PerigeeConversions::trajectoryStateClosestToPoint
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const AlgebraicVector3 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const AlgebraicSymMatrix66 &theCovarianceMatrix, const MagneticField *field)
Definition: PerigeeConversions.cc:97
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PerigeeConversions.h
AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Definition: AlgebraicROOTObjects.h:24
DDAxes::z
PerigeeTrajectoryParameters::phi
double phi() const
Definition: PerigeeTrajectoryParameters.h:62
PerigeeLinearizedTrackState::components
std::vector< ReferenceCountingPointer< LinearizedTrackState< 5 > > > components() const override
Definition: PerigeeLinearizedTrackState.cc:59
trackingPlots.other
other
Definition: trackingPlots.py:1464
Point3DBase< float, GlobalTag >
TrajectoryStateClosestToPoint::perigeeParameters
const PerigeeTrajectoryParameters & perigeeParameters() const
Definition: TrajectoryStateClosestToPoint.h:73
PerigeeLinearizedTrackState::thePredState
TrajectoryStateClosestToPoint thePredState
Definition: PerigeeLinearizedTrackState.h:163
MagneticField::inInverseGeV
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
PerigeeLinearizedTrackState::PerigeeLinearizedTrackState
PerigeeLinearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track, const TrajectoryStateOnSurface &tsos)
Definition: PerigeeLinearizedTrackState.h:140
PerigeeLinearizedTrackState::computeNeutralJacobians
void computeNeutralJacobians() const
Definition: PerigeeLinearizedTrackState.cc:181
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
LinearizedTrackState< 5 >::operator==
virtual bool operator==(LinearizedTrackState< N > &other) const=0
PerigeeLinearizedTrackState::computeChargedJacobians
void computeChargedJacobians() const
Definition: PerigeeLinearizedTrackState.cc:94
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PerigeeLinearizedTrackState::theExpandedParams
AlgebraicVector5 theExpandedParams
Definition: PerigeeLinearizedTrackState.h:165
PerigeeLinearizedTrackState::predictedStateMomentumParameters
AlgebraicVector3 predictedStateMomentumParameters() const override
Definition: PerigeeLinearizedTrackState.h:230
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
TrajectoryStateClosestToPoint::pt
double pt() const
Definition: TrajectoryStateClosestToPoint.h:78
PerigeeLinearizedTrackState::theCharge
TrackCharge theCharge
Definition: PerigeeLinearizedTrackState.h:169
LinearizedTrackState< 5 >::RefCountedRefittedTrackState
ReferenceCountingPointer< RefittedTrackState< N > > RefCountedRefittedTrackState
Definition: LinearizedTrackState.h:47
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
MagneticField.h
TrajectoryStateClosestToPoint
Definition: TrajectoryStateClosestToPoint.h:18
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
reco::TransientTrack::field
const MagneticField * field() const
Definition: TransientTrack.h:108
LinearizedTrackState< 5 >::AlgebraicVectorN
ROOT::Math::SVector< double, N > AlgebraicVectorN
Definition: LinearizedTrackState.h:38
PerigeeLinearizedTrackState::refittedParamFromEquation
AlgebraicVector5 refittedParamFromEquation(const RefCountedRefittedTrackState &theRefittedState) const override
Definition: PerigeeLinearizedTrackState.cc:67
PerigeeLinearizedTrackState.h
PerigeeLinearizedTrackState::stateWithNewLinearizationPoint
RefCountedLinearizedTrackState stateWithNewLinearizationPoint(const GlobalPoint &newLP) const override
Definition: PerigeeLinearizedTrackState.cc:45
LinearizedTrackState< 5 >
PerigeeLinearizedTrackState::builder
TSCPBuilderNoMaterial builder
Definition: PerigeeLinearizedTrackState.h:167
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
VertexException.h
S
Definition: CSCDBL1TPParametersExtended.h:16
TrajectoryStateClosestToPoint::isValid
bool isValid() const
Definition: TrajectoryStateClosestToPoint.h:111
mps_fire.result
result
Definition: mps_fire.py:311
PerigeeLinearizedTrackState
Definition: PerigeeLinearizedTrackState.h:33
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PerigeeLinearizedTrackState::theLinPoint
GlobalPoint theLinPoint
Definition: PerigeeLinearizedTrackState.h:158
TrajectoryStateClosestToPoint::theState
const FreeTrajectoryState & theState() const
Definition: TrajectoryStateClosestToPoint.h:96
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
PerigeeLinearizedTrackState::RefCountedLinearizedTrackState
ReferenceCountingPointer< LinearizedTrackState< 5 > > RefCountedLinearizedTrackState
Definition: PerigeeLinearizedTrackState.h:39
PerigeeTrajectoryParameters::theta
double theta() const
Definition: PerigeeTrajectoryParameters.h:56
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37