test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
FourMomentumKinematicConstraint Class Reference

#include <FourMomentumKinematicConstraint.h>

Inheritance diagram for FourMomentumKinematicConstraint:
KinematicConstraint

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
 
- Public Member Functions inherited from KinematicConstraint
 KinematicConstraint ()
 
virtual ~KinematicConstraint ()
 

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

7 {
8  if((momentum.num_row() != 4)||(deviation.num_row() != 4))
9  throw VertexException("FourMomentumKinematicConstraint::vector of wrong size passed as 4-Momentum or Deviations");
10  mm = momentum;
11  AlgebraicVector deviation_l(7,0);
12  deviation_l(6) = momentum(3);
13  deviation_l(5) = momentum(2);
14  deviation_l(4) = momentum(1);
15 
16  double mass_sq = momentum(4)*momentum(4) - momentum(3)*momentum(3)
17  -momentum(2)*momentum(2) - momentum(1)*momentum(1);
18 
19  if(mass_sq == 0.)throw VertexException("FourMomentumKinematicConstraint::the constraint vector passed corresponds to 0 mass");
20 //deviation for mass calculated from deviations
21 //of momentum
22  deviation_l(7) = momentum(4)*momentum(4)*deviation(4)/mass_sq
23  + momentum(3)*momentum(3)*deviation(3)/mass_sq
24  + momentum(2)*momentum(2)*deviation(2)/mass_sq
25  + momentum(1)*momentum(1)*deviation(1)/mass_sq;
26 //mass sigma because of the energy
27 
28  dd = deviation_l;
29 }
Common base class.
CLHEP::HepVector AlgebraicVector

Member Function Documentation

virtual FourMomentumKinematicConstraint* FourMomentumKinematicConstraint::clone ( ) const
inlinevirtual

Clone method

Implements KinematicConstraint.

Definition at line 56 of file FourMomentumKinematicConstraint.h.

References FourMomentumKinematicConstraint().

57  {return new FourMomentumKinematicConstraint(*this);}
FourMomentumKinematicConstraint(const AlgebraicVector &momentum, const AlgebraicVector &deviation)
std::pair< AlgebraicMatrix, AlgebraicVector > FourMomentumKinematicConstraint::derivative ( const AlgebraicVector exPoint) const
virtual

Implements KinematicConstraint.

Definition at line 50 of file FourMomentumKinematicConstraint.cc.

References mathSSE::sqrt().

51 {
52  if(exPoint.num_row() ==0) throw VertexException("FourMomentumKinematicConstraint::value requested for zero Linearization point");
53 
54 //security check for extended cartesian parametrization
55  int inSize = exPoint.num_row();
56  if((inSize%7) !=0) throw VertexException("FourMomentumKinematicConstraint::linearization point has a wrong dimension");
57  int nStates = inSize/7;
58  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
59  AlgebraicVector pr = exPoint;
60  AlgebraicMatrix dr(4,7,0);
61 
62  dr(1,4) = 1.;
63  dr(2,5) = 1.;
64  dr(3,6) = 1.;
65  dr(4,7) = pr(7)/ sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
66 
67  return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
68 }
Common base class.
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:48
CLHEP::HepVector AlgebraicVector
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().

87 {
88  int nStates = par.size();
89  if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
90  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
91  AlgebraicMatrix dr(4,7,0);
92 
93  AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
94  dr(1,4) = 1.;
95  dr(2,5) = 1.;
96  dr(3,6) = 1.;
97  dr(4,7) = - pr(7)/sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
98 
99  return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
100 }
Common base class.
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:48
CLHEP::HepVector AlgebraicVector
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.

103 {
104  if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
105  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
106  AlgebraicVector res = dd;
107  return res;
108 }
Common base class.
CLHEP::HepVector AlgebraicVector
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.

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

32 {
33  if(exPoint.num_row() ==0 ) throw VertexException("FourMomentumKinematicConstraint::value requested for zero Linearization point");
34 
35 //security check for extended cartesian parametrization
36  int inSize = exPoint.num_row();
37  if((inSize%7) !=0) throw VertexException("FourMomentumKinematicConstraint::linearization point has a wrong dimension");
38  int nStates = inSize/7;
39  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
40  AlgebraicVector pr = exPoint;
41  AlgebraicVector vl(4,0);
42  vl(1) += (pr(4) - mm(1));
43  vl(2) += (pr(5) - mm(2));
44  vl(3) += (pr(6) - mm(3));
45  vl(7) += (sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) - mm(4));
46 
47  return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
48 }
Common base class.
T sqrt(T t)
Definition: SSEVec.h:48
CLHEP::HepVector AlgebraicVector
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().

71 {
72  int nStates = par.size();
73  if(nStates == 0) throw VertexException("FourMomentumKinematicConstraint::Empty vector of particles passed");
74  if(nStates != 1) throw VertexException("FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
75  AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
76  AlgebraicVector vl(4,0);
77 
78  vl(1) = pr(4) - mm(1);
79  vl(2) = pr(5) - mm(2);
80  vl(3) = pr(6) - mm(3);
81  vl(7) = sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) - mm(4);
82 
83  return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
84 }
Common base class.
T sqrt(T t)
Definition: SSEVec.h:48
CLHEP::HepVector AlgebraicVector

Member Data Documentation

AlgebraicVector FourMomentumKinematicConstraint::dd
private
AlgebraicVector FourMomentumKinematicConstraint::mm
private

Definition at line 61 of file FourMomentumKinematicConstraint.h.

Referenced by FourMomentumKinematicConstraint(), and value().