CMS 3D CMS Logo

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

#include <VertexKinematicConstraintT.h>

Inheritance diagram for VertexKinematicConstraintT:
MultiTrackKinematicConstraintT< 2, 4 > MultiTrackKinematicConstraintBaseT

Public Member Functions

VertexKinematicConstraintTclone () const override
 
void init (const std::vector< KinematicState > &states, const GlobalPoint &point, const GlobalVector &mf) override
 
int numberOfEquations () const override
 
 VertexKinematicConstraintT ()
 
 ~VertexKinematicConstraintT () override
 
- Public Member Functions inherited from MultiTrackKinematicConstraintT< 2, 4 >
parametersDerivativeType const & parametersDerivative () const
 
positionDerivativeType const & positionDerivative () const
 
valueType const & value () const
 
 ~MultiTrackKinematicConstraintT () override
 
- Public Member Functions inherited from MultiTrackKinematicConstraintBaseT
virtual ~MultiTrackKinematicConstraintBaseT ()
 

Private Types

typedef MultiTrackKinematicConstraintT< 2, 4 > super
 

Private Member Functions

void fillParametersDerivative () const override
 
void fillPositionDerivative () const override
 
void fillValue () const override
 

Private Attributes

double a_i [2]
 
double delta [2]
 
GlobalVector dpos [2]
 
double k [2]
 
double m [2]
 
GlobalVector mom [2]
 
double n [2]
 
double novera [2]
 

Additional Inherited Members

- Public Types inherited from MultiTrackKinematicConstraintT< 2, 4 >
enum  
 
typedef ROOT::Math::SMatrix< double, DIM, 7 *NTRK > parametersDerivativeType
 
typedef ROOT::Math::SMatrix< double, DIM, 3 > positionDerivativeType
 
typedef MultiTrackKinematicConstraintT< NTRK, DIMself
 
typedef ROOT::Math::SVector< double, DIMvalueType
 
- Protected Member Functions inherited from MultiTrackKinematicConstraintT< 2, 4 >
parametersDerivativeTypejac_d () const
 
double & jac_d (size_t i, size_t j) const
 
positionDerivativeTypejac_e () const
 
double & jac_e (size_t i, size_t j) const
 
valueTypevl () const
 
double & vl (size_t i) const
 

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 VertexKinematicConstraintT.h.

Member Typedef Documentation

◆ super

Definition at line 16 of file VertexKinematicConstraintT.h.

Constructor & Destructor Documentation

◆ VertexKinematicConstraintT()

VertexKinematicConstraintT::VertexKinematicConstraintT ( )

Definition at line 5 of file VertexKinematicConstraintT.cc.

5 {}

Referenced by clone().

◆ ~VertexKinematicConstraintT()

VertexKinematicConstraintT::~VertexKinematicConstraintT ( )
override

Definition at line 7 of file VertexKinematicConstraintT.cc.

7 {}

Member Function Documentation

◆ clone()

VertexKinematicConstraintT* VertexKinematicConstraintT::clone ( void  ) const
inlineoverridevirtual

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 38 of file VertexKinematicConstraintT.h.

38 { return new VertexKinematicConstraintT(*this); }

References VertexKinematicConstraintT().

◆ fillParametersDerivative()

void VertexKinematicConstraintT::fillParametersDerivative ( ) const
overrideprivatevirtual

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

Implements MultiTrackKinematicConstraintT< 2, 4 >.

Definition at line 54 of file VertexKinematicConstraintT.cc.

54  {
55  ROOT::Math::SMatrix<double, 2, 7> el_part_d;
56  for (int j = 0; j != 2; ++j) {
57  if (a_i[j] != 0) {
58  //charged particle
59 
60  //D Jacobian matrix
61  el_part_d(0, 0) = mom[j].y() + a_i[j] * dpos[j].x();
62  el_part_d(0, 1) = -mom[j].x() + a_i[j] * dpos[j].y();
63  el_part_d(1, 0) = -k[j] * (m[j] * mom[j].x() - n[j] * mom[j].y());
64  el_part_d(1, 1) = -k[j] * (m[j] * mom[j].y() + n[j] * mom[j].x());
65  el_part_d(1, 2) = -1.;
66  el_part_d(0, 3) = dpos[j].y();
67  el_part_d(0, 4) = -dpos[j].x();
68  el_part_d(1, 3) = k[j] * (m[j] * dpos[j].x() - novera[j] * (2 * mom[j].x() - a_i[j] * dpos[j].y()));
69  el_part_d(1, 4) = k[j] * (m[j] * dpos[j].y() - novera[j] * (2 * mom[j].y() + a_i[j] * dpos[j].x()));
70  el_part_d(1, 5) = -delta[j] / a_i[j];
71  super::jac_d().Place_at(el_part_d, j * 2, j * 7);
72  } else {
73  //neutral particle
74  double pt2Inverse = 1. / mom[j].perp2();
75  el_part_d(0, 0) = mom[j].y();
76  el_part_d(0, 1) = -mom[j].x();
77  el_part_d(1, 0) = mom[j].x() * (mom[j].z() * pt2Inverse);
78  el_part_d(1, 1) = mom[j].y() * (mom[j].z() * pt2Inverse);
79  el_part_d(1, 2) = -1.;
80  el_part_d(0, 3) = dpos[j].y();
81  el_part_d(0, 4) = -dpos[j].x();
82  el_part_d(1, 3) = 2 * (dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y()) * pt2Inverse * mom[j].x() *
83  (mom[j].z() * pt2Inverse) -
84  dpos[j].x() * (mom[j].z() * pt2Inverse);
85  el_part_d(1, 4) = 2 * (dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y()) * pt2Inverse * mom[j].y() *
86  (mom[j].z() * pt2Inverse) -
87  dpos[j].x() * (mom[j].z() * pt2Inverse);
88  el_part_d(1, 5) = -(dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y()) * pt2Inverse;
89  super::jac_d().Place_at(el_part_d, j * 2, j * 7);
90  }
91  }
92 }

References a_i, delta, dpos, dqmiolumiharvest::j, MultiTrackKinematicConstraintT< 2, 4 >::jac_d(), k, m, mom, n, novera, PV3DBase< T, PVType, FrameType >::perp2(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ fillPositionDerivative()

void VertexKinematicConstraintT::fillPositionDerivative ( ) const
overrideprivatevirtual

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

Implements MultiTrackKinematicConstraintT< 2, 4 >.

Definition at line 94 of file VertexKinematicConstraintT.cc.

94  {
95  ROOT::Math::SMatrix<double, 2, 3> el_part_e;
96  for (int j = 0; j != 2; ++j) {
97  if (a_i[j] != 0) {
98  //charged particle
99 
100  //E jacobian matrix
101  el_part_e(0, 0) = -(mom[j].y() + a_i[j] * dpos[j].x());
102  el_part_e(0, 1) = mom[j].x() - a_i[j] * dpos[j].y();
103  el_part_e(1, 0) = k[j] * (m[j] * mom[j].x() - n[j] * mom[j].y());
104  el_part_e(1, 1) = k[j] * (m[j] * mom[j].y() + n[j] * mom[j].x());
105  el_part_e(1, 2) = 1;
106  super::jac_e().Place_at(el_part_e, 2 * j, 0);
107  } else {
108  //neutral particle
109  double pt2Inverse = 1. / mom[j].perp2();
110  el_part_e(0, 0) = -mom[j].y();
111  el_part_e(0, 1) = mom[j].x();
112  el_part_e(1, 0) = -mom[j].x() * mom[j].z() * pt2Inverse;
113  el_part_e(1, 1) = -mom[j].y() * mom[j].z() * pt2Inverse;
114  el_part_e(1, 2) = 1;
115  super::jac_e().Place_at(el_part_e, 2 * j, 0);
116  }
117  }
118 }

References a_i, dpos, dqmiolumiharvest::j, MultiTrackKinematicConstraintT< 2, 4 >::jac_e(), k, m, mom, n, PV3DBase< T, PVType, FrameType >::perp2(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ fillValue()

void VertexKinematicConstraintT::fillValue ( ) const
overrideprivatevirtual

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

Implements MultiTrackKinematicConstraintT< 2, 4 >.

Definition at line 36 of file VertexKinematicConstraintT.cc.

36  {
37  //it is 2 equations per track
38  for (int j = 0; j != 2; ++j) {
39  if (a_i[j] != 0) {
40  //vector of values
41  super::vl(j * 2) = dpos[j].y() * mom[j].x() - dpos[j].x() * mom[j].y() -
42  a_i[j] * (dpos[j].x() * dpos[j].x() + dpos[j].y() * dpos[j].y()) * 0.5;
43  super::vl(j * 2 + 1) = dpos[j].z() - mom[j].z() * delta[j] / a_i[j];
44  } else {
45  //neutral particle
46  double pt2Inverse = 1. / mom[j].perp2();
47  super::vl(j * 2) = dpos[j].y() * mom[j].x() - dpos[j].x() * mom[j].y();
48  super::vl(j * 2 + 1) =
49  dpos[j].z() - mom[j].z() * (dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y()) * pt2Inverse;
50  }
51  }
52 }

References a_i, delta, dpos, dqmiolumiharvest::j, mom, PV3DBase< T, PVType, FrameType >::perp2(), MultiTrackKinematicConstraintT< 2, 4 >::vl(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ init()

void VertexKinematicConstraintT::init ( const std::vector< KinematicState > &  states,
const GlobalPoint point,
const GlobalVector mf 
)
overridevirtual

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 9 of file VertexKinematicConstraintT.cc.

11  {
12  int num = states.size();
13  if (num != 2)
14  throw VertexException("VertexKinematicConstraintT !=2 states passed");
15  double mfz = fieldValue.z();
16 
17  int j = 0;
18  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
19  mom[j] = i->globalMomentum();
20  dpos[j] = ipoint - i->globalPosition();
21  a_i[j] = -i->particleCharge() * mfz;
22 
23  double pvx = mom[j].x() - a_i[j] * dpos[j].y();
24  double pvy = mom[j].y() + a_i[j] * dpos[j].x();
25  double pvt2 = pvx * pvx + pvy * pvy;
26  novera[j] = (dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y());
27  n[j] = a_i[j] * novera[j];
28  m[j] = (pvx * mom[j].x() + pvy * mom[j].y());
29  k[j] = -mom[j].z() / (mom[j].perp2() * pvt2);
30  delta[j] = std::atan2(n[j], m[j]);
31 
32  ++j;
33  }
34 }

References a_i, delta, dpos, mps_fire::i, plotBeamSpotDB::ipoint, dqmiolumiharvest::j, k, m, mom, n, novera, EgammaValidation_cff::num, PV3DBase< T, PVType, FrameType >::perp2(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ numberOfEquations()

int VertexKinematicConstraintT::numberOfEquations ( ) const
overridevirtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 120 of file VertexKinematicConstraintT.cc.

120 { return 2; }

Member Data Documentation

◆ a_i

double VertexKinematicConstraintT::a_i[2]
private

◆ delta

double VertexKinematicConstraintT::delta[2]
private

Definition at line 21 of file VertexKinematicConstraintT.h.

Referenced by fillParametersDerivative(), fillValue(), and init().

◆ dpos

GlobalVector VertexKinematicConstraintT::dpos[2]
private

◆ k

double VertexKinematicConstraintT::k[2]
private

◆ m

double VertexKinematicConstraintT::m[2]
private

◆ mom

GlobalVector VertexKinematicConstraintT::mom[2]
private

◆ n

double VertexKinematicConstraintT::n[2]
private

◆ novera

double VertexKinematicConstraintT::novera[2]
private

Definition at line 21 of file VertexKinematicConstraintT.h.

Referenced by fillParametersDerivative(), and init().

VertexKinematicConstraintT::VertexKinematicConstraintT
VertexKinematicConstraintT()
Definition: VertexKinematicConstraintT.cc:5
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
VertexException
Common base class.
Definition: VertexException.h:12
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
VertexKinematicConstraintT::novera
double novera[2]
Definition: VertexKinematicConstraintT.h:21
VertexKinematicConstraintT::delta
double delta[2]
Definition: VertexKinematicConstraintT.h:21
DDAxes::x
VertexKinematicConstraintT::n
double n[2]
Definition: VertexKinematicConstraintT.h:21
MultiTrackKinematicConstraintT< 2, 4 >::vl
valueType & vl() const
Definition: MultiTrackKinematicConstraintT.h:92
VertexKinematicConstraintT::dpos
GlobalVector dpos[2]
Definition: VertexKinematicConstraintT.h:23
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
MultiTrackKinematicConstraintT< 2, 4 >::jac_d
parametersDerivativeType & jac_d() const
Definition: MultiTrackKinematicConstraintT.h:93
plotBeamSpotDB.ipoint
ipoint
Definition: plotBeamSpotDB.py:340
MultiTrackKinematicConstraintT< 2, 4 >::jac_e
positionDerivativeType & jac_e() const
Definition: MultiTrackKinematicConstraintT.h:94
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
VertexKinematicConstraintT::mom
GlobalVector mom[2]
Definition: VertexKinematicConstraintT.h:22
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
VertexKinematicConstraintT::a_i
double a_i[2]
Definition: VertexKinematicConstraintT.h:20
VertexKinematicConstraintT::k
double k[2]
Definition: VertexKinematicConstraintT.h:21
VertexKinematicConstraintT::m
double m[2]
Definition: VertexKinematicConstraintT.h:21
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PV3DBase::perp2
T perp2() const
Definition: PV3DBase.h:68