![]() |
![]() |
#include <RecoVertex/KinematicFit/interface/TwoTrackMassKinematicConstraint.h>
Public Member Functions | |
virtual TwoTrackMassKinematicConstraint * | clone () const |
virtual int | numberOfEquations () const |
Number of equations per track used for the fit. | |
virtual AlgebraicMatrix | parametersDerivative (const vector< KinematicState > states, const GlobalPoint &point) const |
Returns a matrix of derivatives of constraint equations w.r.t. | |
virtual AlgebraicMatrix | positionDerivative (const vector< KinematicState > states, const GlobalPoint &point) const |
Returns a matrix of derivatives of constraint equations w.r.t. | |
TwoTrackMassKinematicConstraint (ParticleMass &ms) | |
virtual AlgebraicVector | value (const vector< KinematicState > states, const GlobalPoint &point) const |
Returns a vector of values of constraint equations at the point where the input particles are defined. | |
Private Attributes | |
ParticleMass | mass |
I.e. 2 first particles out of four passed form a given mass
Warning: the tracks to constraint should be 1st and 2nd from the beginning of the vector.
Definition at line 21 of file TwoTrackMassKinematicConstraint.h.
TwoTrackMassKinematicConstraint::TwoTrackMassKinematicConstraint | ( | ParticleMass & | ms | ) | [inline] |
Definition at line 24 of file TwoTrackMassKinematicConstraint.h.
Referenced by clone().
00024 :mass(ms) 00025 {}
virtual TwoTrackMassKinematicConstraint* TwoTrackMassKinematicConstraint::clone | ( | void | ) | const [inline, virtual] |
Implements MultiTrackKinematicConstraint.
Definition at line 58 of file TwoTrackMassKinematicConstraint.h.
References TwoTrackMassKinematicConstraint().
00059 {return new TwoTrackMassKinematicConstraint(*this);}
int TwoTrackMassKinematicConstraint::numberOfEquations | ( | ) | const [virtual] |
Number of equations per track used for the fit.
Implements MultiTrackKinematicConstraint.
Definition at line 157 of file TwoTrackMassKinematicConstraint.cc.
AlgebraicMatrix TwoTrackMassKinematicConstraint::parametersDerivative | ( | const vector< KinematicState > | states, | |
const GlobalPoint & | point | |||
) | const [virtual] |
Returns a matrix of derivatives of constraint equations w.r.t.
particle parameters
Implements MultiTrackKinematicConstraint.
Definition at line 48 of file TwoTrackMassKinematicConstraint.cc.
References e1, e2, m1, p1, p2, res, funct::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
00050 { 00051 int n_st = states.size(); 00052 if(n_st<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed"); 00053 if(states[0].particleCharge()==0. || states[1].particleCharge()==0) 00054 throw VertexException("TwoTrackMassKinematicConstraint:: 0 charge states passed"); 00055 AlgebraicMatrix res(1,n_st*7,0); 00056 00057 vector<KinematicState>::const_iterator i_st = states.begin(); 00058 KinematicState p_1 = *i_st; 00059 i_st++; 00060 KinematicState p_2 = *i_st; 00061 TrackCharge ch1 = states[0].particleCharge(); 00062 TrackCharge ch2 = states[1].particleCharge(); 00063 00064 double field1 = states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z(); 00065 double a_1 = -0.29979246*ch1*field1; 00066 double field2 = states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z(); 00067 double a_2 = -0.29979246*ch2*field2; 00068 00069 AlgebraicVector7 p1 = states[0].kinematicParameters().vector(); 00070 AlgebraicVector7 p2 = states[1].kinematicParameters().vector(); 00071 00072 double p1vx = p1(3) - a_1*(point.y() - p1(1)); 00073 double p1vy = p1(4) + a_1*(point.x() - p1(0)); 00074 double p1vz = p1(5); 00075 ParticleMass m1 = p1(6); 00076 00077 double p2vx = p2(3) - a_2*(point.y() - p2(1)); 00078 double p2vy = p2(4) + a_2*(point.x() - p2(0)); 00079 double p2vz = p2(5); 00080 ParticleMass m2 = p2(6); 00081 00082 double e1 = sqrt(p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5)+m1*m1); 00083 double e2 = sqrt(p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5)+m2*m2); 00084 00085 00086 //x1 and x2 derivatives: 1st and 8th elements 00087 res(1,1) = 2*a_1*(p2vy + p1vy); 00088 res(1,8) = 2*a_2*(p2vy + p1vy); 00089 00090 //y1 and y2 derivatives: 2nd and 9th elements: 00091 res(1,2) = -2*a_1*(p1vx + p2vx); 00092 res(1,9) = -2*a_2*(p2vx + p1vx); 00093 00094 //z1 and z2 components: 3d and 10th elmnets stay 0: 00095 res(1,3) = 0.; 00096 res(1,10) = 0.; 00097 00098 //px1 and px2 components: 4th and 11th elements: 00099 res(1,4) = 2*(1+e2/e1)*p1(3) - 2*(p1vx + p2vx); 00100 res(1,11) = 2*(1+e1/e2)*p2(3) - 2*(p1vx + p2vx); 00101 00102 //py1 and py2 components: 5th and 12 elements: 00103 res(1,5) = 2*(1+e2/e1)*p1(4) - 2*(p1vy + p2vy); 00104 res(1,12) = 2*(1+e1/e2)*p2(4) - 2*(p2vy + p1vy); 00105 00106 //pz1 and pz2 components: 6th and 13 elements: 00107 res(1,6) = 2*(1+e2/e1)*p1(5)- 2*(p1vz + p2vz); 00108 res(1,13) = 2*(1+e1/e2)*p2(5)- 2*(p2vz + p1vz); 00109 00110 //mass components: 7th and 14th elements: 00111 res(1,7) = 2*m1*(1+e2/e1); 00112 res(1,14) = 2*m2*(1+e1/e2); 00113 00114 return res; 00115 }
AlgebraicMatrix TwoTrackMassKinematicConstraint::positionDerivative | ( | const vector< KinematicState > | states, | |
const GlobalPoint & | point | |||
) | const [virtual] |
Returns a matrix of derivatives of constraint equations w.r.t.
vertex position
Implements MultiTrackKinematicConstraint.
Definition at line 117 of file TwoTrackMassKinematicConstraint.cc.
References p1, p2, res, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
00119 { 00120 AlgebraicMatrix res(1,3,0); 00121 if(states.size()<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed"); 00122 if(states[0].particleCharge() ==0. || states[1].particleCharge() ==0) 00123 throw VertexException("TwoTrackMassKinematicConstraint:: 0 charge states passed"); 00124 vector<KinematicState>::const_iterator i_st = states.begin(); 00125 KinematicState p_1 = *i_st; 00126 i_st++; 00127 KinematicState p_2 = *i_st; 00128 TrackCharge ch1 = states[0].particleCharge(); 00129 TrackCharge ch2 = states[1].particleCharge(); 00130 00131 double field1 = states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z(); 00132 double a_1 = -0.29979246*ch1*field1; 00133 double field2 = states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z(); 00134 double a_2 = -0.29979246*ch2*field2; 00135 00136 AlgebraicVector7 p1 = states[0].kinematicParameters().vector(); 00137 AlgebraicVector7 p2 = states[1].kinematicParameters().vector(); 00138 00139 double p1vx = p1(3) - a_1*(point.y() - p1(1)); 00140 double p1vy = p1(4) + a_1*(point.x() - p1(0)); 00141 00142 double p2vx = p2(3) - a_2*(point.y() - p2(1)); 00143 double p2vy = p2(4) + a_2*(point.x() - p2(0)); 00144 00145 //xv component 00146 res(1,1) = -2*(p1vy + p2vy)*(a_1+a_2); 00147 00148 //yv component 00149 res(1,2) = 2*(p1vx + p2vx)*(a_1+a_2); 00150 00151 //zv component 00152 res(1,3) = 0.; 00153 00154 return res; 00155 }
AlgebraicVector TwoTrackMassKinematicConstraint::value | ( | const vector< KinematicState > | states, | |
const GlobalPoint & | point | |||
) | const [virtual] |
Returns a vector of values of constraint equations at the point where the input particles are defined.
Implements MultiTrackKinematicConstraint.
Definition at line 5 of file TwoTrackMassKinematicConstraint.cc.
References m1, mass, p1, p2, res, funct::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
00007 { 00008 if(states.size()<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed"); 00009 if(states[0].particleCharge() ==0. || states[1].particleCharge()==0) 00010 throw VertexException("TwoTrackMassKinematicConstraint:: 0 charge states passed"); 00011 AlgebraicVector res(1,0); 00012 // vector<KinematicState>::const_iterator i_st = states.begin(); 00013 // KinematicState p_1 = *i_st; 00014 // i_st++; 00015 // KinematicState p_2 = *i_st; 00016 TrackCharge ch1 = states[0].particleCharge(); 00017 TrackCharge ch2 = states[1].particleCharge(); 00018 00019 double field1 = states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z(); 00020 double a_1 = -0.29979246*ch1*field1; 00021 double field2 = states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z(); 00022 double a_2 = -0.29979246*ch2*field2; 00023 00024 AlgebraicVector7 p1 = states[0].kinematicParameters().vector(); 00025 AlgebraicVector7 p2 = states[1].kinematicParameters().vector(); 00026 00027 double p1vx = p1(3) - a_1*(point.y() - p1(1)); 00028 double p1vy = p1(4) + a_1*(point.x() - p1(0)); 00029 double p1vz = p1(5); 00030 ParticleMass m1 = p1(6); 00031 00032 double p2vx = p2(3) - a_2*(point.y() - p2(1)); 00033 double p2vy = p2(4) + a_2*(point.x() - p2(0)); 00034 double p2vz = p2(5); 00035 ParticleMass m2 = p2(6); 00036 00037 double j_energy = sqrt(p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5)+m1*m1)+ 00038 sqrt(p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5)+m2*m2) ; 00039 00040 00041 double j_m = (p1vx+p2vx)*(p1vx+p2vx) + (p1vy+p2vy)*(p1vy+p2vy) + 00042 (p1vz+p2vz)*(p1vz+p2vz); 00043 00044 res(1) = j_energy*j_energy - j_m - mass*mass; 00045 return res; 00046 }