CMS 3D CMS Logo

TwoBodyDecayTrajectoryState.cc
Go to the documentation of this file.
1 
4 
7 
9 
13 
15 
17 
18 using namespace std;
19 
21  const TwoBodyDecay& tbd,
22  double particleMass,
23  const MagneticField* magField,
24  bool propagateErrors)
25  : theValidityFlag(false),
26  theParticleMass(particleMass),
27  theParameters(tbd.decayParameters()),
28  theDerivatives(AlgebraicMatrix(nLocalParam, nDecayParam), AlgebraicMatrix(nLocalParam, nDecayParam)),
29  theOriginalTsos(tsos),
30  thePrimaryMass(tbd.primaryMass()),
31  thePrimaryWidth(tbd.primaryWidth()) {
32  construct(magField, propagateErrors);
33 }
34 
36  theOriginalTsos.first.rescaleError(scale);
37  theOriginalTsos.second.rescaleError(scale);
38  theRefittedTsos.first.rescaleError(scale);
39  theRefittedTsos.second.rescaleError(scale);
40 }
41 
42 void TwoBodyDecayTrajectoryState::construct(const MagneticField* magField, bool propagateErrors) {
43  // construct global trajectory parameters at the starting point
45  pair<AlgebraicVector, AlgebraicVector> secondaryMomenta = tbdDecayModel.cartesianSecondaryMomenta(theParameters);
46 
50 
51  GlobalVector p1(secondaryMomenta.first[0], secondaryMomenta.first[1], secondaryMomenta.first[2]);
52 
53  GlobalVector p2(secondaryMomenta.second[0], secondaryMomenta.second[1], secondaryMomenta.second[2]);
54 
55  GlobalTrajectoryParameters gtp1(vtx, p1, theOriginalTsos.first.charge(), magField);
56  FreeTrajectoryState fts1(gtp1);
57 
58  GlobalTrajectoryParameters gtp2(vtx, p2, theOriginalTsos.second.charge(), magField);
59  FreeTrajectoryState fts2(gtp2);
60 
61  // contruct derivatives at the starting point
63  pair<AlgebraicMatrix, AlgebraicMatrix> derivatives = tbdDerivatives.derivatives(theParameters);
64 
65  AlgebraicMatrix deriv1(6, 9, 0);
66  deriv1.sub(1, 1, AlgebraicMatrix(3, 3, 1));
67  deriv1.sub(4, 4, derivatives.first);
68 
69  AlgebraicMatrix deriv2(6, 9, 0);
70  deriv2.sub(1, 1, AlgebraicMatrix(3, 3, 1));
71  deriv2.sub(4, 4, derivatives.second);
72 
73  // compute errors of initial states
74  if (propagateErrors) {
75  setError(fts1, deriv1);
76  setError(fts2, deriv2);
77  }
78 
79  // propgate states and derivatives from the starting points to the end points
80  bool valid1 = propagateSingleState(
81  fts1, gtp1, deriv1, theOriginalTsos.first.surface(), magField, theRefittedTsos.first, theDerivatives.first);
82 
83  bool valid2 = propagateSingleState(
84  fts2, gtp2, deriv2, theOriginalTsos.second.surface(), magField, theRefittedTsos.second, theDerivatives.second);
85 
86  theValidityFlag = valid1 && valid2;
87 
88  return;
89 }
90 
92  const GlobalTrajectoryParameters& gtp,
93  const AlgebraicMatrix& startDeriv,
94  const Surface& surface,
95  const MagneticField* magField,
97  AlgebraicMatrix& endDeriv) const {
99 
100  // propagate state
101  pair<TrajectoryStateOnSurface, double> tsosWithPath = propagator.propagateWithPath(fts, surface);
102 
103  // check if propagation was successful
104  if (!tsosWithPath.first.isValid())
105  return false;
106 
107  // jacobian for transformation from cartesian to curvilinear frame at the starting point
108  JacobianCartesianToCurvilinear cartToCurv(gtp);
109  const AlgebraicMatrix56& matCartToCurv = cartToCurv.jacobian();
110 
111  // jacobian in curvilinear frame for propagation from the starting point to the end point
113  gtp, tsosWithPath.first.globalPosition(), tsosWithPath.first.globalMomentum(), tsosWithPath.second);
114  const AlgebraicMatrix55& matCurvJac = curvJac.jacobian();
115 
116  // jacobian for transformation from curvilinear to local frame at the end point
117  JacobianCurvilinearToLocal curvToLoc(surface, tsosWithPath.first.localParameters(), *magField);
118  const AlgebraicMatrix55& matCurvToLoc = curvToLoc.jacobian();
119 
120  AlgebraicMatrix56 tmpDeriv = matCurvToLoc * matCurvJac * matCartToCurv;
121  AlgebraicMatrix hepMatDeriv(asHepMatrix(tmpDeriv));
122  //AlgebraicMatrix hepMatDeriv = asHepMatrix< 5, 6 >( tmpDeriv );
123 
124  // replace original state with new state
125  tsos = tsosWithPath.first;
126 
127  // propagate derivative matrix
128  endDeriv = hepMatDeriv * startDeriv;
129 
130  return true;
131 }
132 
134  AlgebraicSymMatrix ftsCartesianError(theParameters.covariance().similarity(derivative));
135  fts.setCartesianError(asSMatrix<6>(ftsCartesianError));
136 }
JacobianCartesianToCurvilinear.h
Vector3DBase
Definition: Vector3DBase.h:8
TwoBodyDecayTrajectoryState::propagateSingleState
bool propagateSingleState(const FreeTrajectoryState &fts, const GlobalTrajectoryParameters &gtp, const AlgebraicMatrix &startDeriv, const Surface &surface, const MagneticField *magField, TrajectoryStateOnSurface &tsos, AlgebraicMatrix &endDeriv) const
Definition: TwoBodyDecayTrajectoryState.cc:91
TwoBodyDecayTrajectoryState::TsosContainer
std::pair< TrajectoryStateOnSurface, TrajectoryStateOnSurface > TsosContainer
Definition: TwoBodyDecayTrajectoryState.h:14
TwoBodyDecayTrajectoryState::theParticleMass
double theParticleMass
Definition: TwoBodyDecayTrajectoryState.h:57
TwoBodyDecayTrajectoryState::TwoBodyDecayTrajectoryState
TwoBodyDecayTrajectoryState(const TsosContainer &tsos, const TwoBodyDecay &tbd, double particleMass, const MagneticField *magField, bool propagateErrors=false)
Definition: TwoBodyDecayTrajectoryState.cc:20
TwoBodyDecayModel::cartesianSecondaryMomenta
const std::pair< AlgebraicVector, AlgebraicVector > cartesianSecondaryMomenta(const AlgebraicVector &param)
Definition: TwoBodyDecayModel.cc:80
AnalyticalCurvilinearJacobian::jacobian
const AlgebraicMatrix55 & jacobian() const
Definition: AnalyticalCurvilinearJacobian.h:51
AnalyticalCurvilinearJacobian
Definition: AnalyticalCurvilinearJacobian.h:21
FreeTrajectoryState.h
TwoBodyDecayTrajectoryState::rescaleError
void rescaleError(double scale)
Definition: TwoBodyDecayTrajectoryState.cc:35
GlobalTrajectoryParameters.h
TwoBodyDecayTrajectoryState::theValidityFlag
bool theValidityFlag
Definition: TwoBodyDecayTrajectoryState.h:55
funct::false
false
Definition: Factorize.h:29
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
TwoBodyDecayTrajectoryState::theOriginalTsos
TsosContainer theOriginalTsos
Definition: TwoBodyDecayTrajectoryState.h:61
TwoBodyDecayParameters::mass
Definition: TwoBodyDecayParameters.h:17
TwoBodyDecayDerivatives::derivatives
const std::pair< AlgebraicMatrix, AlgebraicMatrix > derivatives(const TwoBodyDecay &tbd) const
Definition: TwoBodyDecayDerivatives.cc:14
TwoBodyDecayDerivatives.h
TwoBodyDecayTrajectoryState::theDerivatives
Derivatives theDerivatives
Definition: TwoBodyDecayTrajectoryState.h:60
funct::derivative
Derivative< X, A >::type derivative(const A &_)
Definition: Derivative.h:18
Surface
Definition: Surface.h:36
AlgebraicMatrix56
ROOT::Math::SMatrix< double, 5, 6, ROOT::Math::MatRepStd< double, 5, 6 > > AlgebraicMatrix56
Definition: AlgebraicROOTObjects.h:56
AnalyticalCurvilinearJacobian.h
TwoBodyDecayConstraintProducer_cff.primaryMass
primaryMass
Define the TBD.
Definition: TwoBodyDecayConstraintProducer_cff.py:9
TwoBodyDecayTrajectoryState::theRefittedTsos
TsosContainer theRefittedTsos
Definition: TwoBodyDecayTrajectoryState.h:62
TwoBodyDecayTrajectoryState::construct
void construct(const MagneticField *magField, bool propagateErrors)
Definition: TwoBodyDecayTrajectoryState.cc:42
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
JacobianCurvilinearToLocal
Definition: JacobianCurvilinearToLocal.h:19
AlgebraicMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
Definition: AlgebraicROOTObjects.h:55
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
universalConfigTemplate.primaryWidth
primaryWidth
Definition: universalConfigTemplate.py:85
p2
double p2[4]
Definition: TauolaWrapper.h:90
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
Point3DBase< float, GlobalTag >
AnalyticalPropagator_cfi.AnalyticalPropagator
AnalyticalPropagator
Definition: AnalyticalPropagator_cfi.py:3
JacobianCartesianToCurvilinear::jacobian
const AlgebraicMatrix56 & jacobian() const
Definition: JacobianCartesianToCurvilinear.h:24
TwoBodyDecayDerivatives
Definition: TwoBodyDecayDerivatives.h:14
TwoBodyDecayTrajectoryState::derivatives
const Derivatives & derivatives(void) const
Definition: TwoBodyDecayTrajectoryState.h:35
TwoBodyDecayModel
Definition: TwoBodyDecayModel.h:15
TwoBodyDecayParameters::z
Definition: TwoBodyDecayParameters.h:17
p1
double p1[4]
Definition: TauolaWrapper.h:89
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
AnalyticalPropagator.h
JacobianCurvilinearToLocal::jacobian
const AlgebraicMatrix55 & jacobian() const
Definition: JacobianCurvilinearToLocal.h:37
TwoBodyDecayParameters::y
Definition: TwoBodyDecayParameters.h:17
TwoBodyDecayTrajectoryState::theParameters
TwoBodyDecayParameters theParameters
Definition: TwoBodyDecayTrajectoryState.h:59
TwoBodyDecayModel.h
TwoBodyDecayTrajectoryState::setError
void setError(FreeTrajectoryState &fts, AlgebraicMatrix &derivative) const
Definition: TwoBodyDecayTrajectoryState.cc:133
TwoBodyDecayParameters::x
Definition: TwoBodyDecayParameters.h:17
Migration.h
std
Definition: JetResolutionObject.h:76
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
TwoBodyDecayParameters::covariance
const AlgebraicSymMatrix & covariance(void) const
Get error matrix.
Definition: TwoBodyDecayParameters.h:37
TwoBodyDecay
Definition: TwoBodyDecay.h:15
TwoBodyDecayTrajectoryState.h
JacobianCurvilinearToLocal.h
MagneticField
Definition: MagneticField.h:19
asHepMatrix
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:60
FreeTrajectoryState::setCartesianError
void setCartesianError(const CartesianTrajectoryError &err)
Definition: FreeTrajectoryState.h:97
JacobianCartesianToCurvilinear
Definition: JacobianCartesianToCurvilinear.h:14