CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
VertexKinematicConstraint Class Reference

#include <VertexKinematicConstraint.h>

Inheritance diagram for VertexKinematicConstraint:
MultiTrackKinematicConstraint

Public Member Functions

virtual VertexKinematicConstraintclone () const
 
virtual int numberOfEquations () const
 
virtual AlgebraicMatrix parametersDerivative (const std::vector< KinematicState > &states, const GlobalPoint &point) const
 
virtual AlgebraicMatrix positionDerivative (const std::vector< KinematicState > &states, const GlobalPoint &point) const
 
virtual AlgebraicVector value (const std::vector< KinematicState > &states, const GlobalPoint &point) const
 
 VertexKinematicConstraint ()
 
virtual ~VertexKinematicConstraint ()
 
- Public Member Functions inherited from MultiTrackKinematicConstraint
 MultiTrackKinematicConstraint ()
 
virtual ~MultiTrackKinematicConstraint ()
 

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

Constructor & Destructor Documentation

VertexKinematicConstraint::VertexKinematicConstraint ( )

Definition at line 5 of file VertexKinematicConstraint.cc.

Referenced by clone().

6 {}
VertexKinematicConstraint::~VertexKinematicConstraint ( )
virtual

Definition at line 8 of file VertexKinematicConstraint.cc.

9 {}

Member Function Documentation

virtual VertexKinematicConstraint* VertexKinematicConstraint::clone ( void  ) const
inlinevirtual
int VertexKinematicConstraint::numberOfEquations ( ) const
virtual

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 170 of file VertexKinematicConstraint.cc.

171 {return 2;}
AlgebraicMatrix VertexKinematicConstraint::parametersDerivative ( const std::vector< KinematicState > &  states,
const GlobalPoint point 
) const
virtual

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

Implements MultiTrackKinematicConstraint.

Definition at line 56 of file VertexKinematicConstraint.cc.

References delta, i, gen::k, m, n, pileupDistInMC::num, RecoTauCleanerPlugins::pt, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::transverse(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicConstrainedVertexUpdator::update().

58 {
59  int num = states.size();
60  if(num<2) throw VertexException("VertexKinematicConstraint::<2 states passed");
61  AlgebraicMatrix jac_d(2*num,7*num);
62  int num_r = 0;
63  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
64  {
65  AlgebraicMatrix el_part_d(2,7,0);
66  TrackCharge ch = i->particleCharge();
67  GlobalVector mom = i->globalMomentum();
68  GlobalPoint pos = i->globalPosition();
69  double d_x = point.x() - pos.x();
70  double d_y = point.y() - pos.y();
71  double pt = mom.transverse();
72 
73  if(ch !=0){
74 
75  //charged particle
76  double a_i = - ch * i->magneticField()->inInverseGeV(pos).z();
77 
78  double pvx = mom.x() - a_i*d_y;
79  double pvy = mom.y() + a_i*d_x;
80  double pvt = sqrt(pvx*pvx+pvy*pvy);
81  double novera = (d_x * mom.x() + d_y * mom.y());
82  double n = a_i*novera;
83  double m = (pvx*mom.x() + pvy*mom.y());
84  double k = -mom.z()/(pvt*pvt*pt*pt);
85  double delta = atan2(n,m);
86 
87  //D Jacobian matrix
88  el_part_d(1,1) = mom.y() + a_i*d_x;
89  el_part_d(1,2) = -mom.x() + a_i*d_y;
90  el_part_d(2,1) = -k*(m*mom.x() - n*mom.y());
91  el_part_d(2,2) = -k*(m*mom.y() + n*mom.x());
92  el_part_d(2,3) = -1.;
93  el_part_d(1,4) = d_y;
94  el_part_d(1,5) = -d_x;
95  el_part_d(2,4) = k*(m*d_x - novera*(2*mom.x() - a_i*d_y));
96  el_part_d(2,5) = k*(m*d_y - novera*(2*mom.y() + a_i*d_x));
97  el_part_d(2,6) = -delta /a_i;
98  jac_d.sub(num_r*2+1, num_r*7+1, el_part_d);
99  }else{
100  //neutral particle
101  el_part_d(1,1) = mom.y();
102  el_part_d(1,2) = -mom.x();
103  el_part_d(2,1) = mom.x() * mom.z()/(pt*pt);
104  el_part_d(2,2) = mom.y() * mom.z()/(pt*pt);
105  el_part_d(2,3) = -1.;
106  el_part_d(1,4) = d_y;
107  el_part_d(1,5) = -d_x;
108  el_part_d(2,4) = 2*(d_x*mom.x()+d_y*mom.y())*mom.x()*mom.z()/(pt*pt*pt*pt) - mom.z()*d_x/(pt*pt);
109  el_part_d(2,5) = 2*(d_x*mom.x()+d_y*mom.y())*mom.y()*mom.z()/(pt*pt*pt*pt) - mom.z()*d_y/(pt*pt);
110  el_part_d(2,6) =-(d_x * mom.x() + d_y * mom.y())/(pt*pt);
111  jac_d.sub(num_r*2+1, num_r*7+1, el_part_d);
112  }
113  num_r++;
114  }
115  return jac_d;
116 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
Common base class.
T y() const
Definition: PV3DBase.h:63
T transverse() const
Definition: PV3DBase.h:73
int TrackCharge
Definition: TrackCharge.h:4
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
int k[5][pyjets_maxn]
T x() const
Definition: PV3DBase.h:62
AlgebraicMatrix VertexKinematicConstraint::positionDerivative ( const std::vector< KinematicState > &  states,
const GlobalPoint point 
) const
virtual

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

Implements MultiTrackKinematicConstraint.

Definition at line 118 of file VertexKinematicConstraint.cc.

References i, gen::k, m, n, pileupDistInMC::num, RecoTauCleanerPlugins::pt, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::transverse(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicConstrainedVertexUpdator::update().

120 {
121  int num = states.size();
122  if(num<2) throw VertexException("VertexKinematicConstraint::<2 states passed");
123  AlgebraicMatrix jac_e(2*num,3);
124  int num_r = 0;
125  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
126  {
127  AlgebraicMatrix el_part_e(2,3,0);
128  TrackCharge ch = i->particleCharge();
129  GlobalVector mom = i->globalMomentum();
130  GlobalPoint pos = i->globalPosition();
131  double d_x = point.x() - pos.x();
132  double d_y = point.y() - pos.y();
133  double pt = mom.transverse();
134 
135  if(ch !=0 )
136  {
137 
138 //charged particle
139  double a_i = - ch * i->magneticField()->inInverseGeV(pos).z();
140 
141  double pvx = mom.x() - a_i*d_y;
142  double pvy = mom.y() + a_i*d_x;
143  double pvt = sqrt(pvx*pvx+pvy*pvy);
144  double n = a_i*(d_x * mom.x() + d_y * mom.y());
145  double m = (pvx*mom.x() + pvy*mom.y());
146  double k = -mom.z()/(pvt*pvt*pt*pt);
147 
148 //E jacobian matrix
149  el_part_e(1,1) = -(mom.y() + a_i*d_x);
150  el_part_e(1,2) = mom.x() - a_i*d_y;
151  el_part_e(2,1) = k*(m*mom.x() - n*mom.y());
152  el_part_e(2,2) = k*(m*mom.y() + n*mom.x());
153  el_part_e(2,3) = 1;
154  jac_e.sub(2*num_r+1,1,el_part_e);
155  }else{
156 
157 //neutral particle
158  el_part_e(1,1) = - mom.y();
159  el_part_e(1,2) = mom.x();
160  el_part_e(2,1) = -mom.x()*mom.z()/(pt*pt);
161  el_part_e(2,2) = -mom.y()*mom.z()/(pt*pt);
162  el_part_e(2,3) = 1;
163  jac_e.sub(2*num_r+1,1,el_part_e);
164  }
165  num_r++;
166  }
167  return jac_e;
168 }
int i
Definition: DBlmapReader.cc:9
Common base class.
T y() const
Definition: PV3DBase.h:63
T transverse() const
Definition: PV3DBase.h:73
int TrackCharge
Definition: TrackCharge.h:4
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
int k[5][pyjets_maxn]
T x() const
Definition: PV3DBase.h:62
AlgebraicVector VertexKinematicConstraint::value ( const std::vector< KinematicState > &  states,
const GlobalPoint point 
) const
virtual

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

Implements MultiTrackKinematicConstraint.

Definition at line 11 of file VertexKinematicConstraint.cc.

References delta, i, m, n, pileupDistInMC::num, RecoTauCleanerPlugins::pt, PV3DBase< T, PVType, FrameType >::transverse(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicConstrainedVertexUpdator::update().

13 {
14  int num = states.size();
15  if(num<2) throw VertexException("VertexKinematicConstraint::<2 states passed");
16 
17 //it is 2 equations per track
18  AlgebraicVector vl(2*num,0);
19  int num_r = 0;
20  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
21  {
22  TrackCharge ch = i->particleCharge();
23  GlobalVector mom = i->globalMomentum();
24  GlobalPoint pos = i->globalPosition();
25  double d_x = point.x() - pos.x();
26  double d_y = point.y() - pos.y();
27  double d_z = point.z() - pos.z();
28  double pt = mom.transverse();
29 
30  if(ch !=0)
31  {
32 
33 //charged particle
34  double a_i = - ch * i->magneticField()->inInverseGeV(pos).z();
35 
36  double pvx = mom.x() - a_i*d_y;
37  double pvy = mom.y() + a_i*d_x;
38  double n = a_i*(d_x * mom.x() + d_y * mom.y());
39  double m = (pvx*mom.x() + pvy*mom.y());
40  double delta = atan2(n,m);
41 
42 //vector of values
43  vl(num_r*2 +1) = d_y*mom.x() - d_x*mom.y() -a_i*(d_x*d_x + d_y*d_y)/2;
44  vl(num_r*2 +2) = d_z - mom.z()*delta/a_i;
45  }else{
46 
47 //neutral particle
48  vl(num_r*2 +1) = d_y*mom.x() - d_x*mom.y();
49  vl(num_r*2 +2) = d_z - mom.z()*(d_x * mom.x() + d_y * mom.y())/(pt*pt);
50  }
51  num_r++;
52  }
53  return vl;
54 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
Common base class.
T y() const
Definition: PV3DBase.h:63
T transverse() const
Definition: PV3DBase.h:73
int TrackCharge
Definition: TrackCharge.h:4
T z() const
Definition: PV3DBase.h:64
CLHEP::HepVector AlgebraicVector
T x() const
Definition: PV3DBase.h:62