CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexKinematicConstraintT.cc
Go to the documentation of this file.
4 
6 {}
7 
9 {}
10 
11 
12 void VertexKinematicConstraintT::init(const std::vector<KinematicState>& states,
13  const GlobalPoint& ipoint, const GlobalVector& fieldValue) {
14  int num = states.size();
15  if(num!=2) throw VertexException("VertexKinematicConstraintT !=2 states passed");
16  double mfz = fieldValue.z();
17 
18  int j=0;
19  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
20  {
21  mom[j] = i->globalMomentum();
22  dpos[j] = ipoint - i->globalPosition();
23  a_i[j] = - i->particleCharge() * mfz;
24 
25  double pvx = mom[j].x() - a_i[j]*dpos[j].y();
26  double pvy = mom[j].y() + a_i[j]*dpos[j].x();
27  double pvt2 = pvx*pvx+pvy*pvy;
28  novera[j] = (dpos[j].x() * mom[j].x() + dpos[j].y()*mom[j].y());
29  n[j] = a_i[j]*novera[j];
30  m[j] = (pvx*mom[j].x() + pvy*mom[j].y());
31  k[j] = -mom[j].z()/(mom[j].perp2()*pvt2);
32  delta[j] = std::atan2(n[j],m[j]);
33 
34  ++j;
35  }
36 }
37 
38 
39 
41 {
42  //it is 2 equations per track
43  for(int j = 0; j!=2; ++j) {
44 
45  if(a_i[j] !=0) {
46  //vector of values
47  super::vl(j*2) = dpos[j].y()*mom[j].x() - dpos[j].x()*mom[j].y() -a_i[j]*(dpos[j].x()*dpos[j].x() + dpos[j].y()*dpos[j].y())*0.5;
48  super::vl(j*2 +1) = dpos[j].z() - mom[j].z()*delta[j]/a_i[j];
49  }else{
50  //neutral particle
51  double pt2Inverse = 1./mom[j].perp2();
52  super::vl(j*2) = dpos[j].y()*mom[j].x() - dpos[j].x()*mom[j].y();
53  super::vl(j*2 +1) = dpos[j].z() - mom[j].z()*(dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y())*pt2Inverse;
54  }
55  }
56 }
57 
59  ROOT::Math::SMatrix<double,2,7> el_part_d;
60  for(int j = 0; j!=2; ++j) {
61 
62  if(a_i[j] !=0) {
63 
64  //charged particle
65 
66  //D Jacobian matrix
67  el_part_d(0,0) = mom[j].y() + a_i[j]*dpos[j].x();
68  el_part_d(0,1) = -mom[j].x() + a_i[j]*dpos[j].y();
69  el_part_d(1,0) = -k[j]*(m[j]*mom[j].x() - n[j]*mom[j].y());
70  el_part_d(1,1) = -k[j]*(m[j]*mom[j].y() + n[j]*mom[j].x());
71  el_part_d(1,2) = -1.;
72  el_part_d(0,3) = dpos[j].y();
73  el_part_d(0,4) = -dpos[j].x();
74  el_part_d(1,3) = k[j]*(m[j]*dpos[j].x() - novera[j]*(2*mom[j].x() - a_i[j]*dpos[j].y()));
75  el_part_d(1,4) = k[j]*(m[j]*dpos[j].y() - novera[j]*(2*mom[j].y() + a_i[j]*dpos[j].x()));
76  el_part_d(1,5) = -delta[j] /a_i[j];
77  super::jac_d().Place_at(el_part_d,j*2, j*7);
78  }else{
79  //neutral particle
80  double pt2Inverse = 1./mom[j].perp2();
81  el_part_d(0,0) = mom[j].y();
82  el_part_d(0,1) = -mom[j].x();
83  el_part_d(1,0) = mom[j].x() * (mom[j].z()*pt2Inverse);
84  el_part_d(1,1) = mom[j].y() * (mom[j].z()*pt2Inverse);
85  el_part_d(1,2) = -1.;
86  el_part_d(0,3) = dpos[j].y();
87  el_part_d(0,4) = -dpos[j].x();
88  el_part_d(1,3) = 2*(dpos[j].x()*mom[j].x()+dpos[j].y()*mom[j].y())*pt2Inverse*mom[j].x()*(mom[j].z()*pt2Inverse) - dpos[j].x()*(mom[j].z()*pt2Inverse);
89  el_part_d(1,4) = 2*(dpos[j].x()*mom[j].x()+dpos[j].y()*mom[j].y())*pt2Inverse*mom[j].y()*(mom[j].z()*pt2Inverse) - dpos[j].x()*(mom[j].z()*pt2Inverse);
90  el_part_d(1,5) = - (dpos[j].x()*mom[j].x()+dpos[j].y()*mom[j].y())*pt2Inverse;
91  super::jac_d().Place_at(el_part_d,j*2, j*7);
92  }
93  }
94 }
95 
97 
98  ROOT::Math::SMatrix<double,2,3> el_part_e;
99  for(int j = 0; j!=2; ++j) {
100 
101  if(a_i[j] !=0) {
102 
103  //charged particle
104 
105  //E jacobian matrix
106  el_part_e(0,0) = -(mom[j].y() + a_i[j]*dpos[j].x());
107  el_part_e(0,1) = mom[j].x() - a_i[j]*dpos[j].y();
108  el_part_e(1,0) = k[j]*(m[j]*mom[j].x() - n[j]*mom[j].y());
109  el_part_e(1,1) = k[j]*(m[j]*mom[j].y() + n[j]*mom[j].x());
110  el_part_e(1,2) = 1;
111  super::jac_e().Place_at(el_part_e,2*j,0);
112  }else{
113  //neutral particle
114  double pt2Inverse = 1./mom[j].perp2();
115  el_part_e(0,0) = - mom[j].y();
116  el_part_e(0,1) = mom[j].x();
117  el_part_e(1,0) = -mom[j].x()*mom[j].z()*pt2Inverse;
118  el_part_e(1,1) = -mom[j].y()*mom[j].z()*pt2Inverse;
119  el_part_e(1,2) = 1;
120  super::jac_e().Place_at(el_part_e,2*j,0);
121  }
122  }
123 }
124 
126 {return 2;}
int i
Definition: DBlmapReader.cc:9
Common base class.
T y() const
Definition: PV3DBase.h:63
T perp2() const
Definition: PV3DBase.h:71
T z() const
Definition: PV3DBase.h:64
int j
Definition: DBlmapReader.cc:9
virtual void fillParametersDerivative() const
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
virtual void fillPositionDerivative() const
virtual void init(const std::vector< KinematicState > &states, const GlobalPoint &point, const GlobalVector &mf)