CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MultiTrackMassKinematicConstraint.cc
Go to the documentation of this file.
3 
4 AlgebraicVector MultiTrackMassKinematicConstraint::value(const std::vector<KinematicState>& states,
5  const GlobalPoint& point) const {
6  if (states.size() < nPart)
7  throw VertexException("MultiTrackMassKinematicConstraint::not enough states given");
8 
9  double sumEnergy = 0, sumPx = 0, sumPy = 0., sumPz = 0.;
10 
11  double a;
12  for (unsigned int i = 0; i < nPart; ++i) {
13  a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();
14 
15  sumEnergy += states[i].kinematicParameters().energy();
16  sumPx += states[i].kinematicParameters()(3) - a * (point.y() - states[i].kinematicParameters()(1));
17  sumPy += states[i].kinematicParameters()(4) + a * (point.x() - states[i].kinematicParameters()(0));
18  sumPz += states[i].kinematicParameters()(5);
19  }
20 
21  double j_m = sumPx * sumPx + sumPy * sumPy + sumPz * sumPz;
22 
23  AlgebraicVector res(1, 0);
24  res(1) = sumEnergy * sumEnergy - j_m - mass * mass;
25  return res;
26 }
27 
29  const GlobalPoint& point) const {
30  if (states.size() < nPart)
31  throw VertexException("MultiTrackMassKinematicConstraint::not enough states given");
32 
33  AlgebraicMatrix res(1, states.size() * 7, 0);
34 
35  double sumEnergy = 0, sumPx = 0, sumPy = 0., sumPz = 0.;
36 
37  double a;
38  for (unsigned int i = 0; i < nPart; ++i) {
39  a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();
40 
41  sumEnergy += states[i].kinematicParameters().energy();
42  sumPx += states[i].kinematicParameters()(3) - a * (point.y() - states[i].kinematicParameters()(1));
43  sumPy += states[i].kinematicParameters()(4) + a * (point.x() - states[i].kinematicParameters()(0));
44  sumPz += states[i].kinematicParameters()(5);
45  }
46 
47  for (unsigned int i = 0; i < nPart; ++i) {
48  a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();
49 
50  //x derivatives:
51  res(1, 1 + i * 7) = 2 * a * sumPy;
52 
53  //y derivatives:
54  res(1, 2 + i * 7) = -2 * a * sumPx;
55 
56  //z components:
57  res(1, 3 + i * 7) = 0.;
58 
59  //px components:
60  res(1, 4 + i * 7) =
61  2 * sumEnergy / states[i].kinematicParameters().energy() * states[i].kinematicParameters()(3) - 2 * sumPx;
62 
63  //py components:
64  res(1, 5 + i * 7) =
65  2 * sumEnergy / states[i].kinematicParameters().energy() * states[i].kinematicParameters()(4) - 2 * sumPy;
66 
67  //pz1 components:
68  res(1, 6 + i * 7) =
69  2 * sumEnergy / states[i].kinematicParameters().energy() * states[i].kinematicParameters()(5) - 2 * sumPz;
70 
71  //mass components:
72  res(1, 7 + i * 7) =
73  2 * states[i].kinematicParameters().mass() * sumEnergy / states[i].kinematicParameters().energy();
74  }
75  return res;
76 }
77 
79  const GlobalPoint& point) const {
80  AlgebraicMatrix res(1, 3, 0);
81  if (states.size() < nPart)
82  throw VertexException("MultiTrackMassKinematicConstraint::not enough states given");
83 
84  double sumA = 0, sumPx = 0, sumPy = 0.;
85 
86  double a;
87  for (unsigned int i = 0; i < nPart; ++i) {
88  a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();
89  sumA += a;
90 
91  sumPx += states[i].kinematicParameters()(3) - a * (point.y() - states[i].kinematicParameters()(1));
92  sumPy += states[i].kinematicParameters()(4) + a * (point.x() - states[i].kinematicParameters()(0));
93  }
94 
95  //xv component
96  res(1, 1) = -2 * sumPy * sumA;
97 
98  //yv component
99  res(1, 2) = 2 * sumPx * sumA;
100 
101  //zv component
102  res(1, 3) = 0.;
103 
104  return res;
105 }
Common base class.
T y() const
Definition: PV3DBase.h:60
AlgebraicMatrix positionDerivative(const std::vector< KinematicState > &states, const GlobalPoint &point) const override
CLHEP::HepMatrix AlgebraicMatrix
AlgebraicVector value(const std::vector< KinematicState > &states, const GlobalPoint &point) const override
CLHEP::HepVector AlgebraicVector
AlgebraicMatrix parametersDerivative(const std::vector< KinematicState > &states, const GlobalPoint &point) const override
double a
Definition: hdecay.h:119
T x() const
Definition: PV3DBase.h:59
*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