00001 #include "RecoTracker/TkMSParametrization/interface/MSLayersKeeperX0DetLayer.h"
00002 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00003 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00004 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
00005 #include "DataFormats/GeometrySurface/interface/BoundSurface.h"
00006 #include "DataFormats/GeometrySurface/interface/MediumProperties.h"
00007 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00008
00009 #include <vector>
00010
00011 using namespace std;
00012
00013 void MSLayersKeeperX0DetLayer::init(const edm::EventSetup &iSetup)
00014 {
00015 if (isInitialised) return;
00016 isInitialised = true;
00017
00018
00019 vector<MSLayer> allLayers;
00020 theLayersData = MSLayersAtAngle(allLayers);
00021
00022 vector<MSLayer>::iterator it;
00023 PixelRecoPointRZ zero(0.,0.);
00024 for (it = allLayers.begin(); it != allLayers.end(); it++) {
00025 PixelRecoPointRZ middle = it->face()== GeomDetEnumerators::barrel ?
00026 PixelRecoPointRZ(it->position(), it->range().mean())
00027 : PixelRecoPointRZ(it->range().mean(), it->position());
00028
00029 float cotTheta = PixelRecoLineRZ(zero,middle).cotLine();
00030 float x0 = getDataX0(*it).x0;
00031
00032 DataX0 dataX0;
00033 if (it->face()== GeomDetEnumerators::barrel) {
00034 float sumX0D = theLayersData.sumX0D(zero, middle);
00035 dataX0 = DataX0(x0, sumX0D, cotTheta);
00036 } else {
00037 float hrange= (it->range().max()-it->range().min())/2.;
00038 float cot1 = it->position()/(it->range().mean()-hrange/2);
00039 float cot2 = it->position()/(it->range().mean()+hrange/2);
00040 PixelRecoLineRZ line1(zero,cot1);
00041 PixelRecoLineRZ line2(zero,cot2);
00042 float sum1 = theLayersData.sumX0D(zero,it->crossing(line1).first);
00043 float sum2 = theLayersData.sumX0D(zero,it->crossing(line2).first);
00044 float slope = (sum2-sum1)/(1/cot2-1/cot1);
00045 float sumX0D = sum1 + slope*(1/cotTheta-1/cot1);
00046 dataX0 = DataX0(x0, sumX0D, cotTheta);
00047 dataX0.setForwardSumX0DSlope(slope);
00048 }
00049 setDataX0(*it, dataX0);
00050 theLayersData.update(*it);
00051 }
00052 cout << "MSLayersKeeperX0DetLayer LAYERS: "<<endl;
00053 theLayersData.print();
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076