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.magneticField()->inInverseGeV(state.globalPosition()).z();
20 // double signTC = -state.particleCharge();
21 // double transverseCurvature = field/pt*signTC;
22 
23 //making a proper sign for epsilon
24  double positiveMomentumPhi = ((phi>0) ? phi : (2*M_PI + phi));
25  double positionPhi = impactDistance.phi();
26  double positivePositionPhi =
27  ( (positionPhi>0) ? positionPhi : (2*M_PI+positionPhi) );
28  double phiDiff = positiveMomentumPhi - positivePositionPhi;
29  if (phiDiff<0.0) phiDiff+= (2*M_PI);
30  double signEpsilon = ( (phiDiff > M_PI) ? -1.0 : 1.0);
31 
32  double epsilon = signEpsilon *
33  sqrt(impactDistance.x()*impactDistance.x() +
34  impactDistance.y()*impactDistance.y());
35 
36  double signTC = -state.particleCharge();
37  bool isCharged = (signTC!=0);
38 
39  if (isCharged) {
40  res(0) = field / pt*signTC;
41  } else {
42  res(0) = 1 / pt;
43  }
44 
45  res(1) = theta;
46  res(2) = phi;
47  res(3) = epsilon;
48  res(4) = impactDistance.z();
50 }
51 
54  const MagneticField* field) const
55 {
56  AlgebraicVector7 par;
57  AlgebraicVector6 theVector = pr.vector();
58  double pt;
59  if(pr.charge() !=0){
60  pt = std::abs(field->inInverseGeV(point).z() / theVector(1));
61  }else{pt = 1/theVector(1);}
62  par(6) = theVector[5];
63  par(0) = theVector[3]*sin(theVector[2])+point.x();
64  par(1) = -theVector[3]*cos(theVector[2])+point.y();
65  par(2) = theVector[4]+point.z();
66  par(3) = cos(theVector[2]) * pt;
67  par(4) = sin(theVector[2]) * pt;
68  par(5) = pt/tan(theVector[1]);
69 
70  return KinematicParameters(par);
71 }
72 
73 
76  const GlobalPoint& referencePoint, const TrackCharge& charge,
77  const AlgebraicSymMatrix77& theCovarianceMatrix, const MagneticField* field) const
78 {
79  AlgebraicMatrix77 param2cart = jacobianParameters2Kinematic(momentum,
80  referencePoint, charge, field);
81  AlgebraicSymMatrix77 kinematicErrorMatrix = ROOT::Math::Similarity(param2cart,theCovarianceMatrix);
82 // kinematicErrorMatrix.assign(param2cart*theCovarianceMatrix*param2cart.T());
83 
84  KinematicParametersError kinematicParamError(kinematicErrorMatrix);
85  AlgebraicVector7 par;
86  AlgebraicVector4 mm = momentumFromPerigee(momentum, referencePoint, charge, field);
87  par(0) = referencePoint.x();
88  par(1) = referencePoint.y();
89  par(2) = referencePoint.z();
90  par(3) = mm(0);
91  par(4) = mm(1);
92  par(5) = mm(2);
93  par(6) = mm(3);
94  KinematicParameters kPar(par);
95  return KinematicState(kPar, kinematicParamError, charge, field);
96 }
97 
99  const AlgebraicVector4& momentum, const GlobalPoint& referencePoint,
100  const TrackCharge& charge, const MagneticField* field)const
101 {
103  (AlgebraicVector3(momentum[0],momentum[1],momentum[2]),
104  referencePoint, charge, field);
105  AlgebraicMatrix77 frameTransJ;
106  for (int i =0;i<6;++i)
107  for (int j =0;j<6;++j)
108  frameTransJ(i, j) = param2cart(i, j);
109  frameTransJ(6, 6) = 1;
110 
111 // double factor = 1;
112 // if (charge != 0){
113 // double field = TrackingTools::FakeField::Field::inGeVPerCentimeter(referencePoint).z();
114 // factor = -field*charge;
115 // }
116 // AlgebraicMatrix frameTransJ(7, 7, 0);
117 // frameTransJ[0][0] = 1;
118 // frameTransJ[1][1] = 1;
119 // frameTransJ[2][2] = 1;
120 // frameTransJ[6][6] = 1;
121 // frameTransJ[3][3] = - factor * cos(momentum[2]) / (momentum[0]*momentum[0]);
122 // frameTransJ[4][3] = - factor * sin(momentum[2]) / (momentum[0]*momentum[0]);
123 // frameTransJ[5][3] = - factor / tan(momentum[1]) / (momentum[0]*momentum[0]);
124 //
125 // frameTransJ[3][5] = - factor * sin(momentum[1]) / (momentum[0]);
126 // frameTransJ[4][5] = factor * cos(momentum[1]) / (momentum[0]);
127 // frameTransJ[5][4] = -factor/ (momentum[0]*sin(momentum[1])*sin(momentum[1]));
128 
129  return frameTransJ;
130 
131 }
132 
133 // Cartesian (px,py,px,m) from extended perigee
136  const GlobalPoint& referencePoint, const TrackCharge& ch,
137  const MagneticField* field)const
138 {
139  AlgebraicVector4 mm;
140  double pt;
141  if(ch !=0){
142 // pt = abs(MagneticField::inGeVPerCentimeter(referencePoint).z() / momentum[0]);
143  pt = std::abs(field->inInverseGeV(referencePoint).z() / momentum[0]);
144  }else{pt = 1/ momentum[0];}
145  mm(0) = cos(momentum[2]) * pt;
146  mm(1) = sin(momentum[2]) * pt;
147  mm(2) = pt/tan(momentum[1]);
148  mm(3) = momentum[3];
149  return mm;
150 }
151 
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
#define abs(x)
Definition: mlp_lapack.h:159
GlobalVector globalMomentum() const
double charge(const std::vector< uint8_t > &Ampls)
ROOT::Math::SVector< double, 6 > AlgebraicVector6
float float float z
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:8
int TrackCharge
Definition: TrackCharge.h:4
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:40
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:7
T sqrt(T t)
Definition: SSEVec.h:48
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
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
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepStd< double, 7, 7 > > AlgebraicMatrix77
Definition: Matrices.h:9
const MagneticField * magneticField() const
ExtendedPerigeeTrajectoryParameters extendedPerigeeFromKinematicParameters(const KinematicState &state, const GlobalPoint &point) const
#define M_PI
Definition: BFit3D.cc:3
KinematicParameters kinematicParametersFromExPerigee(const ExtendedPerigeeTrajectoryParameters &pr, const GlobalPoint &point, const MagneticField *field) const
char state
Definition: procUtils.cc:75
TrackCharge particleCharge() const
AlgebraicMatrix77 jacobianParameters2Kinematic(const AlgebraicVector4 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const MagneticField *field) const
const double epsilon
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
Definition: DDAxes.h:10