CMS 3D CMS Logo

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

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

Private Member Functions

std::pair< AlgebraicMatrix,
AlgebraicVector
makeDerivative (const AlgebraicVector &exPoint) const
 
std::pair< AlgebraicVector,
AlgebraicVector
makeValue (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 21 of file PointingKinematicConstraint.h.

Constructor & Destructor Documentation

PointingKinematicConstraint::PointingKinematicConstraint ( const GlobalPoint ref)
inline

Definition at line 25 of file PointingKinematicConstraint.h.

Referenced by clone().

25  :refPoint(ref)
26  {}

Member Function Documentation

virtual PointingKinematicConstraint* PointingKinematicConstraint::clone ( ) const
inlinevirtual

Clone method

Implements KinematicConstraint.

Definition at line 53 of file PointingKinematicConstraint.h.

References PointingKinematicConstraint().

54  {return new PointingKinematicConstraint(*this);}
PointingKinematicConstraint(const GlobalPoint &ref)
std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::derivative ( const AlgebraicVector exPoint) const
virtual

Implements KinematicConstraint.

Definition at line 24 of file PointingKinematicConstraint.cc.

References makeDerivative().

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

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

Implements KinematicConstraint.

Definition at line 42 of file PointingKinematicConstraint.cc.

References makeDerivative().

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

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 174 of file PointingKinematicConstraint.cc.

175 {return AlgebraicVector(7*nStates,0);}
CLHEP::HepVector AlgebraicVector
std::pair< AlgebraicMatrix, AlgebraicVector > PointingKinematicConstraint::makeDerivative ( const AlgebraicVector exPoint) const
private

Definition at line 106 of file PointingKinematicConstraint.cc.

References point, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by derivative().

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

Definition at line 69 of file PointingKinematicConstraint.cc.

References point, refPoint, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by value().

70 {
71  AlgebraicVector vl(2,0);
72  AlgebraicVector point = exPoint;
73  double dx = point(1) - refPoint.x();
74  double dy = point(2) - refPoint.y();
75  double dz = point(3) - refPoint.z();
76  double px = point(4);
77  double py = point(5);
78  double pz = point(6);
79 
80 // tangent solution
81 // vl(1) = dy/dx - py/px;
82 // vl(2) = dz/sqrt(dx*dx + dy*dy) - pz/sqrt(px*px + py*py);
83 
84 
85 //half angle solution
86  double sin_p = py/sqrt(px*px + py*py);
87  double cos_p = px/sqrt(px*px + py*py);
88  double sin_x = dy/sqrt(dx*dx + dy*dy);
89  double cos_x = dx/sqrt(dx*dx + dy*dy);
90 
91  double sin_pt = pz/sqrt(px*px + py*py + pz*pz);
92  double cos_pt = sqrt(px*px + py*py)/sqrt(px*px + py*py + pz*pz);
93  double sin_xt = dz/sqrt(dx*dx + dy*dy + dz*dz);
94  double cos_xt = sqrt(dx*dx + dy*dy)/sqrt(dx*dx + dy*dy + dz*dz);
95 
96  vl(1) = (1-cos_x)/sin_x - (1-cos_p)/sin_p;
97  vl(2) = (1-cos_xt)/sin_xt - (1-cos_pt)/sin_pt;
98 
99 //half angle corrected
100 // vl(1) = (sin_x/(1+cos_x)) - (sin_p/(1+cos_p));
101 // vl(2) = (sin_xt/(1+cos_xt)) - (sin_pt/(1+cos_pt));
102  return std::pair<AlgebraicVector,AlgebraicVector>(vl,point);
103 }
T y() const
Definition: PV3DBase.h:63
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
CLHEP::HepVector AlgebraicVector
T x() const
Definition: PV3DBase.h:62
*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
int PointingKinematicConstraint::numberOfEquations ( ) const
virtual

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

Implements KinematicConstraint.

Definition at line 177 of file PointingKinematicConstraint.cc.

178 {return 2;}
std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::value ( const AlgebraicVector exPoint) const
virtual

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().

5 {
6  if(exPoint.num_row() ==0 ) 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) throw VertexException("PointingKinematicConstraint::linearization point has a wrong dimension");
11  int nStates = inSize/7;
12  if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit");
13 
14  AlgebraicVector lPar = exPoint;
15  AlgebraicVector vl(2,0);
16 
17 //vector of values 1x2 for given particle
18  AlgebraicVector lValue = makeValue(lPar).first;
19  vl(1) =lValue(1);
20  vl(2) =lValue(2);
21  return std::pair<AlgebraicVector,AlgebraicVector>(vl,lPar);
22 }
Common base class.
std::pair< AlgebraicVector, AlgebraicVector > makeValue(const AlgebraicVector &exPoint) const
CLHEP::HepVector AlgebraicVector
std::pair< AlgebraicVector, AlgebraicVector > PointingKinematicConstraint::value ( const std::vector< RefCountedKinematicParticle > &  par) const
virtual

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 57 of file PointingKinematicConstraint.cc.

References makeValue().

58 {
59  int nStates = par.size();
60  if(nStates == 0) throw VertexException("PointingKinematicConstraint::Empty vector of particles passed");
61  if(nStates != 1) throw VertexException("PointingKinematicConstraint::Current version does not support the multistate refit");
62  AlgebraicVector vl(2,0);
63  AlgebraicVector lPoint = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
64  vl(1) = makeValue(lPoint).first(1);
65  vl(2) = makeValue(lPoint).first(2);
66  return std::pair<AlgebraicVector,AlgebraicVector>(vl,lPoint);
67 }
Common base class.
std::pair< AlgebraicVector, AlgebraicVector > makeValue(const AlgebraicVector &exPoint) const
CLHEP::HepVector AlgebraicVector

Member Data Documentation

GlobalPoint PointingKinematicConstraint::refPoint
private

Definition at line 61 of file PointingKinematicConstraint.h.

Referenced by makeDerivative(), and makeValue().