#include <PointingKinematicConstraint.h>
Public Member Functions | |
virtual PointingKinematicConstraint * | clone () const |
virtual std::pair < AlgebraicMatrix, AlgebraicVector > | derivative (const AlgebraicVector &exPoint) const |
virtual std::pair < AlgebraicMatrix, AlgebraicVector > | derivative (const std::vector< RefCountedKinematicParticle > par) const |
virtual AlgebraicVector | deviations (int nStates) const |
virtual int | numberOfEquations () const |
PointingKinematicConstraint (const GlobalPoint &ref) | |
virtual std::pair < AlgebraicVector, AlgebraicVector > | value (const AlgebraicVector &exPoint) const |
virtual std::pair < AlgebraicVector, AlgebraicVector > | value (const std::vector< RefCountedKinematicParticle > par) const |
Private Member Functions | |
std::pair< AlgebraicMatrix, AlgebraicVector > | makeDerivative (const AlgebraicVector &exPoint) const |
std::pair< AlgebraicVector, AlgebraicVector > | makeValue (const AlgebraicVector &exPoint) const |
Private Attributes | |
GlobalPoint | refPoint |
Topological constraint making a momentum vector to point to the given location in space. 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 PointingKinematicConstraint.h.
PointingKinematicConstraint::PointingKinematicConstraint | ( | const GlobalPoint & | ref | ) | [inline] |
Definition at line 25 of file PointingKinematicConstraint.h.
Referenced by clone().
:refPoint(ref) {}
virtual PointingKinematicConstraint* PointingKinematicConstraint::clone | ( | ) | const [inline, virtual] |
Clone method
Implements KinematicConstraint.
Definition at line 53 of file PointingKinematicConstraint.h.
References PointingKinematicConstraint().
{return new PointingKinematicConstraint(*this);}
std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::derivative | ( | const AlgebraicVector & | exPoint | ) | const [virtual] |
Implements KinematicConstraint.
Definition at line 24 of file PointingKinematicConstraint.cc.
References makeDerivative().
{ if(exPoint.num_row() ==0 ) throw VertexException("PointingKinematicConstraint::value requested for zero Linearization point"); //security check for extended cartesian parametrization int inSize = exPoint.num_row(); if((inSize%7) !=0) throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension"); int nStates = inSize/7; if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); AlgebraicVector lPar = exPoint; //2x7 derivative matrix for given particle AlgebraicMatrix lDeriv = makeDerivative(lPar).first; AlgebraicMatrix dr(2,7,0); dr.sub(1,1,lDeriv); return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,lPar); }
std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::derivative | ( | const std::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 42 of file PointingKinematicConstraint.cc.
References makeDerivative().
{ int nStates = par.size(); if(nStates == 0) throw VertexException("PointingKinematicConstraint::Empty vector of particles passed"); if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); AlgebraicMatrix dr(2,7,0); AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector()); //2x7 derivative matrix for given state AlgebraicMatrix lDeriv = makeDerivative(lPoint).first; dr.sub(1,1,lDeriv); return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,lPoint); }
AlgebraicVector PointingKinematicConstraint::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 174 of file PointingKinematicConstraint.cc.
{return AlgebraicVector(7*nStates,0);}
std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::makeDerivative | ( | const AlgebraicVector & | exPoint | ) | const [private] |
Definition at line 106 of file PointingKinematicConstraint.cc.
References point, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by derivative().
{ AlgebraicMatrix dr(2,7,0); AlgebraicVector point = exPoint; double dx = point(1) - refPoint.x(); double dy = point(2) - refPoint.y(); double dz = point(3) - refPoint.z(); double px = point(4); double py = point(5); double pz = point(6); // double tr = px*px + py*py; // double trd = dx*dx + dy*dy; // double pr =1.5; // double p_factor = pow(tr,pr); // double x_factor = pow(trd,pr); //tangent solution /* dr(1,1) = -dy/(dx*dx); dr(1,2) = 1/dx; dr(1,3) = 0; dr(1,4) = py/(px*px); dr(1,5) = -1/px; dr(1,6) = 0; dr(1,7) = 0; dr(2,1) = -(dx*dz)/x_factor; dr(2,2) = -(dy*dz)/x_factor; dr(2,3) = 1/sqrt(dx*dx + dy*dy); dr(2,4) = (px*pz)/p_factor; dr(2,5) = (py*pz)/p_factor; dr(2,6) = -1/sqrt(px*px + py*py); dr(2,7) = 0.; */ //half angle solution corrected /* dr(1,1) = - dy/(dx*dx+dy*dy+dx*sqrt(dx*dx+dy*dy)); dr(1,2) = dx/(dx*dx+dy*dy+dx*sqrt(dx*dx+dy*dy)); dr(1,3) = 0; dr(1,4) = py/(px*px+py*py+px*sqrt(px*px+py*py)); dr(1,5) = -px/(px*px+py*py+px*sqrt(px*px+py*py)); dr(1,6) = 0; dr(1,7) = 0; */ //half angle solution dr(1,1) = dx/(dy*sqrt(dx*dx + dy*dy)) - 1/dy; dr(1,2) = 1/sqrt(dx*dx+dy*dy) - sqrt(dx*dx+dy*dy)/(dy*dy)+ dx/(dy*dy); dr(1,3) = 0; dr(1,4) = -(px/(py*sqrt(px*px + py*py)) - 1/py); dr(1,5) = -(1/sqrt(px*px+py*py) - sqrt(px*px+py*py)/(py*py)+ px/(py*py)); dr(1,6) = 0; dr(1,7) = 0; //half angle solution dr(2,1) = (dx/dz)*(1/sqrt(dx*dx + dy*dy + dz*dz) - 1/sqrt(dx*dx + dy*dy)); dr(2,2) = (dy/dz)*(1/sqrt(dx*dx + dy*dy + dz*dz) - 1/sqrt(dx*dx + dy*dy)); dr(2,3) = (1/(dz*dz))*(sqrt(dx*dx + dy*dy) - sqrt(dx*dx+dy*dy+dz*dz)) + 1/sqrt(dx*dx+dy*dy+dz*dz); dr(2,4) = -(px/pz)*(1/sqrt(px*px + py*py + pz*pz) - 1/sqrt(px*px + py*py)); dr(2,5) = -(py/pz)*(1/sqrt(px*px + py*py + pz*pz) - 1/sqrt(px*px + py*py)); dr(2,6) = -((1/(pz*pz))*(sqrt(px*px + py*py) - sqrt(px*px+py*py+pz*pz)) + 1/sqrt(px*px+py*py+pz*pz)); dr(2,7) = 0; return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,point); }
std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::makeValue | ( | const AlgebraicVector & | exPoint | ) | const [private] |
Definition at line 69 of file PointingKinematicConstraint.cc.
References point, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by value().
{ AlgebraicVector vl(2,0); AlgebraicVector point = exPoint; double dx = point(1) - refPoint.x(); double dy = point(2) - refPoint.y(); double dz = point(3) - refPoint.z(); double px = point(4); double py = point(5); double pz = point(6); // tangent solution // vl(1) = dy/dx - py/px; // vl(2) = dz/sqrt(dx*dx + dy*dy) - pz/sqrt(px*px + py*py); //half angle solution double sin_p = py/sqrt(px*px + py*py); double cos_p = px/sqrt(px*px + py*py); double sin_x = dy/sqrt(dx*dx + dy*dy); double cos_x = dx/sqrt(dx*dx + dy*dy); double sin_pt = pz/sqrt(px*px + py*py + pz*pz); double cos_pt = sqrt(px*px + py*py)/sqrt(px*px + py*py + pz*pz); double sin_xt = dz/sqrt(dx*dx + dy*dy + dz*dz); double cos_xt = sqrt(dx*dx + dy*dy)/sqrt(dx*dx + dy*dy + dz*dz); vl(1) = (1-cos_x)/sin_x - (1-cos_p)/sin_p; vl(2) = (1-cos_xt)/sin_xt - (1-cos_pt)/sin_pt; //half angle corrected // vl(1) = (sin_x/(1+cos_x)) - (sin_p/(1+cos_p)); // vl(2) = (sin_xt/(1+cos_xt)) - (sin_pt/(1+cos_pt)); return std::pair<AlgebraicVector,AlgebraicVector>(vl,point); }
int PointingKinematicConstraint::numberOfEquations | ( | ) | const [virtual] |
Returns number of constraint equations used for fitting. Method is relevant for proper NDF calculations.
Implements KinematicConstraint.
Definition at line 177 of file PointingKinematicConstraint.cc.
{return 2;}
std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::value | ( | const AlgebraicVector & | exPoint | ) | const [virtual] |
Vector of values and matrix of derivatives calculated at given expansion 7xNumberOfStates point
Implements KinematicConstraint.
Definition at line 4 of file PointingKinematicConstraint.cc.
References makeValue().
{ if(exPoint.num_row() ==0 ) throw VertexException("PointingKinematicConstraint::value requested for zero Linearization point"); //security check for extended cartesian parametrization int inSize = exPoint.num_row(); if((inSize%7) !=0) throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension"); int nStates = inSize/7; if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); AlgebraicVector lPar = exPoint; AlgebraicVector vl(2,0); //vector of values 1x2 for given particle AlgebraicVector lValue = makeValue(lPar).first; vl(1) =lValue(1); vl(2) =lValue(2); return std::pair<AlgebraicVector,AlgebraicVector>(vl,lPar); }
std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::value | ( | const std::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 57 of file PointingKinematicConstraint.cc.
References makeValue().
{ int nStates = par.size(); if(nStates == 0) throw VertexException("PointingKinematicConstraint::Empty vector of particles passed"); if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit"); AlgebraicVector vl(2,0); AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector()); vl(1) = makeValue(lPoint).first(1); vl(2) = makeValue(lPoint).first(2); return std::pair<AlgebraicVector,AlgebraicVector>(vl,lPoint); }
Definition at line 61 of file PointingKinematicConstraint.h.
Referenced by makeDerivative(), and makeValue().