CMS 3D CMS Logo

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

#include <MultiTrackPointingKinematicConstraint.h>

Inheritance diagram for MultiTrackPointingKinematicConstraint:
MultiTrackKinematicConstraint

Public Member Functions

MultiTrackPointingKinematicConstraintclone () const override
 
 MultiTrackPointingKinematicConstraint (GlobalPoint &ref)
 
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

GlobalPoint refPoint
 

Detailed Description

Topological constraint making a momentum vector to point to the given location in space. Example: if b-meson momentum is reconstructed at b-meson decay position (secondary vertex), making reconstructed momentum be in parallel to the link from primary vertex to secondary vertex.

Kirill Prokofiev, March 2004 MultiTrack version including propagation to linearization point: Lars Perchalla, Philip Sauerland, Dec 2009

Definition at line 21 of file MultiTrackPointingKinematicConstraint.h.

Constructor & Destructor Documentation

◆ MultiTrackPointingKinematicConstraint()

MultiTrackPointingKinematicConstraint::MultiTrackPointingKinematicConstraint ( GlobalPoint ref)
inline

Member Function Documentation

◆ clone()

MultiTrackPointingKinematicConstraint* MultiTrackPointingKinematicConstraint::clone ( void  ) const
inlineoverridevirtual

◆ numberOfEquations()

int MultiTrackPointingKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 118 of file MultiTrackPointingKinematicConstraint.cc.

118 { return 2; }

◆ parametersDerivative()

AlgebraicMatrix MultiTrackPointingKinematicConstraint::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 MultiTrackPointingKinematicConstraint.cc.

References a, cuy::col, mps_fire::i, makeMuonMisalignmentScenario::matrix, EgammaValidation_cff::num, point, conifer::pow(), pv::pT, mathSSE::sqrt(), and z.

37  {
38  int num = states.size();
39  if (num < 2)
40  throw VertexException("MultiTrackPointingKinematicConstraint::parametersDerivative <2 states passed");
41 
42  //2 equations (for all tracks)
43  AlgebraicMatrix matrix(2, num * 7, 0); //AlgebraicMatrix starts from 1
44 
45  double pxSum = 0, pySum = 0, pzSum = 0;
46  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
47  double a = -i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
48 
49  pxSum += i->kinematicParameters()(3) - a * (point.y() - i->kinematicParameters()(1));
50  pySum += i->kinematicParameters()(4) + a * (point.x() - i->kinematicParameters()(0));
51  pzSum += i->kinematicParameters()(5);
52  }
53 
54  double pT = sqrt(pow(pxSum, 2) + pow(pySum, 2));
55  double pSum = sqrt(pow(pxSum, 2) + pow(pySum, 2) + pow(pzSum, 2));
56 
57  int col = 0;
58  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
59  double a = -i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
60 
61  matrix(1, 1 + col * 7) = a * (1 / pT + (-pT + pxSum) / pow(pySum, 2)); //dH/dx
62  matrix(1, 2 + col * 7) = (a - (a * pxSum) / pT) / pySum; //dH/dy
63  //dH/dz=0
64  matrix(1, 4 + col * 7) = (pT - pxSum) / (pT * pySum); //dH/dpx
65  matrix(1, 5 + col * 7) = -(1 / pT) + (pT - pxSum) / pow(pySum, 2); //dH/dpy
66  //dH/dpz=0
67  //dH/dm=0
68  matrix(2, 1 + col * 7) = (a * (-pSum + pT) * pySum) / (pSum * pT * pzSum); //dH/dx
69  matrix(2, 2 + col * 7) = (a * (pSum - pT) * pxSum) / (pSum * pT * pzSum); //dH/dy
70  //dH/dz
71  matrix(2, 4 + col * 7) = ((-(1 / pSum) + 1 / pT) * pxSum) / pzSum; //dH/dpx
72  matrix(2, 5 + col * 7) = ((-(1 / pSum) + 1 / pT) * pySum) / pzSum; //dH/dpy
73  matrix(2, 6 + col * 7) = -(1 / pSum) + (pSum - pT) / pow(pzSum, 2); //dH/dpz
74  //dH/dm=0
75 
76  col++;
77  }
78 
79  return matrix;
80 }
Common base class.
constexpr int pow(int x)
Definition: conifer.h:24
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:19
double a
Definition: hdecay.h:121
col
Definition: cuy.py:1009
*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

◆ positionDerivative()

AlgebraicMatrix MultiTrackPointingKinematicConstraint::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 82 of file MultiTrackPointingKinematicConstraint.cc.

References a, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, mps_fire::i, makeMuonMisalignmentScenario::matrix, EgammaValidation_cff::num, point, conifer::pow(), pv::pT, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

83  {
84  int num = states.size();
85  if (num < 2)
86  throw VertexException("MultiTrackPointingKinematicConstraint::positionDerivative <2 states passed");
87 
88  //2 equations (for all tracks)
89  AlgebraicMatrix matrix(2, 3, 0);
90  double dx = point.x() - refPoint.x();
91  double dy = point.y() - refPoint.y();
92  double dz = point.z() - refPoint.z();
93  double dT = sqrt(pow(dx, 2) + pow(dy, 2));
94  double ds = sqrt(pow(dx, 2) + pow(dy, 2) + pow(dz, 2));
95 
96  double pxSum = 0, pySum = 0, pzSum = 0, aSum = 0;
97  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
98  double a = -i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
99  aSum += a;
100 
101  pxSum += i->kinematicParameters()(3) - a * (point.y() - i->kinematicParameters()(1));
102  pySum += i->kinematicParameters()(4) + a * (point.x() - i->kinematicParameters()(0));
103  pzSum += i->kinematicParameters()(5);
104  }
105  double pT = sqrt(pow(pxSum, 2) + pow(pySum, 2));
106  double pSum = sqrt(pow(pxSum, 2) + pow(pySum, 2) + pow(pzSum, 2));
107 
108  matrix(1, 1) = (-1 + dx / dT) / dy - aSum / pT + (aSum * (pT - pxSum)) / pow(pySum, 2); //dH/dxv
109  matrix(1, 2) = 1 / dT + (-dT + dx) / pow(dy, 2) - (aSum * (pT - pxSum)) / (pT * pySum); //dH/dyv
110  //dH/dzv=0
111  matrix(2, 1) = ((1 / ds - 1 / dT) * dx) / dz + (aSum * (pSum - pT) * pySum) / (pSum * pT * pzSum); //dH/dxv
112  matrix(2, 2) = ((1 / ds - 1 / dT) * dy) / dz - (aSum * (pSum - pT) * pxSum) / (pSum * pT * pzSum); //dH/dyv
113  matrix(2, 3) = 1 / ds + (-ds + dT) / pow(dz, 2); //dH/dzv
114 
115  return matrix;
116 }
T z() const
Definition: PV3DBase.h:61
Common base class.
constexpr int pow(int x)
Definition: conifer.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:19
double a
Definition: hdecay.h:121
*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

◆ value()

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

References a, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, mps_fire::i, EgammaValidation_cff::num, point, conifer::pow(), pv::pT, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

5  {
6  int num = states.size();
7  if (num < 2)
8  throw VertexException("MultiTrackPointingKinematicConstraint::value <2 states passed");
9 
10  //2 equations (for all tracks)
11  AlgebraicVector vl(2, 0);
12  double dx = point.x() - refPoint.x();
13  double dy = point.y() - refPoint.y();
14  double dz = point.z() - refPoint.z();
15  double dT = sqrt(pow(dx, 2) + pow(dy, 2));
16  double ds = sqrt(pow(dx, 2) + pow(dy, 2) + pow(dz, 2));
17 
18  double pxSum = 0, pySum = 0, pzSum = 0;
19  for (std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++) {
20  double a = -i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
21 
22  pxSum += i->kinematicParameters()(3) - a * (point.y() - i->kinematicParameters()(1));
23  pySum += i->kinematicParameters()(4) + a * (point.x() - i->kinematicParameters()(0));
24  pzSum += i->kinematicParameters()(5);
25  }
26 
27  double pT = sqrt(pow(pxSum, 2) + pow(pySum, 2));
28  double pSum = sqrt(pow(pxSum, 2) + pow(pySum, 2) + pow(pzSum, 2));
29 
30  vl(1) = (dT - dx) / dy + (pxSum - pT) / pySum;
31  vl(2) = (ds - dT) / dz + (pT - pSum) / pzSum;
32 
33  return vl;
34 }
T z() const
Definition: PV3DBase.h:61
Common base class.
constexpr int pow(int x)
Definition: conifer.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
CLHEP::HepVector AlgebraicVector
double a
Definition: hdecay.h:121
*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

Member Data Documentation

◆ refPoint

GlobalPoint MultiTrackPointingKinematicConstraint::refPoint
private

Definition at line 58 of file MultiTrackPointingKinematicConstraint.h.

Referenced by positionDerivative(), and value().