CMS 3D CMS Logo

List of all members | Public Member Functions
VertexKinematicConstraint Class Reference

#include <VertexKinematicConstraint.h>

Inheritance diagram for VertexKinematicConstraint:
MultiTrackKinematicConstraint

Public Member Functions

VertexKinematicConstraintclone () 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
 
AlgebraicVector value (const std::vector< KinematicState > &states, const GlobalPoint &point) const override
 
 VertexKinematicConstraint ()
 
 ~VertexKinematicConstraint () override
 
- Public Member Functions inherited from MultiTrackKinematicConstraint
 MultiTrackKinematicConstraint ()
 
virtual ~MultiTrackKinematicConstraint ()
 

Detailed Description

Class implementing the vertexing constraint for extended cartesian parametrization (x,y,z,p_x,p_y,p_z,m). The equations and derivatives in general follow the P.Avery's "Applied Fitting Theory-VI" CBX 98-37

Definition at line 14 of file VertexKinematicConstraint.h.

Constructor & Destructor Documentation

◆ VertexKinematicConstraint()

VertexKinematicConstraint::VertexKinematicConstraint ( )

Definition at line 5 of file VertexKinematicConstraint.cc.

5 {}

Referenced by clone().

◆ ~VertexKinematicConstraint()

VertexKinematicConstraint::~VertexKinematicConstraint ( )
override

Definition at line 7 of file VertexKinematicConstraint.cc.

7 {}

Member Function Documentation

◆ clone()

VertexKinematicConstraint* VertexKinematicConstraint::clone ( void  ) const
inlineoverridevirtual

Implements MultiTrackKinematicConstraint.

Definition at line 47 of file VertexKinematicConstraint.h.

47 { return new VertexKinematicConstraint(*this); }

References VertexKinematicConstraint().

◆ numberOfEquations()

int VertexKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 160 of file VertexKinematicConstraint.cc.

160 { return 2; }

◆ parametersDerivative()

AlgebraicMatrix VertexKinematicConstraint::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 50 of file VertexKinematicConstraint.cc.

51  {
52  int num = states.size();
53  if (num < 2)
54  throw VertexException("VertexKinematicConstraint::<2 states passed");
55  AlgebraicMatrix jac_d(2 * num, 7 * num);
56  int num_r = 0;
57  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
58  AlgebraicMatrix el_part_d(2, 7, 0);
59  TrackCharge ch = i->particleCharge();
60  GlobalVector mom = i->globalMomentum();
61  GlobalPoint pos = i->globalPosition();
62  double d_x = point.x() - pos.x();
63  double d_y = point.y() - pos.y();
64  double pt = mom.transverse();
65 
66  if (ch != 0) {
67  //charged particle
68  double a_i = -ch * i->magneticField()->inInverseGeV(pos).z();
69 
70  double pvx = mom.x() - a_i * d_y;
71  double pvy = mom.y() + a_i * d_x;
72  double pvt = sqrt(pvx * pvx + pvy * pvy);
73  double novera = (d_x * mom.x() + d_y * mom.y());
74  double n = a_i * novera;
75  double m = (pvx * mom.x() + pvy * mom.y());
76  double k = -mom.z() / (pvt * pvt * pt * pt);
77  double delta = atan2(n, m);
78 
79  //D Jacobian matrix
80  el_part_d(1, 1) = mom.y() + a_i * d_x;
81  el_part_d(1, 2) = -mom.x() + a_i * d_y;
82  el_part_d(2, 1) = -k * (m * mom.x() - n * mom.y());
83  el_part_d(2, 2) = -k * (m * mom.y() + n * mom.x());
84  el_part_d(2, 3) = -1.;
85  el_part_d(1, 4) = d_y;
86  el_part_d(1, 5) = -d_x;
87  el_part_d(2, 4) = k * (m * d_x - novera * (2 * mom.x() - a_i * d_y));
88  el_part_d(2, 5) = k * (m * d_y - novera * (2 * mom.y() + a_i * d_x));
89  el_part_d(2, 6) = -delta / a_i;
90  jac_d.sub(num_r * 2 + 1, num_r * 7 + 1, el_part_d);
91  } else {
92  //neutral particle
93  el_part_d(1, 1) = mom.y();
94  el_part_d(1, 2) = -mom.x();
95  el_part_d(2, 1) = mom.x() * mom.z() / (pt * pt);
96  el_part_d(2, 2) = mom.y() * mom.z() / (pt * pt);
97  el_part_d(2, 3) = -1.;
98  el_part_d(1, 4) = d_y;
99  el_part_d(1, 5) = -d_x;
100  el_part_d(2, 4) =
101  2 * (d_x * mom.x() + d_y * mom.y()) * mom.x() * mom.z() / (pt * pt * pt * pt) - mom.z() * d_x / (pt * pt);
102  el_part_d(2, 5) =
103  2 * (d_x * mom.x() + d_y * mom.y()) * mom.y() * mom.z() / (pt * pt * pt * pt) - mom.z() * d_y / (pt * pt);
104  el_part_d(2, 6) = -(d_x * mom.x() + d_y * mom.y()) / (pt * pt);
105  jac_d.sub(num_r * 2 + 1, num_r * 7 + 1, el_part_d);
106  }
107  num_r++;
108  }
109  return jac_d;
110 }

References alignCSCRings::d_x, alignCSCRings::d_y, dumpMFGeometry_cfg::delta, mps_fire::i, dqmdumpme::k, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, EgammaValidation_cff::num, point, DiDispStaMuonMonitor_cfi::pt, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::transverse(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicConstrainedVertexUpdator::update().

◆ positionDerivative()

AlgebraicMatrix VertexKinematicConstraint::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 112 of file VertexKinematicConstraint.cc.

113  {
114  int num = states.size();
115  if (num < 2)
116  throw VertexException("VertexKinematicConstraint::<2 states passed");
117  AlgebraicMatrix jac_e(2 * num, 3);
118  int num_r = 0;
119  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
120  AlgebraicMatrix el_part_e(2, 3, 0);
121  TrackCharge ch = i->particleCharge();
122  GlobalVector mom = i->globalMomentum();
123  GlobalPoint pos = i->globalPosition();
124  double d_x = point.x() - pos.x();
125  double d_y = point.y() - pos.y();
126  double pt = mom.transverse();
127 
128  if (ch != 0) {
129  //charged particle
130  double a_i = -ch * i->magneticField()->inInverseGeV(pos).z();
131 
132  double pvx = mom.x() - a_i * d_y;
133  double pvy = mom.y() + a_i * d_x;
134  double pvt = sqrt(pvx * pvx + pvy * pvy);
135  double n = a_i * (d_x * mom.x() + d_y * mom.y());
136  double m = (pvx * mom.x() + pvy * mom.y());
137  double k = -mom.z() / (pvt * pvt * pt * pt);
138 
139  //E jacobian matrix
140  el_part_e(1, 1) = -(mom.y() + a_i * d_x);
141  el_part_e(1, 2) = mom.x() - a_i * d_y;
142  el_part_e(2, 1) = k * (m * mom.x() - n * mom.y());
143  el_part_e(2, 2) = k * (m * mom.y() + n * mom.x());
144  el_part_e(2, 3) = 1;
145  jac_e.sub(2 * num_r + 1, 1, el_part_e);
146  } else {
147  //neutral particle
148  el_part_e(1, 1) = -mom.y();
149  el_part_e(1, 2) = mom.x();
150  el_part_e(2, 1) = -mom.x() * mom.z() / (pt * pt);
151  el_part_e(2, 2) = -mom.y() * mom.z() / (pt * pt);
152  el_part_e(2, 3) = 1;
153  jac_e.sub(2 * num_r + 1, 1, el_part_e);
154  }
155  num_r++;
156  }
157  return jac_e;
158 }

References alignCSCRings::d_x, alignCSCRings::d_y, mps_fire::i, dqmdumpme::k, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, EgammaValidation_cff::num, point, DiDispStaMuonMonitor_cfi::pt, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::transverse(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicConstrainedVertexUpdator::update().

◆ value()

AlgebraicVector VertexKinematicConstraint::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 9 of file VertexKinematicConstraint.cc.

10  {
11  int num = states.size();
12  if (num < 2)
13  throw VertexException("VertexKinematicConstraint::<2 states passed");
14 
15  //it is 2 equations per track
16  AlgebraicVector vl(2 * num, 0);
17  int num_r = 0;
18  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
19  TrackCharge ch = i->particleCharge();
20  GlobalVector mom = i->globalMomentum();
21  GlobalPoint pos = i->globalPosition();
22  double d_x = point.x() - pos.x();
23  double d_y = point.y() - pos.y();
24  double d_z = point.z() - pos.z();
25  double pt = mom.transverse();
26 
27  if (ch != 0) {
28  //charged particle
29  double a_i = -ch * i->magneticField()->inInverseGeV(pos).z();
30 
31  double pvx = mom.x() - a_i * d_y;
32  double pvy = mom.y() + a_i * d_x;
33  double n = a_i * (d_x * mom.x() + d_y * mom.y());
34  double m = (pvx * mom.x() + pvy * mom.y());
35  double delta = atan2(n, m);
36 
37  //vector of values
38  vl(num_r * 2 + 1) = d_y * mom.x() - d_x * mom.y() - a_i * (d_x * d_x + d_y * d_y) / 2;
39  vl(num_r * 2 + 2) = d_z - mom.z() * delta / a_i;
40  } else {
41  //neutral particle
42  vl(num_r * 2 + 1) = d_y * mom.x() - d_x * mom.y();
43  vl(num_r * 2 + 2) = d_z - mom.z() * (d_x * mom.x() + d_y * mom.y()) / (pt * pt);
44  }
45  num_r++;
46  }
47  return vl;
48 }

References alignCSCRings::d_x, alignCSCRings::d_y, dumpMFGeometry_cfg::delta, mps_fire::i, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, EgammaValidation_cff::num, point, DiDispStaMuonMonitor_cfi::pt, PV3DBase< T, PVType, FrameType >::transverse(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicConstrainedVertexUpdator::update().

Vector3DBase
Definition: Vector3DBase.h:8
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TrackCharge
int TrackCharge
Definition: TrackCharge.h:4
VertexException
Common base class.
Definition: VertexException.h:12
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
pos
Definition: PixelAliasList.h:18
alignCSCRings.d_x
d_x
Definition: alignCSCRings.py:85
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
VertexKinematicConstraint::VertexKinematicConstraint
VertexKinematicConstraint()
Definition: VertexKinematicConstraint.cc:5
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
alignCSCRings.d_y
d_y
Definition: alignCSCRings.py:86
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
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
PV3DBase::transverse
T transverse() const
Definition: PV3DBase.h:70