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 "MSLayersKeeper.h"
00012 #include "MSLayersKeeperX0AtEta.h"
00013 #include "MSLayersKeeperX0Averaged.h"
00014 #include "MSLayersKeeperX0DetLayer.h"
00015 #include "MSLayersAtAngle.h"
00016
00017
00018
00019 #include<iostream>
00020
00021 using namespace std;
00022
00023 const float MultipleScatteringParametrisation::x0ToSigma = 0.0136f;
00024
00025 namespace {
00026 struct Keepers {
00027 MSLayersKeeperX0DetLayer x0DetLayer;
00028 MSLayersKeeperX0AtEta x0AtEta;
00029 MSLayersKeeperX0Averaged x0Averaged;
00030 MSLayersKeeper * keepers[3];
00031 bool isInitialised;
00032 MSLayersKeeper const * operator()(int i) const { return keepers[i];}
00033 void init(const edm::EventSetup &iSetup) {
00034 if (isInitialised) return;
00035 for (auto x : keepers) x->init(iSetup);
00036 isInitialised=true;
00037 }
00038 Keepers() : keepers{&x0DetLayer,&x0AtEta,&x0Averaged}, isInitialised(false) {}
00039 };
00040
00041 const Keepers keepers;
00042
00043 }
00044
00045 void MultipleScatteringParametrisation::initKeepers(const edm::EventSetup &iSetup){
00046 const_cast<Keepers&>(keepers).init(iSetup);
00047 }
00048
00049
00050
00051 MultipleScatteringParametrisation::
00052 MultipleScatteringParametrisation( const DetLayer* layer,const edm::EventSetup &iSetup, X0Source x0Source) :
00053 theLayerKeeper(keepers(x0Source))
00054 {
00055
00056
00057 initKeepers(iSetup);
00058
00059 if (!layer) return;
00060 theLayer = theLayerKeeper->layer(layer);
00061 }
00062
00063
00064 float MultipleScatteringParametrisation::operator()(
00065 float pT, float cotTheta, float) const
00066 {
00067 float sumX0D = theLayer.sumX0D(cotTheta);
00068 return x0ToSigma * sumX0D /pT;
00069 }
00070
00071
00072 float MultipleScatteringParametrisation::operator()(
00073 float pT, float cotTheta, const PixelRecoPointRZ & pointI, float tip) const
00074 {
00075
00076 PixelRecoLineRZ lineIO(pointI, cotTheta, tip);
00077 PixelRecoPointRZ pointO = theLayer.crossing(lineIO).first;
00078
00079 const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
00080
00081 float sumX0D = layersAtEta.sumX0D(pointI, pointO);
00082 return x0ToSigma * sumX0D /pT;
00083 }
00084
00085
00086 float
00087 MultipleScatteringParametrisation::operator()(float pT, float cotTheta, const PixelRecoPointRZ & pointI, int il) const {
00088
00089 PixelRecoLineRZ lineIO(pointI, cotTheta);
00090 PixelRecoPointRZ pointO = theLayer.crossing(lineIO).first;
00091
00092 const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
00093
00094 float sumX0D = layersAtEta.sumX0D(il, theLayer.seqNum(), pointI, pointO);
00095 return x0ToSigma * sumX0D /pT;
00096 }
00097
00098
00099
00100 float MultipleScatteringParametrisation::operator()(
00101 float pT,
00102 const PixelRecoPointRZ & pointI,
00103 const PixelRecoPointRZ & pointO,
00104 Consecutive consecutive,
00105 float tip) const
00106 {
00107
00108
00109 PixelRecoLineRZ lineIO(pointI, pointO, tip);
00110 PixelRecoPointRZ pointM = theLayer.crossing(lineIO).first;
00111 float cotTheta = lineIO.cotLine();
00112
00113 if (consecutive==useConsecutive) {
00114 float dist = fabs( (pointO.r()-pointM.r())
00115 * (pointM.r()-pointI.r())
00116 / (pointO.r()-pointI.r()) );
00117 return x0ToSigma * sqrt(theLayer.x0(cotTheta)) * dist /pT;
00118 } else {
00119 const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
00120 float sumX0D = layersAtEta.sumX0D(pointI, pointM, pointO);
00121 return x0ToSigma * sumX0D /pT;
00122 }
00123 }
00124
00125 float MultipleScatteringParametrisation::operator()(
00126 float pT,
00127 const PixelRecoPointRZ & pointV,
00128 const PixelRecoPointRZ & pointO,
00129 int ol) const
00130 {
00131
00132 PixelRecoLineRZ lineIO(pointV, pointO);
00133 PixelRecoPointRZ pointI = theLayer.crossing(lineIO).first;
00134 float cotTheta = lineIO.cotLine();
00135
00136 const MSLayersAtAngle & layersAtEta = theLayerKeeper->layers(cotTheta);
00137 float sumX0D = layersAtEta.sumX0D(pointV.z(), theLayer.seqNum(), ol, pointI, pointO);
00138 return x0ToSigma * sumX0D /pT;
00139 }