CMS 3D CMS Logo

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