CMS 3D CMS Logo

FourMomentumKinematicConstraint Class Reference

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. More...

#include <RecoVertex/KinematicFit/interface/FourMomentumKinematicConstraint.h>

Inheritance diagram for FourMomentumKinematicConstraint:

KinematicConstraint

List of all members.

Public Member Functions

virtual
FourMomentumKinematicConstraint
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 as an 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).
 FourMomentumKinematicConstraint (const AlgebraicVector &momentum, const AlgebraicVector &deviation)
 Constructor with desired 4-momentum vector and vector of deviations to be used forcovariance matrix as arguments.
virtual int numberOfEquations () const
 Returns number of constraint equations used for fitting.
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 7*NumberOfStates expansion point.

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().

00007 {
00008  if((momentum.num_row() != 4)||(deviation.num_row() != 4)) 
00009   throw VertexException("FourMomentumKinematicConstraint::vector of wrong size passed as 4-Momentum or Deviations");
00010  mm = momentum; 
00011  AlgebraicVector deviation_l(7,0);
00012  deviation_l(6) = momentum(3);
00013  deviation_l(5) = momentum(2);
00014  deviation_l(4) = momentum(1);
00015   
00016  double mass_sq = momentum(4)*momentum(4) - momentum(3)*momentum(3)
00017                 -momentum(2)*momentum(2) - momentum(1)*momentum(1); 
00018 
00019  if(mass_sq == 0.)throw VertexException("FourMomentumKinematicConstraint::the constraint vector passed corresponds to 0 mass");
00020 //deviation for mass calculated from deviations
00021 //of momentum
00022  deviation_l(7) = momentum(4)*momentum(4)*deviation(4)/mass_sq 
00023                 + momentum(3)*momentum(3)*deviation(3)/mass_sq
00024                 + momentum(2)*momentum(2)*deviation(2)/mass_sq
00025                 + momentum(1)*momentum(1)*deviation(1)/mass_sq;
00026 //mass sigma because of the energy 
00027  
00028  dd = deviation_l;
00029 }


Member Function Documentation

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

Clone method.

Implements KinematicConstraint.

Definition at line 56 of file FourMomentumKinematicConstraint.h.

References FourMomentumKinematicConstraint().

00057  {return new FourMomentumKinematicConstraint(*this);}

pair< AlgebraicMatrix, AlgebraicVector > FourMomentumKinematicConstraint::derivative ( const 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 funct::sqrt().

00087 {
00088  int nStates = par.size();
00089  if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
00090  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
00091  AlgebraicMatrix dr(4,7,0);
00092  
00093  AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
00094  dr(1,4) = 1.;
00095  dr(2,5) = 1.;
00096  dr(3,6) = 1.;
00097  dr(4,7) = - pr(7)/sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
00098  
00099  return pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
00100 }

pair< AlgebraicMatrix, AlgebraicVector > FourMomentumKinematicConstraint::derivative ( const AlgebraicVector exPoint  )  const [virtual]

Implements KinematicConstraint.

Definition at line 50 of file FourMomentumKinematicConstraint.cc.

References funct::sqrt().

00051 {
00052  if(exPoint.num_row() ==0) throw VertexException("FourMomentumKinematicConstraint::value requested for zero Linearization point");
00053 
00054 //security check for extended cartesian parametrization 
00055  int inSize = exPoint.num_row(); 
00056  if((inSize%7) !=0) throw VertexException("FourMomentumKinematicConstraint::linearization point has a wrong dimension");
00057  int nStates = inSize/7;
00058  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
00059  AlgebraicVector pr = exPoint;
00060  AlgebraicMatrix dr(4,7,0);
00061 
00062  dr(1,4) = 1.;
00063  dr(2,5) = 1.;
00064  dr(3,6) = 1.;
00065  dr(4,7) = pr(7)/ sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
00066   
00067  return pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
00068 }

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, and res.

00103 {
00104  if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
00105  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
00106  AlgebraicVector res = dd; 
00107  return res;
00108 }

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.

00111 {return 4;}

pair< AlgebraicVector, AlgebraicVector > FourMomentumKinematicConstraint::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 70 of file FourMomentumKinematicConstraint.cc.

References mm, and funct::sqrt().

00071 {
00072  int nStates = par.size();
00073  if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
00074  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
00075  AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
00076  AlgebraicVector vl(4,0);
00077  
00078  vl(1) = pr(4) - mm(1);
00079  vl(2) = pr(5) - mm(2);
00080  vl(3) = pr(6) - mm(3);
00081  vl(7) = sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) - mm(4);
00082  
00083  return pair<AlgebraicVector,AlgebraicVector>(vl,pr);
00084 }

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 funct::sqrt().

00032 {
00033  if(exPoint.num_row() ==0 ) throw VertexException("FourMomentumKinematicConstraint::value requested for zero Linearization point");
00034 
00035 //security check for extended cartesian parametrization 
00036  int inSize = exPoint.num_row(); 
00037  if((inSize%7) !=0) throw VertexException("FourMomentumKinematicConstraint::linearization point has a wrong dimension");
00038  int nStates = inSize/7;
00039  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
00040  AlgebraicVector pr = exPoint;
00041  AlgebraicVector vl(4,0);
00042  vl(1) += (pr(4) - mm(1));
00043  vl(2) += (pr(5) - mm(2));
00044  vl(3) += (pr(6) - mm(3));
00045  vl(7) += (sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) - mm(4));
00046  
00047  return pair<AlgebraicVector,AlgebraicVector>(vl,pr);
00048 }


Member Data Documentation

AlgebraicVector FourMomentumKinematicConstraint::dd [private]

Definition at line 62 of file FourMomentumKinematicConstraint.h.

Referenced by deviations(), and FourMomentumKinematicConstraint().

AlgebraicVector FourMomentumKinematicConstraint::mm [private]

Definition at line 61 of file FourMomentumKinematicConstraint.h.

Referenced by FourMomentumKinematicConstraint(), and value().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:00 2009 for CMSSW by  doxygen 1.5.4