CMS 3D CMS Logo

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

#include <PointingKinematicConstraint.h>

Inheritance diagram for PointingKinematicConstraint:
KinematicConstraint

Public Member Functions

PointingKinematicConstraintclone () const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const std::vector< RefCountedKinematicParticle > &par) const override
 
AlgebraicVector deviations (int nStates) const override
 
int numberOfEquations () const override
 
 PointingKinematicConstraint (const GlobalPoint &ref)
 
std::pair< AlgebraicVector, AlgebraicVectorvalue (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicVector, AlgebraicVectorvalue (const std::vector< RefCountedKinematicParticle > &par) const override
 
- Public Member Functions inherited from KinematicConstraint
 KinematicConstraint ()
 
virtual ~KinematicConstraint ()
 

Private Member Functions

std::pair< AlgebraicMatrix, AlgebraicVectormakeDerivative (const AlgebraicVector &exPoint) const
 
std::pair< AlgebraicVector, AlgebraicVectormakeValue (const AlgebraicVector &exPoint) const
 

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 pointing the the primary vertex

Multiple track refit is not supported in current version

Kirill Prokofiev, March 2004 MultiState version: July 2004

Definition at line 19 of file PointingKinematicConstraint.h.

Constructor & Destructor Documentation

◆ PointingKinematicConstraint()

PointingKinematicConstraint::PointingKinematicConstraint ( const GlobalPoint ref)
inline

Definition at line 21 of file PointingKinematicConstraint.h.

Referenced by clone().

Member Function Documentation

◆ clone()

PointingKinematicConstraint* PointingKinematicConstraint::clone ( ) const
inlineoverridevirtual

Clone method

Implements KinematicConstraint.

Definition at line 49 of file PointingKinematicConstraint.h.

References PointingKinematicConstraint().

49 { return new PointingKinematicConstraint(*this); }
PointingKinematicConstraint(const GlobalPoint &ref)

◆ derivative() [1/2]

std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::derivative ( const AlgebraicVector exPoint) const
overridevirtual

Implements KinematicConstraint.

Definition at line 26 of file PointingKinematicConstraint.cc.

References flavorHistoryFilter_cfi::dr, and makeDerivative().

27  {
28  if (exPoint.num_row() == 0)
29  throw VertexException("PointingKinematicConstraint::value requested for zero Linearization point");
30 
31  //security check for extended cartesian parametrization
32  int inSize = exPoint.num_row();
33  if ((inSize % 7) != 0)
34  throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension");
35  int nStates = inSize / 7;
36  if (nStates != 1)
37  throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit");
38  AlgebraicVector lPar = exPoint;
39 
40  //2x7 derivative matrix for given particle
41  AlgebraicMatrix lDeriv = makeDerivative(lPar).first;
42  AlgebraicMatrix dr(2, 7, 0);
43  dr.sub(1, 1, lDeriv);
44  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, lPar);
45 }
Common base class.
std::pair< AlgebraicMatrix, AlgebraicVector > makeDerivative(const AlgebraicVector &exPoint) const
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector

◆ derivative() [2/2]

std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::derivative ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Vector of values and matrix of derivatives calculated using current state parameters as expansion point

Implements KinematicConstraint.

Definition at line 47 of file PointingKinematicConstraint.cc.

References flavorHistoryFilter_cfi::dr, and makeDerivative().

48  {
49  int nStates = par.size();
50  if (nStates == 0)
51  throw VertexException("PointingKinematicConstraint::Empty vector of particles passed");
52  if (nStates != 1)
53  throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit");
54 
55  AlgebraicMatrix dr(2, 7, 0);
56  AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
57 
58  //2x7 derivative matrix for given state
59  AlgebraicMatrix lDeriv = makeDerivative(lPoint).first;
60  dr.sub(1, 1, lDeriv);
61  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, lPoint);
62 }
Common base class.
std::pair< AlgebraicMatrix, AlgebraicVector > makeDerivative(const AlgebraicVector &exPoint) const
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector

◆ deviations()

AlgebraicVector PointingKinematicConstraint::deviations ( int  nStates) const
overridevirtual

Returns vector of sigma squared associated to the KinematicParameters of refitted particles Initial deviations are given by user for the constraining parameters (mass, momentum components etc). In case of multiple states exactly the same values are added to every particle parameters

Implements KinematicConstraint.

Definition at line 182 of file PointingKinematicConstraint.cc.

182 { return AlgebraicVector(7 * nStates, 0); }
CLHEP::HepVector AlgebraicVector

◆ makeDerivative()

std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::makeDerivative ( const AlgebraicVector exPoint) const
private

Definition at line 113 of file PointingKinematicConstraint.cc.

References flavorHistoryFilter_cfi::dr, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, point, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by derivative().

114  {
115  AlgebraicMatrix dr(2, 7, 0);
116  AlgebraicVector point = exPoint;
117  double dx = point(1) - refPoint.x();
118  double dy = point(2) - refPoint.y();
119  double dz = point(3) - refPoint.z();
120  double px = point(4);
121  double py = point(5);
122  double pz = point(6);
123 
124  // double tr = px*px + py*py;
125  // double trd = dx*dx + dy*dy;
126  // double pr =1.5;
127  // double p_factor = pow(tr,pr);
128  // double x_factor = pow(trd,pr);
129 
130  //tangent solution
131  /*
132  dr(1,1) = -dy/(dx*dx);
133  dr(1,2) = 1/dx;
134  dr(1,3) = 0;
135  dr(1,4) = py/(px*px);
136  dr(1,5) = -1/px;
137  dr(1,6) = 0;
138  dr(1,7) = 0;
139 
140  dr(2,1) = -(dx*dz)/x_factor;
141  dr(2,2) = -(dy*dz)/x_factor;
142  dr(2,3) = 1/sqrt(dx*dx + dy*dy);
143  dr(2,4) = (px*pz)/p_factor;
144  dr(2,5) = (py*pz)/p_factor;
145  dr(2,6) = -1/sqrt(px*px + py*py);
146  dr(2,7) = 0.;
147 */
148  //half angle solution corrected
149  /*
150  dr(1,1) = - dy/(dx*dx+dy*dy+dx*sqrt(dx*dx+dy*dy));
151  dr(1,2) = dx/(dx*dx+dy*dy+dx*sqrt(dx*dx+dy*dy));
152  dr(1,3) = 0;
153  dr(1,4) = py/(px*px+py*py+px*sqrt(px*px+py*py));
154  dr(1,5) = -px/(px*px+py*py+px*sqrt(px*px+py*py));
155  dr(1,6) = 0;
156  dr(1,7) = 0;
157 */
158 
159  //half angle solution
160  dr(1, 1) = dx / (dy * sqrt(dx * dx + dy * dy)) - 1 / dy;
161  dr(1, 2) = 1 / sqrt(dx * dx + dy * dy) - sqrt(dx * dx + dy * dy) / (dy * dy) + dx / (dy * dy);
162  dr(1, 3) = 0;
163  dr(1, 4) = -(px / (py * sqrt(px * px + py * py)) - 1 / py);
164  dr(1, 5) = -(1 / sqrt(px * px + py * py) - sqrt(px * px + py * py) / (py * py) + px / (py * py));
165  dr(1, 6) = 0;
166  dr(1, 7) = 0;
167 
168  //half angle solution
169  dr(2, 1) = (dx / dz) * (1 / sqrt(dx * dx + dy * dy + dz * dz) - 1 / sqrt(dx * dx + dy * dy));
170  dr(2, 2) = (dy / dz) * (1 / sqrt(dx * dx + dy * dy + dz * dz) - 1 / sqrt(dx * dx + dy * dy));
171  dr(2, 3) = (1 / (dz * dz)) * (sqrt(dx * dx + dy * dy) - sqrt(dx * dx + dy * dy + dz * dz)) +
172  1 / sqrt(dx * dx + dy * dy + dz * dz);
173  dr(2, 4) = -(px / pz) * (1 / sqrt(px * px + py * py + pz * pz) - 1 / sqrt(px * px + py * py));
174  dr(2, 5) = -(py / pz) * (1 / sqrt(px * px + py * py + pz * pz) - 1 / sqrt(px * px + py * py));
175  dr(2, 6) = -((1 / (pz * pz)) * (sqrt(px * px + py * py) - sqrt(px * px + py * py + pz * pz)) +
176  1 / sqrt(px * px + py * py + pz * pz));
177  dr(2, 7) = 0;
178 
179  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, point);
180 }
T z() const
Definition: PV3DBase.h:61
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
CLHEP::HepVector AlgebraicVector
*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

◆ makeValue()

std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::makeValue ( const AlgebraicVector exPoint) const
private

Definition at line 78 of file PointingKinematicConstraint.cc.

References PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, point, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by value().

79  {
80  AlgebraicVector vl(2, 0);
81  AlgebraicVector point = exPoint;
82  double dx = point(1) - refPoint.x();
83  double dy = point(2) - refPoint.y();
84  double dz = point(3) - refPoint.z();
85  double px = point(4);
86  double py = point(5);
87  double pz = point(6);
88 
89  // tangent solution
90  // vl(1) = dy/dx - py/px;
91  // vl(2) = dz/sqrt(dx*dx + dy*dy) - pz/sqrt(px*px + py*py);
92 
93  //half angle solution
94  double sin_p = py / sqrt(px * px + py * py);
95  double cos_p = px / sqrt(px * px + py * py);
96  double sin_x = dy / sqrt(dx * dx + dy * dy);
97  double cos_x = dx / sqrt(dx * dx + dy * dy);
98 
99  double sin_pt = pz / sqrt(px * px + py * py + pz * pz);
100  double cos_pt = sqrt(px * px + py * py) / sqrt(px * px + py * py + pz * pz);
101  double sin_xt = dz / sqrt(dx * dx + dy * dy + dz * dz);
102  double cos_xt = sqrt(dx * dx + dy * dy) / sqrt(dx * dx + dy * dy + dz * dz);
103 
104  vl(1) = (1 - cos_x) / sin_x - (1 - cos_p) / sin_p;
105  vl(2) = (1 - cos_xt) / sin_xt - (1 - cos_pt) / sin_pt;
106 
107  //half angle corrected
108  // vl(1) = (sin_x/(1+cos_x)) - (sin_p/(1+cos_p));
109  // vl(2) = (sin_xt/(1+cos_xt)) - (sin_pt/(1+cos_pt));
110  return std::pair<AlgebraicVector, AlgebraicVector>(vl, point);
111 }
T z() const
Definition: PV3DBase.h:61
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
*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

◆ numberOfEquations()

int PointingKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Returns number of constraint equations used for fitting. Method is relevant for proper NDF calculations.

Implements KinematicConstraint.

Definition at line 184 of file PointingKinematicConstraint.cc.

184 { return 2; }

◆ value() [1/2]

std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::value ( const AlgebraicVector exPoint) const
overridevirtual

Vector of values and matrix of derivatives calculated at given expansion 7xNumberOfStates point

Implements KinematicConstraint.

Definition at line 4 of file PointingKinematicConstraint.cc.

References makeValue().

4  {
5  if (exPoint.num_row() == 0)
6  throw VertexException("PointingKinematicConstraint::value requested for zero Linearization point");
7 
8  //security check for extended cartesian parametrization
9  int inSize = exPoint.num_row();
10  if ((inSize % 7) != 0)
11  throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension");
12  int nStates = inSize / 7;
13  if (nStates != 1)
14  throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit");
15 
16  AlgebraicVector lPar = exPoint;
17  AlgebraicVector vl(2, 0);
18 
19  //vector of values 1x2 for given particle
20  AlgebraicVector lValue = makeValue(lPar).first;
21  vl(1) = lValue(1);
22  vl(2) = lValue(2);
23  return std::pair<AlgebraicVector, AlgebraicVector>(vl, lPar);
24 }
Common base class.
std::pair< AlgebraicVector, AlgebraicVector > makeValue(const AlgebraicVector &exPoint) const
CLHEP::HepVector AlgebraicVector

◆ value() [2/2]

std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::value ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Methods making value and derivative matrix using current state parameters as expansion 7-point. Constraint can be made equaly for single and multiple states

Implements KinematicConstraint.

Definition at line 64 of file PointingKinematicConstraint.cc.

References makeValue().

65  {
66  int nStates = par.size();
67  if (nStates == 0)
68  throw VertexException("PointingKinematicConstraint::Empty vector of particles passed");
69  if (nStates != 1)
70  throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit");
71  AlgebraicVector vl(2, 0);
72  AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
73  vl(1) = makeValue(lPoint).first(1);
74  vl(2) = makeValue(lPoint).first(2);
75  return std::pair<AlgebraicVector, AlgebraicVector>(vl, lPoint);
76 }
Common base class.
std::pair< AlgebraicVector, AlgebraicVector > makeValue(const AlgebraicVector &exPoint) const
CLHEP::HepVector AlgebraicVector

Member Data Documentation

◆ refPoint

GlobalPoint PointingKinematicConstraint::refPoint
private

Definition at line 55 of file PointingKinematicConstraint.h.

Referenced by makeDerivative(), and makeValue().