Go to the documentation of this file.00001 #include "RecoPixelVertexing/PixelTriplets/src/ThirdHitCorrection.h"
00002
00003 #include "RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h"
00004 #include "RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisation.h"
00005
00006 using namespace pixelrecoutilities;
00007 template <class T> inline T sqr( T t) {return t*t;}
00008
00009
00010
00011
00012
00013
00014
00015 using pixelrecoutilities::LongitudinalBendingCorrection;
00016
00017 void ThirdHitCorrection::init(const edm::EventSetup& es,
00018 float pt,
00019 const DetLayer * layer,
00020 const PixelRecoLineRZ & line,
00021 const PixelRecoPointRZ & constraint,
00022 bool useMultipleScattering,
00023 bool useBendingCorrection) {
00024
00025 theUseMultipleScattering = useMultipleScattering;
00026 theUseBendingCorrection = useBendingCorrection;
00027 theLine = line;
00028 theMultScattCorrRPhi =0;
00029 theMScoeff=0;
00030
00031 if (!theUseMultipleScattering && !theUseBendingCorrection) return;
00032
00033 theBarrel = (layer->location() == GeomDetEnumerators::barrel);
00034
00035 if (theUseMultipleScattering) {
00036 MultipleScatteringParametrisation sigmaRPhi(layer, es);
00037 theMultScattCorrRPhi = 3.f*sigmaRPhi(pt, line.cotLine(), constraint);
00038 float overSinTheta = std::sqrt(1.f+sqr(line.cotLine()));
00039 if (theBarrel) {
00040 theMScoeff = theMultScattCorrRPhi*overSinTheta;
00041 } else {
00042 float overCosTheta = std::abs(line.cotLine()) < 1.e-4f ?
00043 1.e4f : overSinTheta/std::abs(line.cotLine());
00044 theMScoeff = theMultScattCorrRPhi*overCosTheta;
00045
00046 }
00047 }
00048
00049 if (useBendingCorrection) theBendingCorrection.init(pt,es);
00050
00051 }
00052
00053
00054 void ThirdHitCorrection::correctRPhiRange( Range & range) const
00055 {
00056 if (theUseMultipleScattering) {
00057 range.first -= theMultScattCorrRPhi;
00058 range.second += theMultScattCorrRPhi;
00059 }
00060 }
00061 void ThirdHitCorrection::correctRZRange( Range & range) const
00062 {
00063 if (theUseMultipleScattering) {
00064 range.first -= theMScoeff;
00065 range.second += theMScoeff;
00066 }
00067
00068 if (theUseBendingCorrection) {
00069 if (theBarrel) {
00070 float cotTheta = theLine.cotLine();
00071 if (cotTheta > 0) {
00072 float radius = theLine.rAtZ(range.max());
00073 float corr = theBendingCorrection(radius) * cotTheta;
00074 range.second += corr;
00075 } else {
00076 float radius = theLine.rAtZ(range.min());
00077 float corr = theBendingCorrection(radius) * std::abs(cotTheta);
00078 range.first -= corr;
00079 }
00080 }
00081 else {
00082 float radius = range.max();
00083 float corr = theBendingCorrection(radius);
00084 range.first -= corr;
00085 }
00086 }
00087 }