#include <RecoTracker/TkMSParametrization/interface/MSLayersKeeperX0Averaged.h>
Public Member Functions | |
virtual void | init (const edm::EventSetup &iSetup) |
virtual MSLayer | layer (const DetLayer *layer) const |
virtual const MSLayersAtAngle & | layers (float cotTheta) const |
MSLayersKeeperX0Averaged () | |
virtual | ~MSLayersKeeperX0Averaged () |
Private Attributes | |
bool | isInitialised |
MSLayersAtAngle | theLayersData |
Definition at line 6 of file MSLayersKeeperX0Averaged.h.
MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged | ( | ) | [inline] |
virtual MSLayersKeeperX0Averaged::~MSLayersKeeperX0Averaged | ( | ) | [inline, virtual] |
void MSLayersKeeperX0Averaged::init | ( | const edm::EventSetup & | iSetup | ) | [virtual] |
Reimplemented from MSLayersKeeper.
Definition at line 7 of file MSLayersKeeperX0Averaged.cc.
References GeomDetEnumerators::barrel, MultipleScatteringGeometry::detLayers(), GeomDetEnumerators::endcap, eta, find(), MSLayersAtAngle::findLayer(), MSLayersKeeper::getDataX0(), i, MSLayersKeeperX0AtEta::init(), isInitialised, it, MSLayersKeeperX0AtEta::layers(), layers(), MultipleScatteringGeometry::otherLayers(), MSLayersKeeper::setDataX0(), funct::sin(), slope, funct::sqrt(), MSLayer::sumX0D(), MSLayersKeeperX0AtEta::theHalfNBins, theLayersData, MSLayersKeeperX0AtEta::theLayersData, and MSLayer::DataX0::x0.
00008 { 00009 if (isInitialised) return; 00010 isInitialised = true; 00011 // cout << "HERE INITIALISATION! MSLayersKeeperX0Averaged"<<endl; 00012 MSLayersKeeperX0AtEta layersX0Eta; 00013 layersX0Eta.init(iSetup); 00014 MultipleScatteringGeometry geom(iSetup); 00015 vector<MSLayer> allLayers = geom.detLayers(iSetup); 00016 vector<MSLayer>::iterator it; 00017 for (int i=-1;i<=1;i++) { 00018 float eta = i*(-1.8); 00019 vector<MSLayer> tmpLayers = geom.otherLayers(eta,iSetup); 00020 vector<MSLayer>::const_iterator ic; 00021 for (ic = tmpLayers.begin(); ic != tmpLayers.end(); ic++) { 00022 it = find(allLayers.begin(), allLayers.end(), *ic); 00023 if (it == allLayers.end()) allLayers.push_back(*ic); 00024 } 00025 } 00026 00027 00028 00029 for (it = allLayers.begin(); it != allLayers.end(); it++) { 00030 float cotTheta = (it->face()==GeomDetEnumerators::barrel) ? 00031 it->range().mean()/it->position() 00032 : it->position()/it->range().mean(); 00033 00034 int nbins = 0; 00035 float sumX0 = 0.; 00036 for (int ibin = 0; ibin < 2*layersX0Eta.theHalfNBins; ibin++) { 00037 const MSLayersAtAngle & layers = layersX0Eta.theLayersData[ibin]; 00038 const MSLayer * aLayer = layers.findLayer(*it); 00039 if (aLayer) { nbins++; sumX0 += getDataX0(*aLayer).x0; } 00040 } 00041 if ( nbins==0) nbins=1; 00042 00043 float hrange= (it->range().max()-it->range().min())/2.; 00044 DataX0 dataX0; 00045 if (it->face()==GeomDetEnumerators::endcap) { 00046 float cot1 = it->position()/(it->range().mean()-hrange/2); 00047 float cot2 = it->position()/(it->range().mean()+hrange/2); 00048 const MSLayer * aLayer1 = layersX0Eta.layers(cot1).findLayer(*it); 00049 const MSLayer * aLayer2 = layersX0Eta.layers(cot1).findLayer(*it); 00050 float sum1 = aLayer1 ? aLayer1->sumX0D(cot1) : 0.; 00051 float sum2 = aLayer2 ? aLayer2->sumX0D(cot2) : 0.; 00052 float slope = (sum2-sum1)/(1/cot2-1/cot1); 00053 float sumX0D = sum1 + slope*(1/cotTheta-1/cot1); 00054 dataX0 = DataX0(sumX0/nbins, sumX0D, cotTheta); 00055 dataX0.setForwardSumX0DSlope(slope); 00056 } else { 00057 float sumX0D = 0; 00058 int nb=10; 00059 for (int i=0; i<nb; i++) { 00060 float cot = (it->range().mean()+(2*i+1-nb)*hrange/nb)/it->position(); 00061 float sin = 1/sqrt(1+cot*cot); 00062 const MSLayer * aLayer = layersX0Eta.layers(cot).findLayer(*it); 00063 if (aLayer) sumX0D += aLayer->sumX0D(cot) * sqrt(sin); 00064 } 00065 dataX0 = DataX0(sumX0/nbins, sumX0D/nb, 0); 00066 } 00067 setDataX0(*it, dataX0); 00068 } 00069 theLayersData = MSLayersAtAngle(allLayers); 00070 // cout << "MSLayersKeeperX0Averaged - LAYERS:"<<endl; 00071 // theLayersData.print(); 00072 // cout << "END OF LAYERS"<<endl; 00073 }
Reimplemented from MSLayersKeeper.
Definition at line 11 of file MSLayersKeeperX0Averaged.h.
References MSLayersAtAngle::findLayer(), and theLayersData.
00012 {return *theLayersData.findLayer(MSLayer(layer)); }
virtual const MSLayersAtAngle& MSLayersKeeperX0Averaged::layers | ( | float | cotTheta | ) | const [inline, virtual] |
Implements MSLayersKeeper.
Definition at line 13 of file MSLayersKeeperX0Averaged.h.
References theLayersData.
Referenced by init().
00014 {return theLayersData;}
bool MSLayersKeeperX0Averaged::isInitialised [private] |
Definition at line 18 of file MSLayersKeeperX0Averaged.h.