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 ( GlobalPoint ref)
inline

Member Function Documentation

MultiTrackPointingKinematicConstraint* MultiTrackPointingKinematicConstraint::clone ( void  ) const
inlineoverridevirtual
int MultiTrackPointingKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 114 of file MultiTrackPointingKinematicConstraint.cc.

Referenced by MultiTrackPointingKinematicConstraint().

114  {
115  return 2;
116 }
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 35 of file MultiTrackPointingKinematicConstraint.cc.

References a, cuy::col, mps_fire::i, makeMuonMisalignmentScenario::matrix, pileupDistInMC::num, funct::pow(), PVValHelper::pT, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and z.

Referenced by MultiTrackPointingKinematicConstraint().

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

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

Referenced by MultiTrackPointingKinematicConstraint().

80  {
81  int num = states.size();
82  if(num<2) throw VertexException("MultiTrackPointingKinematicConstraint::positionDerivative <2 states passed");
83 
84  //2 equations (for all tracks)
85  AlgebraicMatrix matrix(2,3,0);
86  double dx = point.x() - refPoint.x();
87  double dy = point.y() - refPoint.y();
88  double dz = point.z() - refPoint.z();
89  double dT = sqrt(pow(dx,2) + pow(dy,2));
90  double ds = sqrt(pow(dx,2) + pow(dy,2) + pow(dz,2));
91 
92  double pxSum=0, pySum=0, pzSum=0, aSum = 0;
93  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++){
94  double a = - i->particleCharge() * i->magneticField()->inInverseGeV(i->globalPosition()).z();
95  aSum += a;
96 
97  pxSum += i->kinematicParameters()(3) - a*(point.y() - i->kinematicParameters()(1));
98  pySum += i->kinematicParameters()(4) + a*(point.x() - i->kinematicParameters()(0));
99  pzSum += i->kinematicParameters()(5);
100  }
101  double pT = sqrt(pow(pxSum,2) + pow(pySum,2));
102  double pSum = sqrt(pow(pxSum,2) + pow(pySum,2) + pow(pzSum,2));
103 
104  matrix(1,1) = (-1 + dx/dT)/dy - aSum/pT + (aSum*(pT - pxSum))/pow(pySum,2);//dH/dxv
105  matrix(1,2) = 1/dT + (-dT + dx)/pow(dy,2) - (aSum*(pT - pxSum))/(pT*pySum);//dH/dyv
106  //dH/dzv=0
107  matrix(2,1) = ((1/ds - 1/dT)*dx)/dz + (aSum*(pSum - pT)*pySum)/(pSum*pT*pzSum);//dH/dxv
108  matrix(2,2) = ((1/ds - 1/dT)*dy)/dz - (aSum*(pSum - pT)*pxSum)/(pSum*pT*pzSum);//dH/dyv
109  matrix(2,3) = 1/ds + (-ds + dT)/pow(dz,2);//dH/dzv
110 
111  return matrix;
112 }
Common base class.
T y() const
Definition: PV3DBase.h:63
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
double a
Definition: hdecay.h:121
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
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, pileupDistInMC::num, funct::pow(), PVValHelper::pT, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by MultiTrackPointingKinematicConstraint().

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

Member Data Documentation

GlobalPoint MultiTrackPointingKinematicConstraint::refPoint
private

Definition at line 59 of file MultiTrackPointingKinematicConstraint.h.

Referenced by positionDerivative(), and value().