CMS 3D CMS Logo

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

#include <MultiTrackMassKinematicConstraint.h>

Inheritance diagram for MultiTrackMassKinematicConstraint:
MultiTrackKinematicConstraint

Public Member Functions

MultiTrackMassKinematicConstraintclone () const override
 
 MultiTrackMassKinematicConstraint (const ParticleMass &theMass, const unsigned int nbrParticles)
 
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
 
AlgebraicVector value (const std::vector< KinematicState > &states, const GlobalPoint &point) const override
 
- Public Member Functions inherited from MultiTrackKinematicConstraint
 MultiTrackKinematicConstraint ()
 
virtual ~MultiTrackKinematicConstraint ()
 

Private Attributes

const ParticleMass mass
 
const unsigned int nPart
 

Detailed Description

Constraint to force some of the particles in the fit to have a certain invariant mass.

Definition at line 13 of file MultiTrackMassKinematicConstraint.h.

Constructor & Destructor Documentation

◆ MultiTrackMassKinematicConstraint()

MultiTrackMassKinematicConstraint::MultiTrackMassKinematicConstraint ( const ParticleMass theMass,
const unsigned int  nbrParticles 
)
inline

Constructor

Parameters
theMassthe mass to constrain the states
nbrParticlesthe number of particles to use (in case more than that number are present in the fit, the first will be used)

Definition at line 21 of file MultiTrackMassKinematicConstraint.h.

22  : mass(theMass), nPart(nbrParticles) {}

Referenced by clone().

Member Function Documentation

◆ clone()

MultiTrackMassKinematicConstraint* MultiTrackMassKinematicConstraint::clone ( void  ) const
inlineoverridevirtual

◆ numberOfEquations()

int MultiTrackMassKinematicConstraint::numberOfEquations ( ) const
inlineoverridevirtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 50 of file MultiTrackMassKinematicConstraint.h.

50 { return 1; }

◆ parametersDerivative()

AlgebraicMatrix MultiTrackMassKinematicConstraint::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 28 of file MultiTrackMassKinematicConstraint.cc.

29  {
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 }

References a, mps_fire::i, nPart, and point.

◆ positionDerivative()

AlgebraicMatrix MultiTrackMassKinematicConstraint::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 78 of file MultiTrackMassKinematicConstraint.cc.

79  {
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 }

References a, mps_fire::i, nPart, and point.

◆ value()

AlgebraicVector MultiTrackMassKinematicConstraint::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 MultiTrackMassKinematicConstraint.cc.

5  {
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 }

References a, mps_fire::i, mass, nPart, and point.

Member Data Documentation

◆ mass

const ParticleMass MultiTrackMassKinematicConstraint::mass
private

◆ nPart

const unsigned int MultiTrackMassKinematicConstraint::nPart
private
mps_fire.i
i
Definition: mps_fire.py:428
VertexException
Common base class.
Definition: VertexException.h:12
MultiTrackMassKinematicConstraint::mass
const ParticleMass mass
Definition: MultiTrackMassKinematicConstraint.h:55
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
MultiTrackMassKinematicConstraint::MultiTrackMassKinematicConstraint
MultiTrackMassKinematicConstraint(const ParticleMass &theMass, const unsigned int nbrParticles)
Definition: MultiTrackMassKinematicConstraint.h:21
MultiTrackMassKinematicConstraint::nPart
const unsigned int nPart
Definition: MultiTrackMassKinematicConstraint.h:56
a
double a
Definition: hdecay.h:119
res
Definition: Electron.h:6
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
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