CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MomentumKinematicConstraint.cc
Go to the documentation of this file.
3 
4 
6  const AlgebraicVector& dev)
7 {
8  if((momentum.num_row() != 3) || (dev.num_row() != 3))
9  throw VertexException("MomentumKinemticConstraint::Momentum or Deviation vector passed is not 3-dimensional");
10  mm = momentum;
11  AlgebraicVector dev_l(7,0);
12  dev_l(4) = dev(1) * dev(1);
13  dev_l(5) = dev(2) * dev(2);
14  dev_l(6) = dev(3) * dev(3);
15  dd = dev_l;
16 }
17 
18 std::pair<AlgebraicVector,AlgebraicVector> MomentumKinematicConstraint::value(const AlgebraicVector& exPoint) const
19 {
20  if(exPoint.num_row() ==0 ) throw VertexException("MomentumKinematicConstraint::value requested for zero Linearization point");
21 
22 //security check for extended cartesian parametrization
23  int inSize = exPoint.num_row();
24  if((inSize%7) !=0) throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
25  int nStates = inSize/7;
26  if(nStates != 1) throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
27  AlgebraicVector pr = exPoint;
28  AlgebraicVector vl(3,0);
29  vl(1) = pr(4) - mm(1);
30  vl(2) = pr(5) - mm(2);
31  vl(3) = pr(6) - mm(3);
32  return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
33 }
34 
35 std::pair<AlgebraicMatrix, AlgebraicVector> MomentumKinematicConstraint::derivative(const AlgebraicVector& exPoint) const
36 {
37  if(exPoint.num_row() ==0 ) throw VertexException("MomentumKinematicConstraint::derivative requested for zero Linearization point");
38 
39 //security check for extended cartesian parametrization
40  int inSize = exPoint.num_row();
41  if((inSize%7) !=0) throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
42  int nStates = inSize/7;
43  if(nStates != 1) throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
44 
45  AlgebraicVector pr = exPoint;
46  AlgebraicMatrix dr(3,7,0);
47  dr(1,4) = 1.;
48  dr(2,5) = 1.;
49  dr(3,6) = 1.;
50  return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
51 }
52 
53 std::pair<AlgebraicVector, AlgebraicVector> MomentumKinematicConstraint::value(const std::vector<RefCountedKinematicParticle> &par) const
54 {
55  int nStates = par.size();
56  if(nStates == 0) throw VertexException("MomentumKinematicConstraint::Empty vector of particles passed");
57  if(nStates != 1) throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
58  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
59  AlgebraicVector vl(3,0);
60  vl(1) = point(4) - mm(1);
61  vl(2) = point(5) - mm(2);
62  vl(3) = point(6) - mm(3);
63  return std::pair<AlgebraicVector,AlgebraicVector>(vl,point);
64 }
65 
66 std::pair<AlgebraicMatrix, AlgebraicVector> MomentumKinematicConstraint::derivative(const std::vector<RefCountedKinematicParticle> &par) const
67 {
68  int nStates = par.size();
69  if(nStates == 0) throw VertexException("MomentumKinematicConstraint::Empty vector of particles passed");
70  if(nStates != 1) throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
71  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
72  AlgebraicMatrix dr(3,7,0);
73  dr(1,4) = 1.;
74  dr(2,5) = 1.;
75  dr(3,6) = 1.;
76  return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,point);
77 }
78 
80 {
81  if(nStates == 0) throw VertexException("MomentumKinematicConstraint::Empty vector of particles passed");
82  if(nStates != 1) throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
83  AlgebraicVector res = dd;
84  return res;
85 }
86 
88 {return 3;}
89 
Common base class.
virtual std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const
virtual std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) const
MomentumKinematicConstraint(const AlgebraicVector &momentum, const AlgebraicVector &dev)
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
virtual AlgebraicVector deviations(int nStates) const
*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