#include <RecoVertex/KinematicFit/interface/SmartPointingConstraint.h>
Public Member Functions | |
virtual SmartPointingConstraint * | clone () const |
Clone method. | |
virtual pair< AlgebraicMatrix, AlgebraicVector > | derivative (const vector< RefCountedKinematicParticle > par) const |
Vector of values and matrix of derivatives calculated using current state parameters as expansion point. | |
virtual pair< AlgebraicMatrix, AlgebraicVector > | derivative (const AlgebraicVector &exPoint) const |
virtual AlgebraicVector | deviations (int nStates) const |
Returns vector of sigma squared associated to the KinematicParameters of refitted particles Initial deviations are given by user for the constraining parameters (mass, momentum components etc). | |
virtual int | numberOfEquations () const |
Returns number of constraint equations used for fitting. | |
SmartPointingConstraint (const GlobalPoint &ref) | |
virtual pair< AlgebraicVector, AlgebraicVector > | value (const vector< RefCountedKinematicParticle > par) const |
Methods making value and derivative matrix using current state parameters as expansion 7-point. | |
virtual pair< AlgebraicVector, AlgebraicVector > | value (const AlgebraicVector &exPoint) const |
Vector of values and matrix of derivatives calculated at given expansion 7xNumberOfStates point. | |
Private Member Functions | |
pair< AlgebraicMatrix, AlgebraicVector > | makeDerivative (const AlgebraicVector &exPoint) const |
pair< AlgebraicVector, AlgebraicVector > | makeValue (const AlgebraicVector &exPoint) const |
Private Attributes | |
GlobalPoint | refPoint |
Example: if b-meson momentum is reconstructed at b-meson decay position (secondary vertex), making reconstructed momentum pointing the the primary vertex
Multiple track refit is not supported in current version
Kirill Prokofiev, March 2004 MultiState version: July 2004
Definition at line 21 of file SmartPointingConstraint.h.
SmartPointingConstraint::SmartPointingConstraint | ( | const GlobalPoint & | ref | ) | [inline] |
Definition at line 25 of file SmartPointingConstraint.h.
Referenced by clone().
00025 :refPoint(ref) 00026 {}
virtual SmartPointingConstraint* SmartPointingConstraint::clone | ( | ) | const [inline, virtual] |
Clone method.
Implements KinematicConstraint.
Definition at line 53 of file SmartPointingConstraint.h.
References SmartPointingConstraint().
00054 {return new SmartPointingConstraint(*this);}
pair< AlgebraicMatrix, AlgebraicVector > SmartPointingConstraint::derivative | ( | const vector< RefCountedKinematicParticle > | par | ) | const [virtual] |
Vector of values and matrix of derivatives calculated using current state parameters as expansion point.
Implements KinematicConstraint.
Definition at line 43 of file SmartPointingConstraint.cc.
References makeDerivative().
00044 { 00045 int nStates = par.size(); 00046 if(nStates == 0) throw VertexException("PointingKinematicConstraint::Empty vector of particles passed"); 00047 if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); 00048 00049 AlgebraicMatrix dr(2,7,0); 00050 AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector()); 00051 00052 //2x7 derivative matrix for given state 00053 AlgebraicMatrix lDeriv = makeDerivative(lPoint).first; 00054 dr.sub(1,1,lDeriv); 00055 // cout<<"Derivative returned: "<<dr<<endl; 00056 // cout<<"For the value: "<<lPoint<<endl; 00057 return pair<AlgebraicMatrix,AlgebraicVector>(dr,lPoint); 00058 }
pair< AlgebraicMatrix, AlgebraicVector > SmartPointingConstraint::derivative | ( | const AlgebraicVector & | exPoint | ) | const [virtual] |
Implements KinematicConstraint.
Definition at line 25 of file SmartPointingConstraint.cc.
References makeDerivative().
00026 { 00027 if(exPoint.num_row() ==0 ) throw VertexException("PointingKinematicConstraint::value requested for zero Linearization point"); 00028 00029 //security check for extended cartesian parametrization 00030 int inSize = exPoint.num_row(); 00031 if((inSize%7) !=0) throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension"); 00032 int nStates = inSize/7; 00033 if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); 00034 AlgebraicVector lPar = exPoint; 00035 00036 //2x7 derivative matrix for given particle 00037 AlgebraicMatrix lDeriv = makeDerivative(lPar).first; 00038 AlgebraicMatrix dr(2,7,0); 00039 dr.sub(1,1,lDeriv); 00040 return pair<AlgebraicMatrix,AlgebraicVector>(dr,lPar); 00041 }
AlgebraicVector SmartPointingConstraint::deviations | ( | int | nStates | ) | const [virtual] |
Returns vector of sigma squared associated to the KinematicParameters of refitted particles Initial deviations are given by user for the constraining parameters (mass, momentum components etc).
In case of multiple states exactly the same values are added to every particle parameters
Implements KinematicConstraint.
Definition at line 75 of file SmartPointingConstraint.cc.
00076 {return AlgebraicVector(7*nStates,0);}
pair< AlgebraicMatrix, AlgebraicVector > SmartPointingConstraint::makeDerivative | ( | const AlgebraicVector & | exPoint | ) | const [private] |
Definition at line 116 of file SmartPointingConstraint.cc.
References funct::pow(), refPoint, funct::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by derivative().
00117 { 00118 AlgebraicMatrix dr(2,7,0); 00119 AlgebraicVector point = exPoint; 00120 double dx = point(1) - refPoint.x(); 00121 double dy = point(2) - refPoint.y(); 00122 double dz = point(3) - refPoint.z(); 00123 double px = point(4); 00124 double py = point(5); 00125 double pz = point(6); 00126 00127 //angular functuions: 00128 00129 //half angle solution 00130 //d/dx_i 00131 dr(1,1) = (dy*(dx*px + dy*py))/(pow(pow(dx,2) + pow(dy,2),1.5)*sqrt(pow(px,2) + pow(py,2))) ; 00132 00133 dr(1,2) = -((dx*(dx*px + dy*py))/(pow(pow(dx,2) + pow(dy,2),1.5)*sqrt(pow(px,2) + pow(py,2)))) ; 00134 00135 dr(1,3) = 0; 00136 00137 //d/dp_i 00138 //debug: x->p index xhange in denominator 00139 dr(1,4) = -((py*(dx*px + dy*py))/(sqrt(pow(dx,2) + pow(dy,2))*pow(pow(px,2) + pow(py,2),1.5))); 00140 00141 dr(1,5) = (px*(dx*px + dy*py))/(sqrt(pow(dx,2) + pow(dy,2))*pow(pow(px,2) + pow(py,2),1.5)); 00142 00143 dr(1,6) = 0; 00144 dr(1,7) = 0; 00145 00146 //2nd equation 00147 //d/dx_i 00148 00149 dr(2,1) = (dx*dz*(sqrt(pow(dx,2) + pow(dy,2))*sqrt(pow(px,2) + pow(py,2)) + dz*pz))/ 00150 (sqrt(pow(dx,2) + pow(dy,2))*pow(pow(dx,2) + pow(dy,2) + pow(dz,2),1.5)* 00151 sqrt(pow(px,2) + pow(py,2) + pow(pz,2))); 00152 00153 dr(2,2) = (dy*dz*(sqrt(pow(dx,2) + pow(dy,2))*sqrt(pow(px,2) + pow(py,2)) + dz*pz))/ 00154 (sqrt(pow(dx,2) + pow(dy,2))*pow(pow(dx,2) + pow(dy,2) + pow(dz,2),1.5)* 00155 sqrt(pow(px,2) + pow(py,2) + pow(pz,2))); 00156 00157 00158 dr(2,3) = (-((pow(dx,2) + pow(dy,2))*sqrt(pow(px,2) + pow(py,2))) - sqrt(pow(dx,2) + pow(dy,2))*dz*pz)/ 00159 (pow(pow(dx,2) + pow(dy,2) + pow(dz,2),1.5)*sqrt(pow(px,2) + pow(py,2) + pow(pz,2))); 00160 00161 00162 00163 //d/dp_i 00164 //debug: x->p index xhange in denominator 00165 00166 dr(2,4) = -((px*pz*(sqrt(pow(dx,2) + pow(dy,2))*sqrt(pow(px,2) + pow(py,2)) + dz*pz))/ 00167 (sqrt(pow(dx,2) + pow(dy,2) + pow(dz,2))*sqrt(pow(px,2) + pow(py,2))* 00168 pow(pow(px,2) + pow(py,2) + pow(pz,2),1.5))); 00169 00170 dr(2,5) = -((py*pz*(sqrt(pow(dx,2) + pow(dy,2))*sqrt(pow(px,2) + pow(py,2)) + dz*pz))/ 00171 (sqrt(pow(dx,2) + pow(dy,2) + pow(dz,2))*sqrt(pow(px,2) + pow(py,2))* 00172 pow(pow(px,2) + pow(py,2) + pow(pz,2),1.5))) ; 00173 00174 dr(2,6) = (sqrt(pow(dx,2) + pow(dy,2))*(pow(px,2) + pow(py,2)) + dz*sqrt(pow(px,2) + pow(py,2))*pz)/ 00175 (sqrt(pow(dx,2) + pow(dy,2) + pow(dz,2))*pow(pow(px,2) + pow(py,2) + pow(pz,2),1.5)) ; 00176 00177 dr(2,7) = 0; 00178 00179 // cout<<"derivative matrix "<<dr<<endl; 00180 return pair<AlgebraicMatrix,AlgebraicVector>(dr,point); 00181 }
pair< AlgebraicVector, AlgebraicVector > SmartPointingConstraint::makeValue | ( | const AlgebraicVector & | exPoint | ) | const [private] |
Definition at line 81 of file SmartPointingConstraint.cc.
References refPoint, funct::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by value().
00082 { 00083 // cout<<"Make value called"<<endl; 00084 AlgebraicVector vl(2,0); 00085 AlgebraicVector point = exPoint; 00086 double dx = point(1) - refPoint.x(); 00087 double dy = point(2) - refPoint.y(); 00088 double dz = point(3) - refPoint.z(); 00089 double px = point(4); 00090 double py = point(5); 00091 double pz = point(6); 00092 00093 00094 //full angle solution: sin(alpha - betha) = 0 00095 //sign swap allowed 00096 double cos_phi_p = px/sqrt(px*px + py*py); 00097 double sin_phi_p = py/sqrt(px*px + py*py); 00098 double cos_phi_x = dx/sqrt(dx*dx + dy*dy); 00099 double sin_phi_x = dy/sqrt(dx*dx + dy*dy); 00100 00101 double sin_theta_p = pz/sqrt(px*px + py*py + pz*pz); 00102 double sin_theta_x = dz/sqrt(dx*dx + dy*dy + dz*dz); 00103 00104 double cos_theta_p = sqrt(px*px + py*py)/sqrt(px*px + py*py + pz*pz); 00105 double cos_theta_x = sqrt(dx*dx + dy*dy)/sqrt(dx*dx + dy*dy + dz*dz); 00106 00107 float feq = sin_phi_p*cos_phi_x - cos_phi_p*sin_phi_x; 00108 float seq = sin_theta_p* cos_theta_x - cos_theta_p * sin_theta_x; 00109 00110 vl(1) = feq; 00111 vl(2) = seq; 00112 00113 return pair<AlgebraicVector,AlgebraicVector>(vl,point); 00114 }
int SmartPointingConstraint::numberOfEquations | ( | ) | const [virtual] |
Returns number of constraint equations used for fitting.
Method is relevant for proper NDF calculations.
Implements KinematicConstraint.
Definition at line 78 of file SmartPointingConstraint.cc.
pair< AlgebraicVector, AlgebraicVector > SmartPointingConstraint::value | ( | const vector< RefCountedKinematicParticle > | par | ) | const [virtual] |
Methods making value and derivative matrix using current state parameters as expansion 7-point.
Constraint can be made equaly for single and multiple states
Implements KinematicConstraint.
Definition at line 60 of file SmartPointingConstraint.cc.
References makeValue().
00061 { 00062 int nStates = par.size(); 00063 if(nStates == 0) throw VertexException("PointingKinematicConstraint::Empty vector of particles passed"); 00064 if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); 00065 AlgebraicVector vl(2,0); 00066 AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector()); 00067 vl(1) = makeValue(lPoint).first(1); 00068 vl(2) = makeValue(lPoint).first(2); 00069 // cout<<"Value returned: "<<vl<<endl; 00070 // cout<<"For the point: "<<lPoint<<endl; 00071 00072 return pair<AlgebraicVector,AlgebraicVector>(vl,lPoint); 00073 }
pair< AlgebraicVector, AlgebraicVector > SmartPointingConstraint::value | ( | const AlgebraicVector & | exPoint | ) | const [virtual] |
Vector of values and matrix of derivatives calculated at given expansion 7xNumberOfStates point.
Implements KinematicConstraint.
Definition at line 5 of file SmartPointingConstraint.cc.
References makeValue().
00006 { 00007 if(exPoint.num_row() ==0 ) throw VertexException("PointingKinematicConstraint::value requested for zero Linearization point"); 00008 00009 //security check for extended cartesian parametrization 00010 int inSize = exPoint.num_row(); 00011 if((inSize%7) !=0) throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension"); 00012 int nStates = inSize/7; 00013 if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); 00014 00015 AlgebraicVector lPar = exPoint; 00016 AlgebraicVector vl(2,0); 00017 00018 //vector of values 1x2 for given particle 00019 AlgebraicVector lValue = makeValue(lPar).first; 00020 vl(1) =lValue(1); 00021 vl(2) =lValue(2); 00022 return pair<AlgebraicVector,AlgebraicVector>(vl,lPar); 00023 }
GlobalPoint SmartPointingConstraint::refPoint [private] |
Definition at line 61 of file SmartPointingConstraint.h.
Referenced by makeDerivative(), and makeValue().