CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackKinematicStatePropagator.cc
Go to the documentation of this file.
8 
9 using namespace std;
10 
13  (const KinematicState& state, const GlobalPoint& referencePoint) const
14 {
15  if( state.particleCharge() == 0. ) {
16  return propagateToTheTransversePCANeutral(state, referencePoint);
17  } else {
18  return propagateToTheTransversePCACharged(state, referencePoint);
19  }
20 }
21 
22 pair<HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer>
24  const GlobalPoint& point) const
25 {
26  GlobalPoint inPos = state.position();
27  GlobalVector inMom = state.momentum();
28  double kappa = state.transverseCurvature();
29  double fac = 1./state.charge()/state.parameters().magneticField().inInverseGeV(point).z();
30 
31  GlobalVectorDouble xOrig2Centre = GlobalVectorDouble(fac * inMom.y(), -fac * inMom.x(), 0.);
32  GlobalVectorDouble xOrigProj = GlobalVectorDouble(inPos.x(), inPos.y(), 0.);
33  GlobalVectorDouble xRefProj = GlobalVectorDouble(point.x(), point.y(), 0.);
34  GlobalVectorDouble deltax = xRefProj-xOrigProj-xOrig2Centre;
35  GlobalVectorDouble ndeltax = deltax.unit();
36 
39 
40 // Need to define plane with orientation as the ImpactPointSurface
41  GlobalVector X(ndeltax.x(), ndeltax.y(), ndeltax.z());
42  GlobalVector Y(0.,0.,1.);
44  Plane::PlanePointer plane = Plane::build(pos,rot);
45  HelixBarrelPlaneCrossingByCircle
46  planeCrossing(HelixPlaneCrossing::PositionType(inPos.x(), inPos.y(), inPos.z()),
47  HelixPlaneCrossing::DirectionType(inMom.x(), inMom.y(), inMom.z()),
48  kappa, direction);
49  return std::pair<HelixBarrelPlaneCrossingByCircle,Plane::PlanePointer>(planeCrossing,plane);
50 }
51 
52 
55  (const KinematicState& state, const GlobalPoint& referencePoint) const
56 {
57 //first use the existing FTS propagator to obtain parameters at PCA
58 //in transverse plane to the given point
59 
60 //final parameters and covariance
61  AlgebraicVector7 par;
63 
64 //initial parameters as class and vectors:
66  state.particleCharge(), state.magneticField());
67  ParticleMass mass = state.mass();
68  GlobalVector inMom = state.globalMomentum();
69 
70 //making a free trajectory state and looking
71 //for helix barrel plane crossing
72  FreeTrajectoryState fState = state.freeTrajectoryState();
73  GlobalPoint iP = referencePoint;
74  std::pair<HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer> cros = planeCrossing(fState,iP);
75 
76  HelixBarrelPlaneCrossingByCircle planeCrossing = cros.first;
77  BoundPlane::BoundPlanePointer plane = cros.second;
78  std::pair<bool,double> propResult = planeCrossing.pathLength(*plane);
79  if ( !propResult.first ) {
80  LogDebug("RecoVertex/TrackKinematicStatePropagator")
81  << "Propagation failed! State is invalid\n";
82  return KinematicState();
83  }
84  double s = propResult.second;
85 
86  HelixPlaneCrossing::PositionType xGen = planeCrossing.position(s);
87  GlobalPoint nPosition(xGen.x(),xGen.y(),xGen.z());
88  HelixPlaneCrossing::DirectionType pGen = planeCrossing.direction(s);
89  pGen *= inMom.mag()/pGen.mag();
90  GlobalVector nMomentum(pGen.x(),pGen.y(),pGen.z());
91  par(0) = nPosition.x();
92  par(1) = nPosition.y();
93  par(2) = nPosition.z();
94  par(3) = nMomentum.x();
95  par(4) = nMomentum.y();
96  par(5) = nMomentum.z();
97  par(6) = mass;
98 
99 //covariance matrix business
100 //elements of 7x7 covariance matrix responcible for the mass and
101 //mass - momentum projections corellations do change under such a transformation:
102 //special Jacobian needed
103  GlobalTrajectoryParameters fPar(nPosition, nMomentum, state.particleCharge(),
104  state.magneticField());
105 
106  JacobianCartesianToCurvilinear cart2curv(inPar);
107  JacobianCurvilinearToCartesian curv2cart(fPar);
108 
109  AlgebraicMatrix67 ca2cu;
110  AlgebraicMatrix76 cu2ca;
111  ca2cu.Place_at(cart2curv.jacobian(),0,0);
112  cu2ca.Place_at(curv2cart.jacobian(),0,0);
113  ca2cu(5,6) = 1;
114  cu2ca(6,5) = 1;
115 
116 //now both transformation jacobians: cartesian to curvilinear and back are done
117 //We transform matrix to curv frame, then propagate it and translate it back to
118 //cartesian frame.
119  AlgebraicSymMatrix66 cov1 = ROOT::Math::Similarity(ca2cu, state.kinematicParametersError().matrix());
120 
121 //propagation jacobian
122  AnalyticalCurvilinearJacobian prop(inPar,nPosition,nMomentum,s);
124  pr(5,5) = 1;
125  pr.Place_at(prop.jacobian(),0,0);
126 
127 //transportation
128  AlgebraicSymMatrix66 cov2 = ROOT::Math::Similarity(pr, cov1);
129 
130 //now geting back to 7-parametrization from curvilinear
131  cov = ROOT::Math::Similarity(cu2ca, cov2);
132 
133 //return parameters as a kiematic state
134  KinematicParameters resPar(par);
135  KinematicParametersError resEr(cov);
136  return KinematicState(resPar,resEr,state.particleCharge(), state.magneticField());
137  }
138 
140  (const KinematicState& state, const GlobalPoint& referencePoint) const
141 {
142 //new parameters vector and covariance:
143  AlgebraicVector7 par;
145 
146  //AlgebraicVector7 inStatePar = state.kinematicParameters().vector();
148  state.particleCharge(), state.magneticField());
149 
150 //first making a free trajectory state and propagating it according
151 //to the algorithm provided by Thomas Speer and Wolfgang Adam
152  FreeTrajectoryState fState = state.freeTrajectoryState();
153 
154  GlobalPoint xvecOrig = fState.position();
155  double phi = fState.momentum().phi();
156  double theta = fState.momentum().theta();
157  double xOrig = xvecOrig.x();
158  double yOrig = xvecOrig.y();
159  double zOrig = xvecOrig.z();
160  double xR = referencePoint.x();
161  double yR = referencePoint.y();
162 
163  double s2D = (xR - xOrig) * cos(phi) + (yR - yOrig) * sin(phi);
164  double s = s2D / sin(theta);
165  double xGen = xOrig + s2D*cos(phi);
166  double yGen = yOrig + s2D*sin(phi);
167  double zGen = zOrig + s2D/tan(theta);
168  GlobalPoint xPerigee = GlobalPoint(xGen, yGen, zGen);
169 
170 //new parameters
171  GlobalVector pPerigee = fState.momentum();
172  par(0) = xPerigee.x();
173  par(1) = xPerigee.y();
174  par(2) = xPerigee.z();
175  par(3) = pPerigee.x();
176  par(4) = pPerigee.y();
177  par(5) = pPerigee.z();
178  // par(6) = inStatePar(7);
179  par(6) = state.mass();
180 
181 //covariance matrix business:
182 //everything lake it was before: jacobains are smart enouhg to
183 //distinguish between neutral and charged states themselves
184 
185  GlobalTrajectoryParameters fPar(xPerigee, pPerigee, state.particleCharge(),
186  state.magneticField());
187 
188  JacobianCartesianToCurvilinear cart2curv(inPar);
189  JacobianCurvilinearToCartesian curv2cart(fPar);
190 
191  AlgebraicMatrix67 ca2cu;
192  AlgebraicMatrix76 cu2ca;
193  ca2cu.Place_at(cart2curv.jacobian(),0,0);
194  cu2ca.Place_at(curv2cart.jacobian(),0,0);
195  ca2cu(5,6) = 1;
196  cu2ca(6,5) = 1;
197 
198 //now both transformation jacobians: cartesian to curvilinear and back are done
199 //We transform matrix to curv frame, then propagate it and translate it back to
200 //cartesian frame.
201  AlgebraicSymMatrix66 cov1 = ROOT::Math::Similarity(ca2cu, state.kinematicParametersError().matrix());
202 
203 //propagation jacobian
204  AnalyticalCurvilinearJacobian prop(inPar,xPerigee,pPerigee,s);
206  pr(5,5) = 1;
207  pr.Place_at(prop.jacobian(),0,0);
208 
209 //transportation
210  AlgebraicSymMatrix66 cov2 = ROOT::Math::Similarity(pr, cov1);
211 
212 //now geting back to 7-parametrization from curvilinear
213  cov = ROOT::Math::Similarity(cu2ca, cov2);
214 
215 //return parameters as a kiematic state
216  KinematicParameters resPar(par);
217  KinematicParametersError resEr(cov);
218  return KinematicState(resPar,resEr,state.particleCharge(), state.magneticField());
219 }
220 
221 
#define LogDebug(id)
virtual KinematicState propagateToTheTransversePCANeutral(const KinematicState &state, const GlobalPoint &referencePoint) const
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
const GlobalTrajectoryParameters & parameters() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
ROOT::Math::SMatrix< double, 7, 6, ROOT::Math::MatRepStd< double, 7, 6 > > AlgebraicMatrix76
Definition: Matrices.h:11
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double ParticleMass
Definition: ParticleMass.h:5
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:63
#define X(str)
Definition: MuonsGrabber.cc:49
GlobalVector globalMomentum() const
PropagationDirection
TrackCharge charge() const
ParticleMass mass() const
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
Definition: Matrices.h:8
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:40
T mag() const
Definition: PV3DBase.h:67
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:7
T z() const
Cartesian z coordinate.
static PlanePointer build(Args &&...args)
Definition: Plane.h:36
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
KinematicParametersError const & kinematicParametersError() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
GlobalVector momentum() const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
GlobalPoint position() const
const AlgebraicMatrix65 & jacobian() const
const MagneticField * magneticField() const
ROOT::Math::SMatrix< double, 6, 7, ROOT::Math::MatRepStd< double, 6, 7 > > AlgebraicMatrix67
Definition: Matrices.h:10
double transverseCurvature() const
char state
Definition: procUtils.cc:75
TrackCharge particleCharge() const
virtual KinematicState propagateToTheTransversePCA(const KinematicState &state, const GlobalPoint &referencePoint) const
virtual std::pair< HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer > planeCrossing(const FreeTrajectoryState &par, const GlobalPoint &point) const
const MagneticField & magneticField() const
FreeTrajectoryState freeTrajectoryState() const
virtual KinematicState propagateToTheTransversePCACharged(const KinematicState &state, const GlobalPoint &referencePoint) const
T x() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
AlgebraicSymMatrix77 matrix() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
Definition: DDAxes.h:10