CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BackToBackKinematicConstraint.cc
Go to the documentation of this file.
4 
5 std::pair<AlgebraicVector, AlgebraicVector> BackToBackKinematicConstraint::value(const AlgebraicVector& exPoint) const
6 {
7 //security check for extended cartesian parametrization
8  int inSize = exPoint.num_row();
9  if(inSize != 14) throw VertexException("BackToBackKinematicConstraint::linearization point has a wrong dimension");
10  AlgebraicVector pr = exPoint;
11 
12 //number of states should be always equal to 2 for such a constraint
13  AlgebraicVector vl(3,0);
14  vl(1) = pr(4)+pr(11);
15  vl(2) = pr(5)+pr(12);
16  vl(3) = pr(6)+pr(13);
17  return std::pair<AlgebraicVector, AlgebraicVector>(vl,pr);
18 }
19 
20 std::pair<AlgebraicMatrix, AlgebraicVector> BackToBackKinematicConstraint::derivative(const AlgebraicVector& exPoint) const
21 {
22 //security check for extended cartesian parametrization
23  int inSize = exPoint.num_row();
24  if(inSize != 14) throw VertexException("BackToBackKinematicConstraint::linearization point has a wrong dimension");
25  AlgebraicVector pr = exPoint;
26 
27 //number of states should be always equal to 2 for such a constraint
28  AlgebraicMatrix dr(3,14,0);
29  dr(1,4) = 1.;
30  dr(1,11) = 1.;
31  dr(2,5) = 1;
32  dr(2,12) = 1;
33  dr(3,6) = 1;
34  dr(3,13) = 1;
35  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr,pr);
36 }
37 
38 std::pair<AlgebraicVector, AlgebraicVector> BackToBackKinematicConstraint::value(const std::vector<RefCountedKinematicParticle> par) const
39 {
40  int nStates = par.size();
41  if(nStates != 2) throw VertexException("BackToBackKinematicConstraint::number of tracks is not equal to 2");
42  AlgebraicVector point(14,0);
43  int co = 0;
44  for(std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i!=par.end(); i++)
45  {
46  AlgebraicVector7 cPar = (*i)->currentState().kinematicParameters().vector();
47  for(int j = 1; j<8; j++){point((co-1)*7+j) = cPar(j-1);}
48  co++;
49  }
50  AlgebraicVector vl(3,0);
51  AlgebraicVector st1 = asHepVector<7>(par[0]->currentState().kinematicParameters().vector());
52  AlgebraicVector st2 = asHepVector<7>(par[1]->currentState().kinematicParameters().vector());
53  vl(1) = st1(4)+st2(4);
54  vl(2) = st1(5)+st2(5);
55  vl(3) = st1(6)+st2(6);
56 
57  return std::pair<AlgebraicVector, AlgebraicVector>(vl,point);
58 }
59 
60 std::pair<AlgebraicMatrix, AlgebraicVector> BackToBackKinematicConstraint::derivative(const std::vector<RefCountedKinematicParticle> par) const
61 {
62  int nStates = par.size();
63  if(nStates != 2) throw VertexException("BackToBackKinematicConstraint::number of tracks is not equal to 2");
64  AlgebraicVector point(14,0);
65  int co = 0;
66  for(std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i!=par.end(); i++)
67  {
68  AlgebraicVector7 cPar = (*i)->currentState().kinematicParameters().vector();
69  for(int j = 1; j<8; j++){point((co-1)*7+j) = cPar(j-1);}
70  co++;
71  }
72  AlgebraicMatrix dr(3,14,0);
73 
74  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr,point);
75 }
76 
78 {
79  AlgebraicVector dd(7*nStates,0);
80  return dd;
81 }
82 
84 {return 3;}
85 
87 {return new BackToBackKinematicConstraint(*this);}
int i
Definition: DBlmapReader.cc:9
virtual KinematicConstraint * clone() const
Common base class.
virtual std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:7
CLHEP::HepMatrix AlgebraicMatrix
int j
Definition: DBlmapReader.cc:9
virtual AlgebraicVector deviations(int nStates) const
CLHEP::HepVector AlgebraicVector
virtual std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) 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