CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TwoTrackMassKinematicConstraint Class Reference

#include <TwoTrackMassKinematicConstraint.h>

Inheritance diagram for TwoTrackMassKinematicConstraint:
MultiTrackKinematicConstraint

Public Member Functions

TwoTrackMassKinematicConstraintclone () const override
 
int numberOfEquations () const override
 
AlgebraicMatrix parametersDerivative (const std::vector< KinematicState > &states, const GlobalPoint &point) const override
 
AlgebraicMatrix positionDerivative (const std::vector< KinematicState > &states, const GlobalPoint &point) const override
 
 TwoTrackMassKinematicConstraint (ParticleMass &ms)
 
AlgebraicVector value (const std::vector< KinematicState > &states, const GlobalPoint &point) const override
 
- Public Member Functions inherited from MultiTrackKinematicConstraint
 MultiTrackKinematicConstraint ()
 
virtual ~MultiTrackKinematicConstraint ()
 

Private Attributes

ParticleMass mass
 

Detailed Description

Class implementing the total mass of 2 tracks constraint. I.e. 2 first particles out of four passed form a given mass

Warning: the tracks to constraint should be 1st and 2nd from the beginning of the vector.

Definition at line 21 of file TwoTrackMassKinematicConstraint.h.

Constructor & Destructor Documentation

◆ TwoTrackMassKinematicConstraint()

TwoTrackMassKinematicConstraint::TwoTrackMassKinematicConstraint ( ParticleMass ms)
inline

Definition at line 23 of file TwoTrackMassKinematicConstraint.h.

23 : mass(ms) {}

Referenced by clone().

Member Function Documentation

◆ clone()

TwoTrackMassKinematicConstraint* TwoTrackMassKinematicConstraint::clone ( void  ) const
inlineoverridevirtual

◆ numberOfEquations()

int TwoTrackMassKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 124 of file TwoTrackMassKinematicConstraint.cc.

124 { return 1; }

◆ parametersDerivative()

AlgebraicMatrix TwoTrackMassKinematicConstraint::parametersDerivative ( const std::vector< KinematicState > &  states,
const GlobalPoint point 
) const
overridevirtual

Returns a matrix of derivatives of constraint equations w.r.t. particle parameters

Implements MultiTrackKinematicConstraint.

Definition at line 36 of file TwoTrackMassKinematicConstraint.cc.

37  {
38  int n_st = states.size();
39  if (n_st < 2)
40  throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
41 
42  AlgebraicMatrix res(1, n_st * 7, 0);
43 
44  double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
45  double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
46 
47  AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
48  AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
49 
50  double p1vx = p1(3) - a_1 * (point.y() - p1(1));
51  double p1vy = p1(4) + a_1 * (point.x() - p1(0));
52  double p1vz = p1(5);
53  ParticleMass m1 = p1(6);
54 
55  double p2vx = p2(3) - a_2 * (point.y() - p2(1));
56  double p2vy = p2(4) + a_2 * (point.x() - p2(0));
57  double p2vz = p2(5);
58  ParticleMass m2 = p2(6);
59 
60  double e1 = sqrt(p1(3) * p1(3) + p1(4) * p1(4) + p1(5) * p1(5) + m1 * m1);
61  double e2 = sqrt(p2(3) * p2(3) + p2(4) * p2(4) + p2(5) * p2(5) + m2 * m2);
62 
63  //x1 and x2 derivatives: 1st and 8th elements
64  res(1, 1) = 2 * a_1 * (p2vy + p1vy);
65  res(1, 8) = 2 * a_2 * (p2vy + p1vy);
66 
67  //y1 and y2 derivatives: 2nd and 9th elements:
68  res(1, 2) = -2 * a_1 * (p1vx + p2vx);
69  res(1, 9) = -2 * a_2 * (p2vx + p1vx);
70 
71  //z1 and z2 components: 3d and 10th elmnets stay 0:
72  res(1, 3) = 0.;
73  res(1, 10) = 0.;
74 
75  //px1 and px2 components: 4th and 11th elements:
76  res(1, 4) = 2 * (1 + e2 / e1) * p1(3) - 2 * (p1vx + p2vx);
77  res(1, 11) = 2 * (1 + e1 / e2) * p2(3) - 2 * (p1vx + p2vx);
78 
79  //py1 and py2 components: 5th and 12 elements:
80  res(1, 5) = 2 * (1 + e2 / e1) * p1(4) - 2 * (p1vy + p2vy);
81  res(1, 12) = 2 * (1 + e1 / e2) * p2(4) - 2 * (p2vy + p1vy);
82 
83  //pz1 and pz2 components: 6th and 13 elements:
84  res(1, 6) = 2 * (1 + e2 / e1) * p1(5) - 2 * (p1vz + p2vz);
85  res(1, 13) = 2 * (1 + e1 / e2) * p2(5) - 2 * (p2vz + p1vz);
86 
87  //mass components: 7th and 14th elements:
88  res(1, 7) = 2 * m1 * (1 + e2 / e1);
89  res(1, 14) = 2 * m2 * (1 + e1 / e2);
90 
91  return res;
92 }

References StorageManager_cfg::e1, callgraph::m2, p1, p2, point, and mathSSE::sqrt().

◆ positionDerivative()

AlgebraicMatrix TwoTrackMassKinematicConstraint::positionDerivative ( const std::vector< KinematicState > &  states,
const GlobalPoint point 
) const
overridevirtual

Returns a matrix of derivatives of constraint equations w.r.t. vertex position

Implements MultiTrackKinematicConstraint.

Definition at line 94 of file TwoTrackMassKinematicConstraint.cc.

95  {
96  AlgebraicMatrix res(1, 3, 0);
97  if (states.size() < 2)
98  throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
99 
100  double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
101  double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
102 
103  AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
104  AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
105 
106  double p1vx = p1(3) - a_1 * (point.y() - p1(1));
107  double p1vy = p1(4) + a_1 * (point.x() - p1(0));
108 
109  double p2vx = p2(3) - a_2 * (point.y() - p2(1));
110  double p2vy = p2(4) + a_2 * (point.x() - p2(0));
111 
112  //xv component
113  res(1, 1) = -2 * (p1vy + p2vy) * (a_1 + a_2);
114 
115  //yv component
116  res(1, 2) = 2 * (p1vx + p2vx) * (a_1 + a_2);
117 
118  //zv component
119  res(1, 3) = 0.;
120 
121  return res;
122 }

References p1, p2, and point.

◆ value()

AlgebraicVector TwoTrackMassKinematicConstraint::value ( const std::vector< KinematicState > &  states,
const GlobalPoint point 
) const
overridevirtual

Returns a vector of values of constraint equations at the point where the input particles are defined.

Implements MultiTrackKinematicConstraint.

Definition at line 4 of file TwoTrackMassKinematicConstraint.cc.

5  {
6  if (states.size() < 2)
7  throw VertexException("TwoTrackMassKinematicConstraint::<2 states passed");
8 
9  AlgebraicVector res(1, 0);
10 
11  double a_1 = -states[0].particleCharge() * states[0].magneticField()->inInverseGeV(states[0].globalPosition()).z();
12  double a_2 = -states[1].particleCharge() * states[1].magneticField()->inInverseGeV(states[1].globalPosition()).z();
13 
14  AlgebraicVector7 p1 = states[0].kinematicParameters().vector();
15  AlgebraicVector7 p2 = states[1].kinematicParameters().vector();
16 
17  double p1vx = p1(3) - a_1 * (point.y() - p1(1));
18  double p1vy = p1(4) + a_1 * (point.x() - p1(0));
19  double p1vz = p1(5);
20  ParticleMass m1 = p1(6);
21 
22  double p2vx = p2(3) - a_2 * (point.y() - p2(1));
23  double p2vy = p2(4) + a_2 * (point.x() - p2(0));
24  double p2vz = p2(5);
25  ParticleMass m2 = p2(6);
26 
27  double j_energy = sqrt(p1(3) * p1(3) + p1(4) * p1(4) + p1(5) * p1(5) + m1 * m1) +
28  sqrt(p2(3) * p2(3) + p2(4) * p2(4) + p2(5) * p2(5) + m2 * m2);
29 
30  double j_m = (p1vx + p2vx) * (p1vx + p2vx) + (p1vy + p2vy) * (p1vy + p2vy) + (p1vz + p2vz) * (p1vz + p2vz);
31 
32  res(1) = j_energy * j_energy - j_m - mass * mass;
33  return res;
34 }

References callgraph::m2, mass, p1, p2, point, and mathSSE::sqrt().

Member Data Documentation

◆ mass

ParticleMass TwoTrackMassKinematicConstraint::mass
private
VertexException
Common base class.
Definition: VertexException.h:12
ParticleMass
double ParticleMass
Definition: ParticleMass.h:4
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
TwoTrackMassKinematicConstraint::mass
ParticleMass mass
Definition: TwoTrackMassKinematicConstraint.h:56
p1
double p1[4]
Definition: TauolaWrapper.h:89
AlgebraicVector7
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
res
Definition: Electron.h:6
callgraph.m2
m2
Definition: callgraph.py:38
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
TwoTrackMassKinematicConstraint::TwoTrackMassKinematicConstraint
TwoTrackMassKinematicConstraint(ParticleMass &ms)
Definition: TwoTrackMassKinematicConstraint.h:23
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