CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TwoBodyDecayTrajectoryState.cc
Go to the documentation of this file.
1 
4 
7 
9 
13 
15 
17 
18 using namespace std;
19 
20 
22  const TwoBodyDecay & tbd,
23  double particleMass,
24  const MagneticField* magField )
25  : theValidityFlag( false ),
26  theParticleMass( particleMass ),
27  theParameters( tbd.decayParameters() ),
28  theDerivatives( AlgebraicMatrix( nLocalParam, nDecayParam ), AlgebraicMatrix( nLocalParam, nDecayParam ) ),
29  theOriginalTsos( tsos )
30 {
31  construct( magField );
32 }
33 
34 
36  const TwoBodyDecayParameters & param,
37  double particleMass,
38  const MagneticField* magField )
39  : theValidityFlag( false ),
40  theParticleMass( particleMass ),
41  theParameters( param ),
42  theDerivatives( AlgebraicMatrix( 5, 9 ), AlgebraicMatrix( 5, 9 ) ),
43  theOriginalTsos( tsos )
44 {
45  construct( magField );
46 }
47 
48 
50 {
51  // construct global trajectory parameters at the starting point
53  pair< AlgebraicVector, AlgebraicVector > secondaryMomenta = tbdDecayModel.cartesianSecondaryMomenta( theParameters );
54 
58 
59  GlobalVector p1( secondaryMomenta.first[0],
60  secondaryMomenta.first[1],
61  secondaryMomenta.first[2] );
62 
63  GlobalVector p2( secondaryMomenta.second[0],
64  secondaryMomenta.second[1],
65  secondaryMomenta.second[2] );
66 
67  GlobalTrajectoryParameters gtp1( vtx, p1, theOriginalTsos.first.charge(), magField );
68  GlobalTrajectoryParameters gtp2( vtx, p2, theOriginalTsos.second.charge(), magField );
69 
70  // contruct derivatives at the starting point
71  TwoBodyDecayDerivatives tbdDerivatives( theParameters[TwoBodyDecayParameters::mass], theParticleMass );
72  pair< AlgebraicMatrix, AlgebraicMatrix > derivatives = tbdDerivatives.derivatives( theParameters );
73 
74  AlgebraicMatrix deriv1( 6, 9, 0 );
75  deriv1.sub( 1, 1, AlgebraicMatrix( 3, 3, 1 ) );
76  deriv1.sub( 4, 4, derivatives.first );
77 
78  AlgebraicMatrix deriv2( 6, 9, 0 );
79  deriv2.sub( 1, 1, AlgebraicMatrix( 3, 3, 1 ) );
80  deriv2.sub( 4, 4, derivatives.second );
81 
82  // propgate states and derivatives from the starting points to the end points
83  bool valid1 = propagateSingleState( gtp1, deriv1, theOriginalTsos.first.surface(), magField,
84  theRefittedTsos.first, theDerivatives.first );
85 
86  bool valid2 = propagateSingleState( gtp2, deriv2, theOriginalTsos.second.surface(), magField,
87  theRefittedTsos.second, theDerivatives.second );
88 
89  theValidityFlag = valid1 && valid2;
90 
91  return;
92 }
93 
94 
96  const AlgebraicMatrix & startDeriv,
97  const Surface & surface,
98  const MagneticField* magField,
100  AlgebraicMatrix & endDeriv )
101 {
102  AnalyticalPropagator propagator( magField );
103 
104  // propagate state
105  pair< TrajectoryStateOnSurface, double > tsosWithPath = propagator.propagateWithPath( FreeTrajectoryState( gtp ), surface );
106 
107  // check if propagation was successful
108  if ( !tsosWithPath.first.isValid() ) return false;
109 
110  // jacobian for transformation from cartesian to curvilinear frame at the starting point
111  JacobianCartesianToCurvilinear cartToCurv( gtp );
112  const AlgebraicMatrix56& matCartToCurv = cartToCurv.jacobian();
113 
114  // jacobian in curvilinear frame for propagation from the starting point to the end point
115  AnalyticalCurvilinearJacobian curvJac( gtp, tsosWithPath.first.globalPosition(),
116  tsosWithPath.first.globalMomentum(),
117  tsosWithPath.second );
118  const AlgebraicMatrix55& matCurvJac = curvJac.jacobian();
119 
120  // jacobian for transformation from curvilinear to local frame at the end point
121  JacobianCurvilinearToLocal curvToLoc( surface, tsosWithPath.first.localParameters(), *magField );
122  const AlgebraicMatrix55& matCurvToLoc = curvToLoc.jacobian();
123 
124  AlgebraicMatrix56 tmpDeriv = matCurvToLoc*matCurvJac*matCartToCurv;
125  AlgebraicMatrix hepMatDeriv( asHepMatrix( tmpDeriv ) );
126  //AlgebraicMatrix hepMatDeriv = asHepMatrix< 5, 6 >( tmpDeriv );
127 
128  // replace original state with new state
129  tsos = tsosWithPath.first;
130 
131  // propagate derivative matrix
132  endDeriv = hepMatDeriv*startDeriv;
133 
134  return true;
135 }
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:49
ROOT::Math::SMatrix< double, 5, 6, ROOT::Math::MatRepStd< double, 5, 6 > > AlgebraicMatrix56
const Derivatives & derivatives(void) const
bool propagateSingleState(const GlobalTrajectoryParameters &gtp, const AlgebraicMatrix &startDeriv, const Surface &surface, const MagneticField *magField, TrajectoryStateOnSurface &tsos, AlgebraicMatrix &endDeriv)
void construct(const MagneticField *magField)
CLHEP::HepMatrix AlgebraicMatrix
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &plane) const
propagation to plane with path length
const AlgebraicMatrix55 & jacobian() const
TwoBodyDecayTrajectoryState(const TsosContainer &tsos, const TwoBodyDecay &tbd, double particleMass, const MagneticField *magField)
std::pair< TrajectoryStateOnSurface, TrajectoryStateOnSurface > TsosContainer
virtual const AlgebraicMatrix55 & jacobian() const
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
const AlgebraicMatrix56 & jacobian() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
const std::pair< AlgebraicVector, AlgebraicVector > cartesianSecondaryMomenta(const AlgebraicVector &param)