CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TwoTrackMassKinematicConstraint.cc
Go to the documentation of this file.
3 
4 
5 AlgebraicVector TwoTrackMassKinematicConstraint::value(const std::vector<KinematicState> &states,
6  const GlobalPoint& point) const
7 {
8  if(states.size()<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
9 
10  AlgebraicVector res(1,0);
11 
12  double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
13  double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
14 
15  AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
16  AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
17 
18  double p1vx = p1(3) - a_1*(point.y() - p1(1));
19  double p1vy = p1(4) + a_1*(point.x() - p1(0));
20  double p1vz = p1(5);
21  ParticleMass m1 = p1(6);
22 
23  double p2vx = p2(3) - a_2*(point.y() - p2(1));
24  double p2vy = p2(4) + a_2*(point.x() - p2(0));
25  double p2vz = p2(5);
26  ParticleMass m2 = p2(6);
27 
28  double j_energy = sqrt(p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5)+m1*m1)+
29  sqrt(p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5)+m2*m2) ;
30 
31 
32  double j_m = (p1vx+p2vx)*(p1vx+p2vx) + (p1vy+p2vy)*(p1vy+p2vy) +
33  (p1vz+p2vz)*(p1vz+p2vz);
34 
35  res(1) = j_energy*j_energy - j_m - mass*mass;
36  return res;
37 }
38 
40  const GlobalPoint& point) const
41 {
42  int n_st = states.size();
43  if(n_st<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
44 
45  AlgebraicMatrix res(1,n_st*7,0);
46 
47  double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
48  double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
49 
50  AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
51  AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
52 
53  double p1vx = p1(3) - a_1*(point.y() - p1(1));
54  double p1vy = p1(4) + a_1*(point.x() - p1(0));
55  double p1vz = p1(5);
56  ParticleMass m1 = p1(6);
57 
58  double p2vx = p2(3) - a_2*(point.y() - p2(1));
59  double p2vy = p2(4) + a_2*(point.x() - p2(0));
60  double p2vz = p2(5);
61  ParticleMass m2 = p2(6);
62 
63  double e1 = sqrt(p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5)+m1*m1);
64  double e2 = sqrt(p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5)+m2*m2);
65 
66 
67 //x1 and x2 derivatives: 1st and 8th elements
68  res(1,1) = 2*a_1*(p2vy + p1vy);
69  res(1,8) = 2*a_2*(p2vy + p1vy);
70 
71 //y1 and y2 derivatives: 2nd and 9th elements:
72  res(1,2) = -2*a_1*(p1vx + p2vx);
73  res(1,9) = -2*a_2*(p2vx + p1vx);
74 
75 //z1 and z2 components: 3d and 10th elmnets stay 0:
76  res(1,3) = 0.;
77  res(1,10) = 0.;
78 
79 //px1 and px2 components: 4th and 11th elements:
80  res(1,4) = 2*(1+e2/e1)*p1(3) - 2*(p1vx + p2vx);
81  res(1,11) = 2*(1+e1/e2)*p2(3) - 2*(p1vx + p2vx);
82 
83 //py1 and py2 components: 5th and 12 elements:
84  res(1,5) = 2*(1+e2/e1)*p1(4) - 2*(p1vy + p2vy);
85  res(1,12) = 2*(1+e1/e2)*p2(4) - 2*(p2vy + p1vy);
86 
87 //pz1 and pz2 components: 6th and 13 elements:
88  res(1,6) = 2*(1+e2/e1)*p1(5)- 2*(p1vz + p2vz);
89  res(1,13) = 2*(1+e1/e2)*p2(5)- 2*(p2vz + p1vz);
90 
91 //mass components: 7th and 14th elements:
92  res(1,7) = 2*m1*(1+e2/e1);
93  res(1,14) = 2*m2*(1+e1/e2);
94 
95  return res;
96 }
97 
98 AlgebraicMatrix TwoTrackMassKinematicConstraint::positionDerivative(const std::vector<KinematicState> &states,
99  const GlobalPoint& point) const
100 {
101  AlgebraicMatrix res(1,3,0);
102  if(states.size()<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
103 
104  double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
105  double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
106 
107  AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
108  AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
109 
110  double p1vx = p1(3) - a_1*(point.y() - p1(1));
111  double p1vy = p1(4) + a_1*(point.x() - p1(0));
112 
113  double p2vx = p2(3) - a_2*(point.y() - p2(1));
114  double p2vy = p2(4) + a_2*(point.x() - p2(0));
115 
116 //xv component
117  res(1,1) = -2*(p1vy + p2vy)*(a_1+a_2);
118 
119 //yv component
120  res(1,2) = 2*(p1vx + p2vx)*(a_1+a_2);
121 
122 //zv component
123  res(1,3) = 0.;
124 
125  return res;
126 }
127 
129 {return 1;}
Common base class.
double ParticleMass
Definition: ParticleMass.h:5
T y() const
Definition: PV3DBase.h:63
virtual AlgebraicMatrix positionDerivative(const std::vector< KinematicState > &states, const GlobalPoint &point) const
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:15
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:48
virtual AlgebraicVector value(const std::vector< KinematicState > &states, const GlobalPoint &point) const
double p2[4]
Definition: TauolaWrapper.h:90
virtual AlgebraicMatrix parametersDerivative(const std::vector< KinematicState > &states, const GlobalPoint &point) const
CLHEP::HepVector AlgebraicVector
double p1[4]
Definition: TauolaWrapper.h:89
T x() const
Definition: PV3DBase.h:62
*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