CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( )

Definition at line 5 of file VertexKinematicConstraint.cc.

Referenced by clone().

5 {}
VertexKinematicConstraint::~VertexKinematicConstraint ( )
override

Definition at line 7 of file VertexKinematicConstraint.cc.

7 {}

Member Function Documentation

VertexKinematicConstraint* VertexKinematicConstraint::clone ( void  ) const
inlineoverridevirtual
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; }
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.

References CommonMethods::delta(), mps_fire::i, isotrackApplyRegressor::k, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, pileupDistInMC::num, 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().

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 }
Common base class.
T y() const
Definition: PV3DBase.h:60
T transverse() const
Definition: PV3DBase.h:70
int TrackCharge
Definition: TrackCharge.h:4
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
T x() const
Definition: PV3DBase.h:59
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.

References mps_fire::i, isotrackApplyRegressor::k, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, pileupDistInMC::num, 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().

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 }
Common base class.
T y() const
Definition: PV3DBase.h:60
T transverse() const
Definition: PV3DBase.h:70
int TrackCharge
Definition: TrackCharge.h:4
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
T x() const
Definition: PV3DBase.h:59
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.

References CommonMethods::delta(), mps_fire::i, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, pileupDistInMC::num, 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 Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), Types.string::configValue(), Types.FileInPath::configValue(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), Types.vstring::insertInto(), and KinematicConstrainedVertexUpdator::update().

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 }
Common base class.
T y() const
Definition: PV3DBase.h:60
T transverse() const
Definition: PV3DBase.h:70
int TrackCharge
Definition: TrackCharge.h:4
T z() const
Definition: PV3DBase.h:61
CLHEP::HepVector AlgebraicVector
T x() const
Definition: PV3DBase.h:59