test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
KinematicPerigeeConversions.cc
Go to the documentation of this file.
3 
4 
7  const KinematicState& state, const GlobalPoint& point) const
8 {
9 //making an extended perigee parametrization
10 //out of kinematic state and point defined
11  AlgebraicVector6 res;
12  res(5) = state.mass();
13 // AlgebraicVector7 par = state.kinematicParameters().vector();
14  GlobalVector impactDistance = state.globalPosition() - point;
15  double theta = state.globalMomentum().theta();
16  double phi = state.globalMomentum().phi();
17  double pt = state.globalMomentum().transverse();
18 // double field = MagneticField::inGeVPerCentimeter(state.globalPosition()).z();
19  double field = state.magneticFieldInInverseGeV().z();
20 // double signTC = -state.particleCharge();
21 // double transverseCurvature = field/pt*signTC;
22 
23 //making a proper sign for epsilon
24 // FIXME use scalar product...
25  double positiveMomentumPhi = ((phi>0) ? phi : (2*M_PI + phi));
26  double positionPhi = impactDistance.phi();
27  double positivePositionPhi =
28  ( (positionPhi>0) ? positionPhi : (2*M_PI+positionPhi) );
29  double phiDiff = positiveMomentumPhi - positivePositionPhi;
30  if (phiDiff<0.0) phiDiff+= (2*M_PI);
31  double signEpsilon = ( (phiDiff > M_PI) ? -1.0 : 1.0);
32 
33  double epsilon = signEpsilon *
34  sqrt(impactDistance.x()*impactDistance.x() +
35  impactDistance.y()*impactDistance.y());
36 
37  double signTC = -state.particleCharge();
38  bool isCharged = (signTC!=0);
39 
40  if (isCharged) {
41  res(0) = field / pt*signTC;
42  } else {
43  res(0) = 1 / pt;
44  }
45 
46  res(1) = theta;
47  res(2) = phi;
48  res(3) = epsilon;
49  res(4) = impactDistance.z();
51 }
52 
55  const MagneticField* field) const
56 {
57  AlgebraicVector7 par;
58  AlgebraicVector6 theVector = pr.vector();
59  double pt;
60  if(pr.charge() !=0){
61  pt = std::abs(field->inInverseGeV(point).z() / theVector(1));
62  }else{pt = 1/theVector(1);}
63  par(6) = theVector[5];
64  par(0) = theVector[3]*sin(theVector[2])+point.x();
65  par(1) = -theVector[3]*cos(theVector[2])+point.y();
66  par(2) = theVector[4]+point.z();
67  par(3) = cos(theVector[2]) * pt;
68  par(4) = sin(theVector[2]) * pt;
69  par(5) = pt/tan(theVector[1]);
70 
71  return KinematicParameters(par);
72 }
73 
74 
77  const GlobalPoint& referencePoint, const TrackCharge& charge,
78  const AlgebraicSymMatrix77& theCovarianceMatrix, const MagneticField* field) const
79 {
80  AlgebraicMatrix77 param2cart = jacobianParameters2Kinematic(momentum,
81  referencePoint, charge, field);
82  AlgebraicSymMatrix77 kinematicErrorMatrix = ROOT::Math::Similarity(param2cart,theCovarianceMatrix);
83 // kinematicErrorMatrix.assign(param2cart*theCovarianceMatrix*param2cart.T());
84 
85  KinematicParametersError kinematicParamError(kinematicErrorMatrix);
86  AlgebraicVector7 par;
87  AlgebraicVector4 mm = momentumFromPerigee(momentum, referencePoint, charge, field);
88  par(0) = referencePoint.x();
89  par(1) = referencePoint.y();
90  par(2) = referencePoint.z();
91  par(3) = mm(0);
92  par(4) = mm(1);
93  par(5) = mm(2);
94  par(6) = mm(3);
95  KinematicParameters kPar(par);
96  return KinematicState(kPar, kinematicParamError, charge, field);
97 }
98 
100  const AlgebraicVector4& momentum, const GlobalPoint& referencePoint,
101  const TrackCharge& charge, const MagneticField* field)const
102 {
104  (AlgebraicVector3(momentum[0],momentum[1],momentum[2]),
105  referencePoint, charge, field);
106  AlgebraicMatrix77 frameTransJ;
107  for (int i =0;i<6;++i)
108  for (int j =0;j<6;++j)
109  frameTransJ(i, j) = param2cart(i, j);
110  frameTransJ(6, 6) = 1;
111 
112 // double factor = 1;
113 // if (charge != 0){
114 // double field = TrackingTools::FakeField::Field::inGeVPerCentimeter(referencePoint).z();
115 // factor = -field*charge;
116 // }
117 // AlgebraicMatrix frameTransJ(7, 7, 0);
118 // frameTransJ[0][0] = 1;
119 // frameTransJ[1][1] = 1;
120 // frameTransJ[2][2] = 1;
121 // frameTransJ[6][6] = 1;
122 // frameTransJ[3][3] = - factor * cos(momentum[2]) / (momentum[0]*momentum[0]);
123 // frameTransJ[4][3] = - factor * sin(momentum[2]) / (momentum[0]*momentum[0]);
124 // frameTransJ[5][3] = - factor / tan(momentum[1]) / (momentum[0]*momentum[0]);
125 //
126 // frameTransJ[3][5] = - factor * sin(momentum[1]) / (momentum[0]);
127 // frameTransJ[4][5] = factor * cos(momentum[1]) / (momentum[0]);
128 // frameTransJ[5][4] = -factor/ (momentum[0]*sin(momentum[1])*sin(momentum[1]));
129 
130  return frameTransJ;
131 
132 }
133 
134 // Cartesian (px,py,px,m) from extended perigee
137  const GlobalPoint& referencePoint, const TrackCharge& ch,
138  const MagneticField* field)const
139 {
140  AlgebraicVector4 mm;
141  double pt;
142  if(ch !=0){
143 // pt = abs(MagneticField::inGeVPerCentimeter(referencePoint).z() / momentum[0]);
144  pt = std::abs(field->inInverseGeV(referencePoint).z() / momentum[0]);
145  }else{pt = 1/ momentum[0];}
146  mm(0) = cos(momentum[2]) * pt;
147  mm(1) = sin(momentum[2]) * pt;
148  mm(2) = pt/tan(momentum[1]);
149  mm(3) = momentum[3];
150  return mm;
151 }
152 
int i
Definition: DBlmapReader.cc:9
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:63
GlobalVector globalMomentum() const
ROOT::Math::SVector< double, 6 > AlgebraicVector6
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
ParticleMass mass() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T transverse() const
Definition: PV3DBase.h:73
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
Definition: Matrices.h:9
int TrackCharge
Definition: TrackCharge.h:4
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:39
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
AlgebraicMatrix66 jacobianParameters2Cartesian(const AlgebraicVector3 &momentum, const GlobalPoint &position, const TrackCharge &charge, const MagneticField *field)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
KinematicState kinematicState(const AlgebraicVector4 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const AlgebraicSymMatrix77 &theCovarianceMatrix, const MagneticField *field) const
AlgebraicVector4 momentumFromPerigee(const AlgebraicVector4 &momentum, const GlobalPoint &referencePoint, const TrackCharge &ch, const MagneticField *field) const
#define M_PI
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepStd< double, 7, 7 > > AlgebraicMatrix77
Definition: Matrices.h:10
ExtendedPerigeeTrajectoryParameters extendedPerigeeFromKinematicParameters(const KinematicState &state, const GlobalPoint &point) const
KinematicParameters kinematicParametersFromExPerigee(const ExtendedPerigeeTrajectoryParameters &pr, const GlobalPoint &point, const MagneticField *field) const
TrackCharge particleCharge() const
AlgebraicMatrix77 jacobianParameters2Kinematic(const AlgebraicVector4 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const MagneticField *field) const
ROOT::Math::SVector< double, 4 > AlgebraicVector4
T x() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() 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