CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/RecoTracker/TkMSParametrization/src/MultipleScatteringParametrisation.cc

Go to the documentation of this file.
00001 
00002 #include <vector>
00003 #include "RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisation.h"
00004 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00005 #include "RecoTracker/TkMSParametrization/interface/PixelRecoPointRZ.h"
00006 #include "RecoTracker/TkMSParametrization/interface/PixelRecoLineRZ.h"
00007 
00008 
00009 template <class T> inline T sqr( T t) {return t*t;}
00010 
00011 #include "RecoTracker/TkMSParametrization/interface/MSLayersKeeper.h"
00012 #include "RecoTracker/TkMSParametrization/interface/MSLayersKeeperX0AtEta.h"
00013 #include "RecoTracker/TkMSParametrization/interface/MSLayersKeeperX0Averaged.h"
00014 #include "RecoTracker/TkMSParametrization/interface/MSLayersKeeperX0DetLayer.h"
00015 #include "RecoTracker/TkMSParametrization/interface/MSLayersAtAngle.h"
00016 
00017 //#include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h"
00018 
00019 #include<iostream>
00020 
00021 using namespace std;
00022 
00023 const float MultipleScatteringParametrisation::x0ToSigma = 0.0136f;
00024 
00025 //using namespace PixelRecoUtilities;
00026 //----------------------------------------------------------------------
00027 MultipleScatteringParametrisation::
00028 MultipleScatteringParametrisation( const DetLayer* layer,const edm::EventSetup &iSetup, X0Source x0Source)
00029  
00030 {
00031   switch (x0Source) {
00032   case useX0AtEta: { 
00033     static MSLayersKeeperX0AtEta x0AtEta; 
00034     theLayerKeeper = &x0AtEta;
00035     break;
00036   }
00037   case useX0DataAveraged: {
00038     static MSLayersKeeperX0Averaged x0Averaged;
00039     theLayerKeeper = &x0Averaged;
00040     break;
00041   }
00042 
00043   case useDetLayer: {
00044     static MSLayersKeeperX0DetLayer x0DetLayer;
00045     theLayerKeeper = &x0DetLayer;
00046     break;
00047   }
00048   default:
00049     //FIXME should throw or similar
00050     cout << "** MultipleScatteringParametrisation ** wrong x0Source"<<endl;
00051     return;
00052   }
00053   theLayerKeeper->init(iSetup);
00054   if (!layer) return;
00055   theLayer = theLayerKeeper->layer(layer);
00056 } 
00057 
00058 //----------------------------------------------------------------------
00059 float MultipleScatteringParametrisation::operator()(
00060     float pT, float cotTheta, float tip) const
00061 {
00062   float sumX0D = theLayer.sumX0D(cotTheta); 
00063   return x0ToSigma * sumX0D /pT;
00064 }
00065 
00066 //----------------------------------------------------------------------
00067 float MultipleScatteringParametrisation::operator()(
00068   float pT, float cotTheta, const PixelRecoPointRZ & pointI, float tip) const
00069 {
00070 
00071   PixelRecoLineRZ lineIO(pointI, cotTheta, tip);
00072   PixelRecoPointRZ pointO = theLayer.crossing(lineIO).first;
00073 
00074   const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
00075   
00076   float sumX0D = layersAtEta.sumX0D(pointI, pointO);
00077   return x0ToSigma * sumX0D /pT;
00078 }
00079 
00080 //----------------------------------------------------------------------
00081 float MultipleScatteringParametrisation::operator()(
00082     float pT,
00083     const PixelRecoPointRZ & pointI,
00084     const PixelRecoPointRZ & pointO,
00085     Consecutive consecutive,
00086     float tip) const
00087 {   
00088 
00089 
00090   PixelRecoLineRZ lineIO(pointI, pointO, tip);
00091   PixelRecoPointRZ pointM = theLayer.crossing(lineIO).first;
00092   float cotTheta = lineIO.cotLine();
00093 
00094   if (consecutive==useConsecutive) {
00095     float dist = fabs(  (pointO.r()-pointM.r())
00096                       * (pointM.r()-pointI.r())
00097                       / (pointO.r()-pointI.r()) );
00098     return  x0ToSigma * sqrt(theLayer.x0(cotTheta)) * dist /pT;
00099   } else {
00100     const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
00101     float sumX0D = layersAtEta.sumX0D(pointI, pointM, pointO);
00102     return x0ToSigma * sumX0D /pT;
00103   }
00104 }