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 
mps_fire.i
i
Definition: mps_fire.py:355
VertexException
Common base class.
Definition: VertexException.h:12
cms::cuda::co
T *__restrict__ co
Definition: prefixScan.h:46
BackToBackKinematicConstraint::value
std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) const override
Definition: BackToBackKinematicConstraint.cc:5
BackToBackKinematicConstraint::derivative
std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const override
Definition: BackToBackKinematicConstraint.cc:20
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
KinematicConstraint
Definition: KinematicConstraint.h:21
createTree.dd
string dd
Definition: createTree.py:154
BackToBackKinematicConstraint.h
sipixeldigitoraw
Definition: SiPixelDigiToRaw.cc:38
AlgebraicVector7
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
Migration.h
BackToBackKinematicConstraint::numberOfEquations
int numberOfEquations() const override
Definition: BackToBackKinematicConstraint.cc:87
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
VertexException.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
point
*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
BackToBackKinematicConstraint::clone
KinematicConstraint * clone() const override
Definition: BackToBackKinematicConstraint.cc:89
BackToBackKinematicConstraint::BackToBackKinematicConstraint
BackToBackKinematicConstraint()
Definition: BackToBackKinematicConstraint.h:23
BackToBackKinematicConstraint::deviations
AlgebraicVector deviations(int nStates) const override
Definition: BackToBackKinematicConstraint.cc:82