CMS 3D CMS Logo

Public Member Functions | Private Attributes

FourMomentumKinematicConstraint Class Reference

#include <FourMomentumKinematicConstraint.h>

Inheritance diagram for FourMomentumKinematicConstraint:
KinematicConstraint

List of all members.

Public Member Functions

virtual
FourMomentumKinematicConstraint
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
 FourMomentumKinematicConstraint (const AlgebraicVector &momentum, const AlgebraicVector &deviation)
virtual int numberOfEquations () const
virtual std::pair
< AlgebraicVector,
AlgebraicVector
value (const AlgebraicVector &exPoint) const
virtual std::pair
< AlgebraicVector,
AlgebraicVector
value (const std::vector< RefCountedKinematicParticle > par) const

Private Attributes

AlgebraicVector dd
AlgebraicVector mm

Detailed Description

4-Momentum track constraint class provides a way to compute the matrix of derivatives and the vector of values for 4-Momentum constraint on for given KinematicParticle. Current version does not allow working with multiple tracks

Kirill Prokofiev March 2003 MultiState version: July 2004

Definition at line 17 of file FourMomentumKinematicConstraint.h.


Constructor & Destructor Documentation

FourMomentumKinematicConstraint::FourMomentumKinematicConstraint ( const AlgebraicVector momentum,
const AlgebraicVector deviation 
)

Constructor with desired 4-momentum vector and vector of deviations to be used forcovariance matrix as arguments

Definition at line 5 of file FourMomentumKinematicConstraint.cc.

References dd, and mm.

Referenced by clone().

{
 if((momentum.num_row() != 4)||(deviation.num_row() != 4)) 
  throw VertexException("FourMomentumKinematicConstraint::vector of wrong size passed as 4-Momentum or Deviations");
 mm = momentum; 
 AlgebraicVector deviation_l(7,0);
 deviation_l(6) = momentum(3);
 deviation_l(5) = momentum(2);
 deviation_l(4) = momentum(1);
  
 double mass_sq = momentum(4)*momentum(4) - momentum(3)*momentum(3)
                -momentum(2)*momentum(2) - momentum(1)*momentum(1); 

 if(mass_sq == 0.)throw VertexException("FourMomentumKinematicConstraint::the constraint vector passed corresponds to 0 mass");
//deviation for mass calculated from deviations
//of momentum
 deviation_l(7) = momentum(4)*momentum(4)*deviation(4)/mass_sq 
                + momentum(3)*momentum(3)*deviation(3)/mass_sq
                + momentum(2)*momentum(2)*deviation(2)/mass_sq
                + momentum(1)*momentum(1)*deviation(1)/mass_sq;
//mass sigma because of the energy 
 
 dd = deviation_l;
}

Member Function Documentation

virtual FourMomentumKinematicConstraint* FourMomentumKinematicConstraint::clone ( ) const [inline, virtual]

Clone method

Implements KinematicConstraint.

Definition at line 56 of file FourMomentumKinematicConstraint.h.

References FourMomentumKinematicConstraint().

 {return new FourMomentumKinematicConstraint(*this);}
std::pair< AlgebraicMatrix, AlgebraicVector > FourMomentumKinematicConstraint::derivative ( const std::vector< RefCountedKinematicParticle par) const [virtual]

Vector of values and matrix of derivatives calculated using current state as an expansion point

Implements KinematicConstraint.

Definition at line 86 of file FourMomentumKinematicConstraint.cc.

References mathSSE::sqrt().

{
 int nStates = par.size();
 if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
 if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
 AlgebraicMatrix dr(4,7,0);
 
 AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
 dr(1,4) = 1.;
 dr(2,5) = 1.;
 dr(3,6) = 1.;
 dr(4,7) = - pr(7)/sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
 
 return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
}
std::pair< AlgebraicMatrix, AlgebraicVector > FourMomentumKinematicConstraint::derivative ( const AlgebraicVector exPoint) const [virtual]

Implements KinematicConstraint.

Definition at line 50 of file FourMomentumKinematicConstraint.cc.

References mathSSE::sqrt().

{
 if(exPoint.num_row() ==0) throw VertexException("FourMomentumKinematicConstraint::value requested for zero Linearization point");

//security check for extended cartesian parametrization 
 int inSize = exPoint.num_row(); 
 if((inSize%7) !=0) throw VertexException("FourMomentumKinematicConstraint::linearization point has a wrong dimension");
 int nStates = inSize/7;
 if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
 AlgebraicVector pr = exPoint;
 AlgebraicMatrix dr(4,7,0);

 dr(1,4) = 1.;
 dr(2,5) = 1.;
 dr(3,6) = 1.;
 dr(4,7) = pr(7)/ sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
  
 return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
}
AlgebraicVector FourMomentumKinematicConstraint::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 102 of file FourMomentumKinematicConstraint.cc.

References dd.

{
 if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
 if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
 AlgebraicVector res = dd; 
 return res;
}
int FourMomentumKinematicConstraint::numberOfEquations ( ) const [virtual]

Returns number of constraint equations used for fitting. Method is relevant for proper NDF calculations.

Implements KinematicConstraint.

Definition at line 110 of file FourMomentumKinematicConstraint.cc.

{return 4;}
std::pair< AlgebraicVector, AlgebraicVector > FourMomentumKinematicConstraint::value ( const AlgebraicVector exPoint) const [virtual]

Vector of values and matrix of derivatives calculated at given 7*NumberOfStates expansion point

Implements KinematicConstraint.

Definition at line 31 of file FourMomentumKinematicConstraint.cc.

References mm, and mathSSE::sqrt().

{
 if(exPoint.num_row() ==0 ) throw VertexException("FourMomentumKinematicConstraint::value requested for zero Linearization point");

//security check for extended cartesian parametrization 
 int inSize = exPoint.num_row(); 
 if((inSize%7) !=0) throw VertexException("FourMomentumKinematicConstraint::linearization point has a wrong dimension");
 int nStates = inSize/7;
 if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
 AlgebraicVector pr = exPoint;
 AlgebraicVector vl(4,0);
 vl(1) += (pr(4) - mm(1));
 vl(2) += (pr(5) - mm(2));
 vl(3) += (pr(6) - mm(3));
 vl(7) += (sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) - mm(4));
 
 return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
}
std::pair< AlgebraicVector, AlgebraicVector > FourMomentumKinematicConstraint::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 70 of file FourMomentumKinematicConstraint.cc.

References mm, and mathSSE::sqrt().

{
 int nStates = par.size();
 if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
 if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
 AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
 AlgebraicVector vl(4,0);
 
 vl(1) = pr(4) - mm(1);
 vl(2) = pr(5) - mm(2);
 vl(3) = pr(6) - mm(3);
 vl(7) = sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) - mm(4);
 
 return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
}

Member Data Documentation

Definition at line 61 of file FourMomentumKinematicConstraint.h.

Referenced by FourMomentumKinematicConstraint(), and value().