CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/RecoTracker/ConversionSeedGenerators/src/IdealHelixParameters.cc

Go to the documentation of this file.
00001 #include "RecoTracker/ConversionSeedGenerators/interface/IdealHelixParameters.h"
00002 
00003 void IdealHelixParameters::
00004 setData(const reco::Track* track,  math::XYZPoint ref){
00005   setData(track,math::XYZVector(ref.x(),ref.y(),ref.z())); 
00006 }
00007 
00008 void IdealHelixParameters::
00009 setData(const reco::Track* track,  math::XYZVector refPoint){
00010 
00011   if(track!=0 && _track!=track){
00012     _track=track;
00013     _refPoint=refPoint;
00014     calculate();
00015   }
00016 
00017   if((refPoint-_refPoint).r()!=0){
00018     _refPoint=refPoint;
00019     calculate();
00020   }
00021 }
00022 
00023 
00024 void IdealHelixParameters::
00025 calculate(){
00026 
00027   LogDebug("IdealHelixParameters")
00028     << "[IdealHelixParameters] " 
00029     << "\n\t "<< "refPoint \t" <<_refPoint
00030     << "\n\t "<< "innerDetid    \t" << _track->innerDetId()
00031     << "\n\t "<< "innerMomentum \t" << _track->innerMomentum()
00032     << "\n\t "<< "innerPosition \t" << _track->innerPosition();
00033 
00034   evalCircleCenter();
00035   
00036   evalTangentPoint();
00037 
00038   evalMomentumatTangentPoint();
00039   
00040 
00041   /* DEBUG
00042     math::XYZVector _checkMomentumAtTangentoPoint (
00043     cos_angle*innerMomentum.x()+sin_angle*innerMomentum.y(), 
00044     -1*sin_angle*innerMomentum.x()+cos_angle*innerMomentum.y(), 
00045     innerMomentum.z()
00046     );
00047     math::XYZVector cp_xy(_checkMomentumAtTangentoPoint.x(),_checkMomentumAtTangentoPoint.y(),0);
00048     float _checktransverseIP = (r_xy.Cross(cp_xy)).z()/cp_xy.rho();
00049 
00050     ss 
00051     << "\n\t "<< "_checkMomentumAtTangentoPoint \t" <<_checkMomentumAtTangentoPoint
00052     << "\n\t "<< "_checktransverseIP \t" <<_checktransverseIP;
00053   */
00054 
00055 }
00056 
00057 void IdealHelixParameters::
00058 evalCircleCenter(){
00059   GlobalPoint  innerPos(_track->innerPosition().x(),_track->innerPosition().y(),_track->innerPosition().z());
00060   GlobalVector innerMom(_track->innerMomentum().x(),_track->innerMomentum().y(),_track->innerMomentum().z());
00061 
00062   GlobalTrajectoryParameters globalTrajParam(
00063                                              innerPos,
00064                                              innerMom,
00065                                              _track->charge(),
00066                                              _magnField
00067                                              );
00068 
00069   _radius = 1./fabs(globalTrajParam.transverseCurvature());
00070   float phi = innerMom.phi();
00071 
00072   //eval Center of the Circumference passing in track->innserPosition
00073   float Xc = innerPos.x() + _track->charge()* _radius * sin(phi);
00074   float Yc = innerPos.y() - _track->charge()* _radius * cos(phi);
00075 
00076   
00077   _circleCenter.SetXYZ(Xc,Yc,innerPos.z());  //NB Z component is useless
00078 
00079   LogDebug("IdealHelixParameters")
00080       << "\n\t "<< "circle center \t" <<_circleCenter
00081       << "\n\t "<< "radius "          <<_radius; 
00082 
00083 }
00084 
00085 
00086 void IdealHelixParameters::
00087 evalMomentumatTangentPoint(){
00088   
00089   if(_tangentPoint.r()==0){
00090     _MomentumAtTangentPoint = math::XYZVector(0.,0.,0.);
00091     return;
00092   }
00093 
00094   math::XYZVector innerPosition(_track->innerPosition().X(),_track->innerPosition().Y(),_track->innerPosition().Z());
00095   math::XYZVector innerMomentum(_track->innerMomentum());
00096 
00097 
00098   math::XYZVector pCi=innerPosition-_circleCenter;
00099   math::XYZVector pCT=_tangentPoint-_circleCenter;
00100 
00101   math::XYZVector pCi_xy(pCi.x(),pCi.y(),0);
00102   math::XYZVector pCT_xy(pCT.x(),pCT.y(),0);
00103   
00104   float cos_angle = pCi_xy.Dot(pCT_xy)/pCi_xy.rho()/pCT_xy.rho();
00105   float sin_angle = pCi_xy.Cross(pCT_xy).z()/pCi_xy.rho()/pCT_xy.rho();
00106 
00107 
00108   _MomentumAtTangentPoint = math::XYZVector(
00109                                             cos_angle*innerMomentum.x()-sin_angle*innerMomentum.y(), 
00110                                             sin_angle*innerMomentum.x()+cos_angle*innerMomentum.y(), 
00111                                             innerMomentum.z()
00112                                             );
00113 
00114   math::XYZVector r_(_tangentPoint.x(),_tangentPoint.y(),0);
00115   math::XYZVector p_(_MomentumAtTangentPoint.x(),_MomentumAtTangentPoint.y(),0);
00116   
00117   _transverseIP = (r_.x()*p_.y()-r_.y()*p_.x())/p_.rho()/r_.rho();
00118   _rotationAngle=atan(sin_angle/cos_angle);
00119 
00120 
00121   
00122   LogDebug("IdealHelixParameters")      << "\n\t "<< "_MomentumAtTangentPoint \t" <<_MomentumAtTangentPoint
00123                                 << "\n\t "<< "sin_angle \t" <<sin_angle << " angle \t" <<asin(sin_angle)
00124                                 << "\n\t "<< "cos_angle \t" <<cos_angle << " angle \t" <<acos(cos_angle)
00125                                 << "\n\t "<< "_rotationAngle \t" <<_rotationAngle
00126                                 << "\n\t "<< "_transverseIP \t" <<_transverseIP
00127                                 << "\n\t "<< " check similitude pz/pt "<< _track->innerMomentum().z()/_track->innerMomentum().rho() << " pZ/pRho " << innerPosition.z()/innerPosition.rho();
00128 }
00129 
00130 
00131 void IdealHelixParameters::
00132 evalTangentPoint(){
00133 
00134   math::XYZVector innerPosition(_track->innerPosition().X(),_track->innerPosition().Y(),_track->innerPosition().Z());
00135 
00136   math::XYZVector vL = _circleCenter-_refPoint;
00137   float l = vL.rho();
00138 
00139   if(l<_radius){
00140     //refpoint is inside the circle
00141     _tangentPoint.SetXYZ(0.,0.,0.);
00142     return;
00143   }
00144 
00145   float sin_alpha = _radius/l;
00146 
00147   //there are two possible tangents, with Point of tangence T1 and T2, and same distance T from _refPoint 
00148   float T=sqrt(l*l-_radius*_radius);
00149 
00150   math::XYZVector vLperp(-vL.y(),vL.x(),0); //NB: z component not correct
00151   math::XYZVector tmpT1 = (1-sin_alpha*sin_alpha)*vL + T/l*sin_alpha*vLperp;
00152   math::XYZVector tmpT2 = (1-sin_alpha*sin_alpha)*vL - T/l*sin_alpha*vLperp;
00153 
00154   if( (tmpT1-innerPosition).rho()<(tmpT2-innerPosition).rho())
00155     _tangentPoint=tmpT1+_refPoint;
00156   else
00157     _tangentPoint=tmpT2+_refPoint;
00158 
00159   //Fix the Z component
00160   _tangentPoint.SetZ( (_tangentPoint.rho()-_refPoint.rho()) * (_track->innerMomentum().z()/_track->innerMomentum().rho()) + _refPoint.z() );
00161 
00162   LogDebug("IdealHelixParameters")<< "\n\t "<< "tangent Point \t" <<_tangentPoint;
00163 }
00164 
00165 bool IdealHelixParameters::
00166 isTangentPointDistanceLessThan(float rMax, const reco::Track* track, const math::XYZVector refPoint){
00167 
00168   setData(track,refPoint);   
00169   if(GetTangentPoint().r()==0){
00170     //this case means a null results on the IdealHelixParameters side
00171     return true;
00172   }
00173       
00174   if(GetTangentPoint().rho()<rMax){
00175         //this case means a track that has the tangent point nearby the primary vertex
00176         // if the track is primary, this number tends to be the primary vertex itself
00177         //Rejecting all the potential photon conversions having a "vertex" inside the beampipe
00178         //We should not miss too much, seen that the conversions at the beam pipe are the better reconstructed
00179     return true;
00180   }
00181 
00182   return false;
00183 }
00184 
00185