00001 #ifndef PixelRecoUtilities_H 00002 #define PixelRecoUtilities_H 00003 #include "DataFormats/GeometryVector/interface/GlobalVector.h" 00004 #include "FWCore/Framework/interface/ESHandle.h" 00005 #include "FWCore/Framework/interface/EventSetup.h" 00006 #include <string> 00007 00013 namespace PixelRecoUtilities { 00014 00017 struct FieldAt0 { 00018 FieldAt0(const edm::EventSetup& es); 00019 float fieldInInvGev; 00020 }; 00021 00026 inline float fieldInInvGev(const edm::EventSetup& iSetup) { 00027 static FieldAt0 fieldAt0(iSetup); 00028 return fieldAt0.fieldInInvGev; 00029 } 00030 // void MaginTesla(const edm::EventSetup& c); 00034 template <typename T> 00035 T bendingRadius(T pt,const edm::EventSetup& iSetup) {return pt*fieldInInvGev(iSetup);} 00036 00040 template <typename T> 00041 T curvature(T InversePt,const edm::EventSetup& iSetup) {return InversePt/fieldInInvGev(iSetup);} 00042 00044 template <typename T> 00045 T inversePt (T curvature,const edm::EventSetup& iSetup) {return curvature*fieldInInvGev(iSetup);} 00046 00047 00051 inline double longitudinalBendingCorrection( double radius, double pt,const edm::EventSetup& iSetup) { 00052 double invCurv = bendingRadius(pt,iSetup); 00053 if ( invCurv == 0. ) return 0.; 00054 return radius/6. * radius*radius/(2.*invCurv * 2.*invCurv); 00055 } 00056 00057 00058 } 00059 00060 #endif