Go to the documentation of this file.00001 #include "RecoVertex/KinematicFit/interface/TwoTrackMassKinematicConstraint.h"
00002 #include "RecoVertex/VertexPrimitives/interface/VertexException.h"
00003
00004
00005 AlgebraicVector TwoTrackMassKinematicConstraint::value(const std::vector<KinematicState> states,
00006 const GlobalPoint& point) const
00007 {
00008 if(states.size()<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
00009
00010 AlgebraicVector res(1,0);
00011
00012 double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
00013 double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
00014
00015 AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
00016 AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
00017
00018 double p1vx = p1(3) - a_1*(point.y() - p1(1));
00019 double p1vy = p1(4) + a_1*(point.x() - p1(0));
00020 double p1vz = p1(5);
00021 ParticleMass m1 = p1(6);
00022
00023 double p2vx = p2(3) - a_2*(point.y() - p2(1));
00024 double p2vy = p2(4) + a_2*(point.x() - p2(0));
00025 double p2vz = p2(5);
00026 ParticleMass m2 = p2(6);
00027
00028 double j_energy = sqrt(p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5)+m1*m1)+
00029 sqrt(p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5)+m2*m2) ;
00030
00031
00032 double j_m = (p1vx+p2vx)*(p1vx+p2vx) + (p1vy+p2vy)*(p1vy+p2vy) +
00033 (p1vz+p2vz)*(p1vz+p2vz);
00034
00035 res(1) = j_energy*j_energy - j_m - mass*mass;
00036 return res;
00037 }
00038
00039 AlgebraicMatrix TwoTrackMassKinematicConstraint::parametersDerivative(const std::vector<KinematicState> states,
00040 const GlobalPoint& point) const
00041 {
00042 int n_st = states.size();
00043 if(n_st<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
00044
00045 AlgebraicMatrix res(1,n_st*7,0);
00046
00047 double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
00048 double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
00049
00050 AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
00051 AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
00052
00053 double p1vx = p1(3) - a_1*(point.y() - p1(1));
00054 double p1vy = p1(4) + a_1*(point.x() - p1(0));
00055 double p1vz = p1(5);
00056 ParticleMass m1 = p1(6);
00057
00058 double p2vx = p2(3) - a_2*(point.y() - p2(1));
00059 double p2vy = p2(4) + a_2*(point.x() - p2(0));
00060 double p2vz = p2(5);
00061 ParticleMass m2 = p2(6);
00062
00063 double e1 = sqrt(p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5)+m1*m1);
00064 double e2 = sqrt(p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5)+m2*m2);
00065
00066
00067
00068 res(1,1) = 2*a_1*(p2vy + p1vy);
00069 res(1,8) = 2*a_2*(p2vy + p1vy);
00070
00071
00072 res(1,2) = -2*a_1*(p1vx + p2vx);
00073 res(1,9) = -2*a_2*(p2vx + p1vx);
00074
00075
00076 res(1,3) = 0.;
00077 res(1,10) = 0.;
00078
00079
00080 res(1,4) = 2*(1+e2/e1)*p1(3) - 2*(p1vx + p2vx);
00081 res(1,11) = 2*(1+e1/e2)*p2(3) - 2*(p1vx + p2vx);
00082
00083
00084 res(1,5) = 2*(1+e2/e1)*p1(4) - 2*(p1vy + p2vy);
00085 res(1,12) = 2*(1+e1/e2)*p2(4) - 2*(p2vy + p1vy);
00086
00087
00088 res(1,6) = 2*(1+e2/e1)*p1(5)- 2*(p1vz + p2vz);
00089 res(1,13) = 2*(1+e1/e2)*p2(5)- 2*(p2vz + p1vz);
00090
00091
00092 res(1,7) = 2*m1*(1+e2/e1);
00093 res(1,14) = 2*m2*(1+e1/e2);
00094
00095 return res;
00096 }
00097
00098 AlgebraicMatrix TwoTrackMassKinematicConstraint::positionDerivative(const std::vector<KinematicState> states,
00099 const GlobalPoint& point) const
00100 {
00101 AlgebraicMatrix res(1,3,0);
00102 if(states.size()<2) throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
00103
00104 double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
00105 double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
00106
00107 AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
00108 AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
00109
00110 double p1vx = p1(3) - a_1*(point.y() - p1(1));
00111 double p1vy = p1(4) + a_1*(point.x() - p1(0));
00112
00113 double p2vx = p2(3) - a_2*(point.y() - p2(1));
00114 double p2vy = p2(4) + a_2*(point.x() - p2(0));
00115
00116
00117 res(1,1) = -2*(p1vy + p2vy)*(a_1+a_2);
00118
00119
00120 res(1,2) = 2*(p1vx + p2vx)*(a_1+a_2);
00121
00122
00123 res(1,3) = 0.;
00124
00125 return res;
00126 }
00127
00128 int TwoTrackMassKinematicConstraint::numberOfEquations() const
00129 {return 1;}