CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions
TrackKinematicStatePropagator Class Referencefinal

#include <TrackKinematicStatePropagator.h>

Inheritance diagram for TrackKinematicStatePropagator:
KinematicStatePropagator

Public Member Functions

KinematicStatePropagatorclone () const override
 
KinematicState propagateToTheTransversePCA (const KinematicState &state, const GlobalPoint &referencePoint) const override
 
 TrackKinematicStatePropagator ()
 
bool willPropagateToTheTransversePCA (const KinematicState &state, const GlobalPoint &point) const override
 
 ~TrackKinematicStatePropagator () override
 
- Public Member Functions inherited from KinematicStatePropagator
 KinematicStatePropagator ()
 
virtual ~KinematicStatePropagator ()
 

Private Types

typedef Point3DBase< double,
GlobalTag
GlobalPointDouble
 
typedef Vector3DBase< double,
GlobalTag
GlobalVectorDouble
 

Private Member Functions

virtual KinematicState propagateToTheTransversePCACharged (const KinematicState &state, const GlobalPoint &referencePoint) const
 
virtual KinematicState propagateToTheTransversePCANeutral (const KinematicState &state, const GlobalPoint &referencePoint) const
 

Detailed Description

Propagator for TransientTrack based KinematicStates. Does not include the material.

Definition at line 17 of file TrackKinematicStatePropagator.h.

Member Typedef Documentation

Definition at line 49 of file TrackKinematicStatePropagator.h.

Definition at line 50 of file TrackKinematicStatePropagator.h.

Constructor & Destructor Documentation

TrackKinematicStatePropagator::TrackKinematicStatePropagator ( )
inline

Definition at line 19 of file TrackKinematicStatePropagator.h.

Referenced by clone().

19 {}
TrackKinematicStatePropagator::~TrackKinematicStatePropagator ( )
inlineoverride

Definition at line 21 of file TrackKinematicStatePropagator.h.

21 {}

Member Function Documentation

KinematicStatePropagator* TrackKinematicStatePropagator::clone ( void  ) const
inlineoverridevirtual

Clone method reimplemented from abstract class

Implements KinematicStatePropagator.

Definition at line 36 of file TrackKinematicStatePropagator.h.

References TrackKinematicStatePropagator().

KinematicState TrackKinematicStatePropagator::propagateToTheTransversePCA ( const KinematicState state,
const GlobalPoint referencePoint 
) const
overridevirtual

Propagation to the point of closest approach in transverse plane to the given point

Implements KinematicStatePropagator.

Definition at line 11 of file TrackKinematicStatePropagator.cc.

References KinematicState::particleCharge().

12  {
13  if (state.particleCharge() == 0.) {
14  return propagateToTheTransversePCANeutral(state, referencePoint);
15  } else {
16  return propagateToTheTransversePCACharged(state, referencePoint);
17  }
18 }
virtual KinematicState propagateToTheTransversePCANeutral(const KinematicState &state, const GlobalPoint &referencePoint) const
TrackCharge particleCharge() const
virtual KinematicState propagateToTheTransversePCACharged(const KinematicState &state, const GlobalPoint &referencePoint) const
KinematicState TrackKinematicStatePropagator::propagateToTheTransversePCACharged ( const KinematicState state,
const GlobalPoint referencePoint 
) const
privatevirtual

Internal private methods, distinguishing between the propagation of neutrals and propagation of cahrged tracks.

Definition at line 68 of file TrackKinematicStatePropagator.cc.

References FreeTrajectoryState::curvilinearError(), HelixBarrelPlaneCrossingByCircle::direction(), KinematicState::freeTrajectoryState(), hcaldqm::quantity::fState, KinematicState::globalMomentum(), mps_fire::i, JacobianCartesianToCurvilinear::jacobian(), JacobianCurvilinearToCartesian::jacobian(), AnalyticalCurvilinearJacobian::jacobian(), KinematicState::kinematicParametersError(), LogDebug, PV3DBase< T, PVType, FrameType >::mag(), KinematicState::magneticField(), ResonanceBuilder::mass, KinematicState::mass(), KinematicParametersError::matrix(), CurvilinearTrajectoryError::matrix(), KinematicState::particleCharge(), HelixBarrelPlaneCrossingByCircle::pathLength(), HelixBarrelPlaneCrossingByCircle::position(), alignCSCRings::s, mathSSE::sqrt(), KinematicState::trajectoryParameters(), PV3DBase< T, PVType, FrameType >::x(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

69  {
70  //first use the existing FTS propagator to obtain parameters at PCA
71  //in transverse plane to the given point
72 
73  //final parameters and covariance
74 
75  //initial parameters as class and vectors:
76  //making a free trajectory state and looking
77  //for helix barrel plane crossing
79  const GlobalPoint& iP = referencePoint;
80  std::pair<HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer> cros = planeCrossing(fState, iP);
81 
82  HelixBarrelPlaneCrossingByCircle planeCrossing = cros.first;
83  BoundPlane::BoundPlanePointer plane = cros.second;
84  std::pair<bool, double> propResult = planeCrossing.pathLength(*plane);
85  if (!propResult.first) {
86  LogDebug("RecoVertex/TrackKinematicStatePropagator") << "Propagation failed! State is invalid\n";
87  return KinematicState();
88  }
89  double s = propResult.second;
90 
91  GlobalTrajectoryParameters const& inPar = state.trajectoryParameters();
92  ParticleMass mass = state.mass();
93  GlobalVector inMom = state.globalMomentum();
94 
95  HelixPlaneCrossing::PositionType xGen = planeCrossing.position(s);
96  GlobalPoint nPosition(xGen.x(), xGen.y(), xGen.z());
97  HelixPlaneCrossing::DirectionType pGen = planeCrossing.direction(s);
98  pGen *= inMom.mag() / pGen.mag();
99  GlobalVector nMomentum(pGen.x(), pGen.y(), pGen.z());
100  AlgebraicVector7 par;
102  par(0) = nPosition.x();
103  par(1) = nPosition.y();
104  par(2) = nPosition.z();
105  par(3) = nMomentum.x();
106  par(4) = nMomentum.y();
107  par(5) = nMomentum.z();
108  par(6) = mass;
109 
110  //covariance matrix business
111  //elements of 7x7 covariance matrix responcible for the mass and
112  //mass - momentum projections corellations do change under such a transformation:
113  //special Jacobian needed
114  GlobalTrajectoryParameters fPar(nPosition, nMomentum, state.particleCharge(), state.magneticField());
115 
116  // check if correlation are present between mass and others
117  bool thereIsNoCorr = true;
118 
119  for (auto i = 0; i < 6; ++i)
120  thereIsNoCorr &= (0 == state.kinematicParametersError().matrix()(i, 6));
121 
122  if (thereIsNoCorr) {
123  // easy life
124  AnalyticalCurvilinearJacobian prop(inPar, nPosition, nMomentum, s);
125  AlgebraicSymMatrix55 cov2 = ROOT::Math::Similarity(prop.jacobian(), fState.curvilinearError().matrix());
127 
128  return KinematicState(fts, state.mass(), std::sqrt(state.kinematicParametersError().matrix()(6, 6)));
129 
130  //KinematicState kRes(fts, state.mass(), std::sqrt(state.kinematicParametersError().matrix()(6,6)));
131  //std::cout << "\n\ncart from final Kstate\n" << kRes.kinematicParametersError().matrix() << std::endl;
132  // std::cout << "curv from final K\n" << kRes.freeTrajectoryState().curvilinearError().matrix() << std::endl;
133 
134  } else {
135  JacobianCartesianToCurvilinear cart2curv(inPar);
136  JacobianCurvilinearToCartesian curv2cart(fPar);
137 
138  AlgebraicMatrix67 ca2cu;
139  AlgebraicMatrix76 cu2ca;
140  ca2cu.Place_at(cart2curv.jacobian(), 0, 0);
141  cu2ca.Place_at(curv2cart.jacobian(), 0, 0);
142  ca2cu(5, 6) = 1;
143  cu2ca(6, 5) = 1;
144 
145  //now both transformation jacobians: cartesian to curvilinear and back are done
146  //We transform matrix to curv frame, then propagate it and translate it back to
147  //cartesian frame.
148  AlgebraicSymMatrix66 cov1 = ROOT::Math::Similarity(ca2cu, state.kinematicParametersError().matrix());
149 
150  /*
151  std::cout << "\n\ncurv from Kstate\n" << cov1 << std::endl;
152  std::cout << "curv from fts\n" << fState.curvilinearError().matrix() << std::endl;
153  */
154 
155  //propagation jacobian
156  AnalyticalCurvilinearJacobian prop(inPar, nPosition, nMomentum, s);
158  pr(5, 5) = 1;
159  pr.Place_at(prop.jacobian(), 0, 0);
160 
161  //transportation
162  AlgebraicSymMatrix66 cov2 = ROOT::Math::Similarity(pr, cov1);
163 
164  //now geting back to 7-parametrization from curvilinear
165  cov = ROOT::Math::Similarity(cu2ca, cov2);
166 
167  /*
168  std::cout << "curv prop \n" << cov2 << std::endl;
169  std::cout << "cart prop\n" << cov << std::endl;
170  */
171 
172  //return parameters as a kiematic state
173  KinematicParameters resPar(par);
174  KinematicParametersError resEr(cov);
175 
176  return KinematicState(resPar, resEr, state.particleCharge(), state.magneticField());
177 
178  /*
179  KinematicState resK(resPar,resEr,state.particleCharge(), state.magneticField());
180  std::cout << "\ncurv from K prop\n" << resK.freeTrajectoryState().curvilinearError().matrix() << std::endl;
181  return resK;
182  */
183  }
184 }
T y() const
Cartesian y coordinate.
ROOT::Math::SMatrix< double, 6, 7, ROOT::Math::MatRepStd< double, 6, 7 > > AlgebraicMatrix67
Definition: Matrices.h:11
T x() const
Cartesian x coordinate.
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
double ParticleMass
Definition: ParticleMass.h:4
GlobalVector globalMomentum() const
AlgebraicSymMatrix77 const & matrix() const
const CurvilinearTrajectoryError & curvilinearError() const
ParticleMass mass() const
T mag() const
Definition: PV3DBase.h:64
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:19
DirectionType direction(double s) const override
KinematicParametersError const & kinematicParametersError() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 7, 6, ROOT::Math::MatRepStd< double, 7, 6 > > AlgebraicMatrix76
Definition: Matrices.h:12
const MagneticField * magneticField() const
std::pair< bool, double > pathLength(const Plane &) override
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
Definition: Matrices.h:9
TrackCharge particleCharge() const
const AlgebraicSymMatrix55 & matrix() const
FreeTrajectoryState freeTrajectoryState() const
T x() const
Definition: PV3DBase.h:59
GlobalTrajectoryParameters const & trajectoryParameters() const
PositionType position(double s) const override
#define LogDebug(id)
KinematicState TrackKinematicStatePropagator::propagateToTheTransversePCANeutral ( const KinematicState state,
const GlobalPoint referencePoint 
) const
privatevirtual

Definition at line 186 of file TrackKinematicStatePropagator.cc.

References funct::cos(), KinematicState::freeTrajectoryState(), hcaldqm::quantity::fState, JacobianCurvilinearToCartesian::jacobian(), KinematicState::kinematicParametersError(), KinematicState::magneticField(), KinematicState::mass(), KinematicParametersError::matrix(), FreeTrajectoryState::momentum(), KinematicState::particleCharge(), PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), alignCSCRings::s, funct::sin(), funct::tan(), PV3DBase< T, PVType, FrameType >::theta(), theta(), KinematicState::trajectoryParameters(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

187  {
188  //new parameters vector and covariance:
189  AlgebraicVector7 par;
191 
192  //AlgebraicVector7 inStatePar = state.kinematicParameters().vector();
193  GlobalTrajectoryParameters const& inPar = state.trajectoryParameters();
194 
195  //first making a free trajectory state and propagating it according
196  //to the algorithm provided by Thomas Speer and Wolfgang Adam
198 
199  GlobalPoint xvecOrig = fState.position();
200  double phi = fState.momentum().phi();
201  double theta = fState.momentum().theta();
202  double xOrig = xvecOrig.x();
203  double yOrig = xvecOrig.y();
204  double zOrig = xvecOrig.z();
205  double xR = referencePoint.x();
206  double yR = referencePoint.y();
207 
208  double s2D = (xR - xOrig) * cos(phi) + (yR - yOrig) * sin(phi);
209  double s = s2D / sin(theta);
210  double xGen = xOrig + s2D * cos(phi);
211  double yGen = yOrig + s2D * sin(phi);
212  double zGen = zOrig + s2D / tan(theta);
213  GlobalPoint xPerigee = GlobalPoint(xGen, yGen, zGen);
214 
215  //new parameters
216  GlobalVector pPerigee = fState.momentum();
217  par(0) = xPerigee.x();
218  par(1) = xPerigee.y();
219  par(2) = xPerigee.z();
220  par(3) = pPerigee.x();
221  par(4) = pPerigee.y();
222  par(5) = pPerigee.z();
223  // par(6) = inStatePar(7);
224  par(6) = state.mass();
225 
226  //covariance matrix business:
227  //everything lake it was before: jacobains are smart enouhg to
228  //distinguish between neutral and charged states themselves
229 
230  GlobalTrajectoryParameters fPar(xPerigee, pPerigee, state.particleCharge(), state.magneticField());
231 
232  JacobianCartesianToCurvilinear cart2curv(inPar);
233  JacobianCurvilinearToCartesian curv2cart(fPar);
234 
235  AlgebraicMatrix67 ca2cu;
236  AlgebraicMatrix76 cu2ca;
237  ca2cu.Place_at(cart2curv.jacobian(), 0, 0);
238  cu2ca.Place_at(curv2cart.jacobian(), 0, 0);
239  ca2cu(5, 6) = 1;
240  cu2ca(6, 5) = 1;
241 
242  //now both transformation jacobians: cartesian to curvilinear and back are done
243  //We transform matrix to curv frame, then propagate it and translate it back to
244  //cartesian frame.
245  AlgebraicSymMatrix66 cov1 = ROOT::Math::Similarity(ca2cu, state.kinematicParametersError().matrix());
246 
247  //propagation jacobian
248  AnalyticalCurvilinearJacobian prop(inPar, xPerigee, pPerigee, s);
250  pr(5, 5) = 1;
251  pr.Place_at(prop.jacobian(), 0, 0);
252 
253  //transportation
254  AlgebraicSymMatrix66 cov2 = ROOT::Math::Similarity(pr, cov1);
255 
256  //now geting back to 7-parametrization from curvilinear
257  cov = ROOT::Math::Similarity(cu2ca, cov2);
258 
259  // FreeTrajectoryState fts(fPar);
260 
261  //return parameters as a kiematic state
262  KinematicParameters resPar(par);
263  KinematicParametersError resEr(cov);
264  return KinematicState(resPar, resEr, state.particleCharge(), state.magneticField());
265 
266  //return KinematicState(fts,state.mass(), cov(6,6));
267 }
ROOT::Math::SMatrix< double, 6, 7, ROOT::Math::MatRepStd< double, 6, 7 > > AlgebraicMatrix67
Definition: Matrices.h:11
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:60
AlgebraicSymMatrix77 const & matrix() const
ParticleMass mass() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
T z() const
Definition: PV3DBase.h:61
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
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 7, 6, ROOT::Math::MatRepStd< double, 7, 6 > > AlgebraicMatrix76
Definition: Matrices.h:12
GlobalPoint position() const
const MagneticField * magneticField() const
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
Definition: Matrices.h:9
TrackCharge particleCharge() const
FreeTrajectoryState freeTrajectoryState() const
T x() const
Definition: PV3DBase.h:59
GlobalTrajectoryParameters const & trajectoryParameters() const
bool TrackKinematicStatePropagator::willPropagateToTheTransversePCA ( const KinematicState state,
const GlobalPoint point 
) const
overridevirtual

Reimplemented from KinematicStatePropagator.

Definition at line 53 of file TrackKinematicStatePropagator.cc.

References KinematicState::freeTrajectoryState(), hcaldqm::quantity::fState, KinematicState::particleCharge(), and HelixBarrelPlaneCrossingByCircle::pathLength().

Referenced by KinematicParticleVertexFitter::fit().

54  {
55  if (state.particleCharge() == 0.)
56  return true;
57 
58  // copied from below...
60  std::pair<HelixBarrelPlaneCrossingByCircle, BoundPlane::BoundPlanePointer> cros = planeCrossing(fState, point);
61 
62  HelixBarrelPlaneCrossingByCircle planeCrossing = cros.first;
63  BoundPlane::BoundPlanePointer plane = cros.second;
64  std::pair<bool, double> propResult = planeCrossing.pathLength(*plane);
65  return propResult.first;
66 }
std::pair< bool, double > pathLength(const Plane &) override
TrackCharge particleCharge() const
FreeTrajectoryState freeTrajectoryState() const