CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MassKinematicConstraint.cc
Go to the documentation of this file.
3 
5 {
6  mass = m;
7  AlgebraicVector deviation_l(7,0);
8  deviation_l(7) = sigma * sigma;
9  dd = deviation_l;
10 }
11 
12 std::pair<AlgebraicVector, AlgebraicVector> MassKinematicConstraint::value(const AlgebraicVector& exPoint) const
13 {
14 
15 //we have only one equation and only one track, means the constraint value
16 //for track parameters is just a single number
17  if(exPoint.num_row() ==0 ) throw VertexException("MomentumKinematicConstraint::value requested for zero Linearization point");
18 
19 //security check for extended cartesian parametrization
20  int inSize = exPoint.num_row();
21  if((inSize%7) !=0) throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
22  int nStates = inSize/7;
23  if(nStates !=1) throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
24  AlgebraicVector vl(1,0);
25  AlgebraicVector point = exPoint;
26  vl(1) = point(7) - mass;
27  return std::pair<AlgebraicVector,AlgebraicVector>(vl,point);
28 }
29 
30 std::pair<AlgebraicMatrix, AlgebraicVector> MassKinematicConstraint::derivative(const AlgebraicVector& exPoint) const
31 {
32  if(exPoint.num_row() == 0) throw VertexException("MomentumKinematicConstraint::deriavtive requested for zero Linearization point");
33 
34 //security check for extended cartesian parametrization
35  int inSize = exPoint.num_row();
36  if((inSize%7) !=0) throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
37  int nStates = inSize/7;
38  if(nStates !=1) throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
39  AlgebraicMatrix dr(1,7,0);
40  dr(1,7) = 1;
41  AlgebraicVector point = exPoint;
42  return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,point);
43 }
44 
45 std::pair<AlgebraicVector, AlgebraicVector> MassKinematicConstraint::value(const std::vector<RefCountedKinematicParticle> par) const
46 {
47  int nStates = par.size();
48  if(nStates == 0) throw VertexException("MassKinematicConstraint::empty vector of particles passed");
49  if(nStates !=1) throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
50 
51  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
52  AlgebraicVector vl(1,0);
53  vl(1) = point(7) - mass;
54  return std::pair<AlgebraicVector,AlgebraicVector>(vl,point);
55 }
56 
57 std::pair<AlgebraicMatrix, AlgebraicVector> MassKinematicConstraint::derivative(const std::vector<RefCountedKinematicParticle> par) const
58 {
59  int nStates = par.size();
60  if(nStates == 0) throw VertexException("MassKinematicConstraint::empty vector of particles passed");
61  if(nStates !=1) throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
62 
63  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
64  AlgebraicMatrix dr(1,7,0);
65  dr(1,7) = 1;
66  return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,point);
67 }
68 
70 {
71  if(nStates == 0) throw VertexException("MassKinematicConstraint::empty vector of particles passed");
72  if(nStates !=1) throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
73  AlgebraicVector res = dd;
74  return res;
75 }
76 
78 {return 1;}
79 
80 
81 
82 
83 
84 
85 
virtual std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const
virtual std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) const
Common base class.
virtual int numberOfEquations() const
double ParticleMass
Definition: ParticleMass.h:5
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
virtual AlgebraicVector deviations(int nStates) const
MassKinematicConstraint(const ParticleMass &m, const float sigma)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5