CMS 3D CMS Logo

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