CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IdealHelixParameters.cc
Go to the documentation of this file.
2 
4 setData(const reco::Track* track, const math::XYZPoint& ref){
5  setData(track,math::XYZVector(ref.x(),ref.y(),ref.z()));
6 }
7 
9 setData(const reco::Track* track, const math::XYZVector& refPoint){
10 
11  if(track!=0 && _track!=track){
12  _track=track;
13  _refPoint=refPoint;
14  calculate();
15  }
16 
17  if((refPoint-_refPoint).r()!=0){
18  _refPoint=refPoint;
19  calculate();
20  }
21 }
22 
23 
26 
27  LogDebug("IdealHelixParameters")
28  << "[IdealHelixParameters] "
29  << "\n\t "<< "refPoint \t" <<_refPoint
30  << "\n\t "<< "innerDetid \t" << _track->innerDetId()
31  << "\n\t "<< "innerMomentum \t" << _track->innerMomentum()
32  << "\n\t "<< "innerPosition \t" << _track->innerPosition();
33 
35 
37 
39 
40 
41  /* DEBUG
42  math::XYZVector _checkMomentumAtTangentoPoint (
43  cos_angle*innerMomentum.x()+sin_angle*innerMomentum.y(),
44  -1*sin_angle*innerMomentum.x()+cos_angle*innerMomentum.y(),
45  innerMomentum.z()
46  );
47  math::XYZVector cp_xy(_checkMomentumAtTangentoPoint.x(),_checkMomentumAtTangentoPoint.y(),0);
48  float _checktransverseIP = (r_xy.Cross(cp_xy)).z()/cp_xy.rho();
49 
50  ss
51  << "\n\t "<< "_checkMomentumAtTangentoPoint \t" <<_checkMomentumAtTangentoPoint
52  << "\n\t "<< "_checktransverseIP \t" <<_checktransverseIP;
53  */
54 
55 }
56 
61 
62  GlobalTrajectoryParameters globalTrajParam(
63  innerPos,
64  innerMom,
65  _track->charge(),
67  );
68 
69  _radius = 1./fabs(globalTrajParam.transverseCurvature());
70  float phi = innerMom.phi();
71 
72  //eval Center of the Circumference passing in track->innserPosition
73  float Xc = innerPos.x() + _track->charge()* _radius * sin(phi);
74  float Yc = innerPos.y() - _track->charge()* _radius * cos(phi);
75 
76 
77  _circleCenter.SetXYZ(Xc,Yc,innerPos.z()); //NB Z component is useless
78 
79  LogDebug("IdealHelixParameters")
80  << "\n\t "<< "circle center \t" <<_circleCenter
81  << "\n\t "<< "radius " <<_radius;
82 
83 }
84 
85 
88 
89  if(_tangentPoint.r()==0){
91  return;
92  }
93 
94  math::XYZVector innerPosition(_track->innerPosition().X(),_track->innerPosition().Y(),_track->innerPosition().Z());
95  math::XYZVector innerMomentum(_track->innerMomentum());
96 
97 
98  math::XYZVector pCi=innerPosition-_circleCenter;
100 
101  math::XYZVector pCi_xy(pCi.x(),pCi.y(),0);
102  math::XYZVector pCT_xy(pCT.x(),pCT.y(),0);
103 
104  float cos_angle = pCi_xy.Dot(pCT_xy)/pCi_xy.rho()/pCT_xy.rho();
105  float sin_angle = pCi_xy.Cross(pCT_xy).z()/pCi_xy.rho()/pCT_xy.rho();
106 
107 
109  cos_angle*innerMomentum.x()-sin_angle*innerMomentum.y(),
110  sin_angle*innerMomentum.x()+cos_angle*innerMomentum.y(),
111  innerMomentum.z()
112  );
113 
116 
117  _transverseIP = (r_.x()*p_.y()-r_.y()*p_.x())/p_.rho()/r_.rho();
118  _rotationAngle=atan(sin_angle/cos_angle);
119 
120 
121 
122  LogDebug("IdealHelixParameters") << "\n\t "<< "_MomentumAtTangentPoint \t" <<_MomentumAtTangentPoint
123  << "\n\t "<< "sin_angle \t" <<sin_angle << " angle \t" <<asin(sin_angle)
124  << "\n\t "<< "cos_angle \t" <<cos_angle << " angle \t" <<acos(cos_angle)
125  << "\n\t "<< "_rotationAngle \t" <<_rotationAngle
126  << "\n\t "<< "_transverseIP \t" <<_transverseIP
127  << "\n\t "<< " check similitude pz/pt "<< _track->innerMomentum().z()/_track->innerMomentum().rho() << " pZ/pRho " << innerPosition.z()/innerPosition.rho();
128 }
129 
130 
133 
134  math::XYZVector innerPosition(_track->innerPosition().X(),_track->innerPosition().Y(),_track->innerPosition().Z());
135 
137  float l = vL.rho();
138 
139  if(l<_radius){
140  //refpoint is inside the circle
141  _tangentPoint.SetXYZ(0.,0.,0.);
142  return;
143  }
144 
145  float sin_alpha = _radius/l;
146 
147  //there are two possible tangents, with Point of tangence T1 and T2, and same distance T from _refPoint
148  float T=sqrt(l*l-_radius*_radius);
149 
150  math::XYZVector vLperp(-vL.y(),vL.x(),0); //NB: z component not correct
151  math::XYZVector tmpT1 = (1-sin_alpha*sin_alpha)*vL + T/l*sin_alpha*vLperp;
152  math::XYZVector tmpT2 = (1-sin_alpha*sin_alpha)*vL - T/l*sin_alpha*vLperp;
153 
154  if( (tmpT1-innerPosition).rho()<(tmpT2-innerPosition).rho())
155  _tangentPoint=tmpT1+_refPoint;
156  else
157  _tangentPoint=tmpT2+_refPoint;
158 
159  //Fix the Z component
160  _tangentPoint.SetZ( (_tangentPoint.rho()-_refPoint.rho()) * (_track->innerMomentum().z()/_track->innerMomentum().rho()) + _refPoint.z() );
161 
162  LogDebug("IdealHelixParameters")<< "\n\t "<< "tangent Point \t" <<_tangentPoint;
163 }
164 
166 isTangentPointDistanceLessThan(float rMax, const reco::Track* track, const math::XYZVector& refPoint){
167 
168  setData(track,refPoint);
169  if(GetTangentPoint().r()==0){
170  //this case means a null results on the IdealHelixParameters side
171  return true;
172  }
173 
174  if(GetTangentPoint().rho()<rMax){
175  //this case means a track that has the tangent point nearby the primary vertex
176  // if the track is primary, this number tends to be the primary vertex itself
177  //Rejecting all the potential photon conversions having a "vertex" inside the beampipe
178  //We should not miss too much, seen that the conversions at the beam pipe are the better reconstructed
179  return true;
180  }
181 
182  return false;
183 }
184 
185 
#define LogDebug(id)
void setData(const reco::Track *track, const math::XYZVector &refPoint=math::XYZVector(0, 0, 0))
const reco::Track * _track
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:42
math::XYZVector _MomentumAtTangentPoint
math::XYZVector GetTangentPoint() const
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZVector _circleCenter
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:45
const MagneticField * _magnField
bool isTangentPointDistanceLessThan(float rmax, const reco::Track *track, const math::XYZVector &refPoint)
int charge() const
track electric charge
Definition: TrackBase.h:111
long double T
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:61
math::XYZVector _tangentPoint
Definition: DDAxes.h:10