CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/TrackingTools/TrajectoryParametrization/src/GlobalTrajectoryParameters.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00002 #include "MagneticField/Engine/interface/MagneticField.h"
00003 #include "FWCore/Utilities/interface/Likely.h"
00004 
00005 GlobalTrajectoryParameters::GlobalTrajectoryParameters(const GlobalPoint& aX,
00006                                                        const GlobalVector& direction,
00007                                                        float transverseCurvature, int, 
00008                                                        const MagneticField* fieldProvider) :
00009   theField(fieldProvider),
00010   theX(aX), cachedCurvature_(transverseCurvature),  hasCurvature_(true)
00011 {
00012   float bza = -2.99792458e-3f * theField->inTesla(theX).z();
00013   float qbpi = bza/(direction.perp()*transverseCurvature);
00014   theP = direction*std::abs(qbpi);
00015   theCharge = qbpi > 0.f ? 1 : -1;
00016 }
00017 
00018 float GlobalTrajectoryParameters::transverseCurvature() const
00019 {
00020   if unlikely(!hasCurvature_) {
00021       float bza = -2.99792458e-3f * theField->inTesla(theX).z();
00022       cachedCurvature_ = bza*signedInverseTransverseMomentum();
00023       hasCurvature_ = true;
00024   }
00025   return cachedCurvature_;
00026 }
00027 
00028 GlobalVector GlobalTrajectoryParameters::magneticFieldInInverseGeV( const GlobalPoint& x) const
00029 {
00030   return 2.99792458e-3f * theField->inTesla(x);
00031 }
00032 
00033 
00034 /*  the field is different as it is attached to each given volume!!!!
00035 // const MagneticField* GlobalTrajectoryParameters::theField=0;
00036 #include<iostream>
00037 // FIXME debug code mostly
00038 void GlobalTrajectoryParameters::setMF(const MagneticField* fieldProvider) {
00039   if (0==fieldProvider) return;
00040   if (0!=theField && fieldProvider!=theField)
00041     std::cout << "GlobalTrajectoryParameters: a different MF???? " 
00042               << theField << " " << fieldProvider << std::endl;
00043   theField =fieldProvider;
00044 }
00045 */