CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiTrackVertexLinkKinematicConstraint.cc
Go to the documentation of this file.
3 
4 AlgebraicVector MultiTrackVertexLinkKinematicConstraint::value(const std::vector<KinematicState> &states, const GlobalPoint& point) const{
5  int num = states.size();
6  if(num<2) throw VertexException("MultiTrackVertexLinkKinematicConstraint::value <2 states passed");
7 
8  //2 equations (for all tracks)
9  AlgebraicVector vl(2,0);
10  double dx = point.x() - refPoint.x();
11  double dy = point.y() - refPoint.y();
12  double dz = point.z() - refPoint.z();
13  double dT = sqrt(pow(dx,2) + pow(dy,2));
14  double ds = sqrt(pow(dx,2) + pow(dy,2) + pow(dz,2));
15 
16  double pxSum=0, pySum=0, pzSum=0;
17  double aSum = 0;
18  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
19  {
20  double a = - i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
21  aSum += a;
22 
23  pxSum += i->kinematicParameters()(3) - a*(point.y() - i->kinematicParameters()(1));
24  pySum += i->kinematicParameters()(4) + a*(point.x() - i->kinematicParameters()(0));
25  pzSum += i->kinematicParameters()(5);
26  }
27 
28  double pT = sqrt(pow(pxSum,2) + pow(pySum,2));
29  double pSum = sqrt(pow(pxSum,2) + pow(pySum,2) + pow(pzSum,2));
30 
31  vl(1) = (dT - dx)/dy + (-2*pT + sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2)))/(aSum*dT) + (-pT + pxSum)/pySum;
32  vl(2) = (ds - dT)/dz + (pT - pSum)/pzSum;
33 
34  return vl;
35 }
36 
38  int num = states.size();
39  if(num<2) throw VertexException("MultiTrackVertexLinkKinematicConstraint::parametersDerivative <2 states passed");
40 
41  //2 equations (for all tracks)
42  AlgebraicMatrix matrix(2,num*7,0);//AlgebraicMatrix starts from 1
43  double dx = point.x() - refPoint.x();
44  double dy = point.y() - refPoint.y();
45  double dT = sqrt(pow(dx,2) + pow(dy,2));
46 
47  double pxSum=0, pySum=0, pzSum=0;
48  double aSum = 0;
49  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
50  {
51  double a = - i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
52  aSum += a;
53 
54  pxSum += i->kinematicParameters()(3) - a*(point.y() - i->kinematicParameters()(1));
55  pySum += i->kinematicParameters()(4) + a*(point.x() - i->kinematicParameters()(0));
56  pzSum += i->kinematicParameters()(5);
57  }
58 
59  double pT = sqrt(pow(pxSum,2) + pow(pySum,2));
60  double pSum = sqrt(pow(pxSum,2) + pow(pySum,2) + pow(pzSum,2));
61 
62  int col=0;
63  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++){
64  double a = - i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
65 
66  matrix(1,1+col*7) = a*(-(pT/pow(pySum,2)) + pxSum/pow(pySum,2) - (4*pySum)/(aSum*dT*sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2))) + (1 + (2*pySum)/(aSum*dT))/pT);//dH/dx
67  matrix(1,2+col*7) = (a*(aSum*dT*(pT - pxSum) + 2*(-1 + (2*pT)/sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2)))*pxSum*pySum))/(aSum*dT*pT*pySum);//dH/dy
68  //dH/dz=0
69  matrix(1,4+col*7) = (aSum*dT*(pT - pxSum) + 2*(-1 + (2*pT)/sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2)))*pxSum*pySum)/(aSum*dT*pT*pySum);//dH/dpx
70  matrix(1,5+col*7) = pT/pow(pySum,2) - pxSum/pow(pySum,2) + (4*pySum)/(aSum*dT*sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2))) + (-1 - (2*pySum)/(aSum*dT))/pT;//dH/dpy
71  //dH/dpz=0
72  //dH/dm=0
73  matrix(2,1+col*7) = (a*(-pSum + pT)*pySum)/(pSum*pT*pzSum);//dH/dx
74  matrix(2,2+col*7) = (a*( pSum - pT)*pxSum)/(pSum*pT*pzSum);//dH/dy
75  //dH/dz
76  matrix(2,4+col*7) = ((-(1/pSum) + 1/pT)*pxSum)/pzSum;//dH/dpx
77  matrix(2,5+col*7) = ((-(1/pSum) + 1/pT)*pySum)/pzSum;//dH/dpy
78  matrix(2,6+col*7) = -(1/pSum) + (pSum - pT)/pow(pzSum,2);//dH/dpz
79  //dH/dm=0
80 
81  col++;
82  }
83 
84  return matrix;
85 }
86 
87 AlgebraicMatrix MultiTrackVertexLinkKinematicConstraint::positionDerivative(const std::vector<KinematicState> &states, const GlobalPoint& point) const{
88  int num = states.size();
89  if(num<2) throw VertexException("MultiTrackVertexLinkKinematicConstraint::positionDerivative <2 states passed");
90 
91  //2 equations (for all tracks)
92  AlgebraicMatrix matrix(2,3,0);
93  double dx = point.x() - refPoint.x();
94  double dy = point.y() - refPoint.y();
95  double dz = point.z() - refPoint.z();
96  double dT = sqrt(pow(dx,2) + pow(dy,2));
97  double ds = sqrt(pow(dx,2) + pow(dy,2) + pow(dz,2));
98 
99  double pxSum=0, pySum=0, pzSum=0, aSum = 0;
100  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++){
101  double a = - i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
102  aSum += a;
103 
104  pxSum += i->kinematicParameters()(3) - a*(point.y() - i->kinematicParameters()(1));
105  pySum += i->kinematicParameters()(4) + a*(point.x() - i->kinematicParameters()(0));
106  pzSum += i->kinematicParameters()(5);
107  }
108  double pT = sqrt(pow(pxSum,2) + pow(pySum,2));
109  double pSum = sqrt(pow(pxSum,2) + pow(pySum,2) + pow(pzSum,2));
110 
111  matrix(1,1) = (-1 + dx/dT)/dy + (2*dx*pT*(1 - (2*pT)/sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2))))/(aSum*pow(dT,3)) + aSum*(-(1/pT) + pT/pow(pySum,2) - pxSum/pow(pySum,2)) + (2*(-(1/pT) + 2/sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2)))*pySum)/dT;//dH/dxv
112  matrix(1,2) = 1/dT + (-dT + dx)/pow(dy,2) - (dy*(-2*pT + sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2))))/(aSum*pow(dT,3)) - ((-2 + sqrt(4 - (pow(aSum,2)*pow(dT,2))/pow(pT,2)))*pxSum)/(dT*pT) - (aSum*(dy*pow(pT,2) + aSum*pow(dT,2)*pxSum))/(dT*pow(pT,2)*sqrt(-(pow(aSum,2)*pow(dT,2)) + 4*pow(pT,2))) + (aSum*(-pT + pxSum))/(pT*pySum);//dH/dyv
113  //dH/dzv=0
114  matrix(2,1) = ((1/ds - 1/dT)*dx)/dz + (aSum*(pSum - pT)*pySum)/(pSum*pT*pzSum);//dH/dxv
115  matrix(2,2) = ((1/ds - 1/dT)*dy)/dz - (aSum*(pSum - pT)*pxSum)/(pSum*pT*pzSum);//dH/dyv
116  matrix(2,3) = 1/ds + (-ds + dT)/pow(dz,2);//dH/dzv
117 
118  return matrix;
119 }
120 
122  return 2;
123 }
int i
Definition: DBlmapReader.cc:9
Common base class.
T y() const
Definition: PV3DBase.h:63
virtual AlgebraicMatrix parametersDerivative(const std::vector< KinematicState > &states, const GlobalPoint &point) const
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
CLHEP::HepVector AlgebraicVector
virtual AlgebraicVector value(const std::vector< KinematicState > &states, const GlobalPoint &point) const
double a
Definition: hdecay.h:121
int col
Definition: cuy.py:1008
T x() const
Definition: PV3DBase.h:62
virtual AlgebraicMatrix positionDerivative(const std::vector< KinematicState > &states, const GlobalPoint &point) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
*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