CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TrackingTools/TrajectoryParametrization/src/CurvilinearTrajectoryParameters.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryParameters.h"
00002 
00003 
00004 CurvilinearTrajectoryParameters::CurvilinearTrajectoryParameters(const AlgebraicVector5& v, bool charged) {
00005   theQbp    = v[0];
00006   thelambda = v[1];
00007   thephi    = v[2];
00008   thexT     = v[3];
00009   theyT     = v[4];
00010   
00011   if ( charged )
00012     theCharge = theQbp>0 ? 1 : -1;
00013   else
00014     theCharge = 0;
00015   
00016 }
00017 
00018 
00019 CurvilinearTrajectoryParameters::CurvilinearTrajectoryParameters(double aQbp, double alambda, double aphi, double axT, double ayT, bool charged): theQbp(aQbp), thelambda(alambda), thephi(aphi), thexT(axT), theyT(ayT) {
00020     
00021     if ( charged ) {
00022       theQbp = aQbp;
00023       theCharge = theQbp>0 ? 1 : -1;
00024     }
00025     else {
00026       theQbp = aQbp;
00027       theCharge = 0;
00028     }
00029 }
00030   
00031 
00032 CurvilinearTrajectoryParameters::CurvilinearTrajectoryParameters(const GlobalPoint& aX,const GlobalVector& aP,TrackCharge aCharge)
00033 {
00034   if(aCharge==0) 
00035     theQbp = 1./aP.mag();
00036   else
00037     theQbp=aCharge/aP.mag();
00038 
00039   double pT2= aP.x()*aP.x()+aP.y()*aP.y();
00040   double pT =sqrt(pT2);
00041   thelambda= atan(aP.z()/pT);
00042   thephi=atan2(aP.y(),aP.x());
00043   thexT= (-aP.y()*aX.x()+ aP.x()*aX.y()) / pT;
00044   theyT= (-aX.x()*aP.x()*aP.z() - aX.y()*aP.z()*aP.y() + aX.z()*(pT2))  / (aP.mag()*pT);
00045   theCharge=aCharge;
00046 }
00047 
00048 
00049 
00050 
00051 AlgebraicVector5 CurvilinearTrajectoryParameters::vector() const {
00052   return AlgebraicVector5(signedInverseMomentum(),
00053                           thelambda,
00054                           thephi,
00055                           thexT,
00056                           theyT);
00057 }
00058 
00059 
00060 
00061 bool CurvilinearTrajectoryParameters::updateP(double dP) {
00062   //FIXME. something is very likely to be missing here
00063   double p = 1./fabs(theQbp);
00064   if ((p += dP) <= 0.) return false;
00065   double newQbp = theQbp > 0. ? 1./p : -1./p;
00066   theQbp = newQbp;
00067   return true;
00068 }