CMS 3D CMS Logo

MSLayersKeeperX0DetLayer.cc
Go to the documentation of this file.
8 
9 #include <vector>
10 
11 using namespace std;
12 
14 {
15  if (isInitialised) return;
16  isInitialised = true;
17  // vector<MSLayer> allLayers = MSLayersKeeperX0DetLayerGeom().detLayers();
18  //MP
19  vector<MSLayer> allLayers;
20  theLayersData = MSLayersAtAngle(allLayers);
21 
22  vector<MSLayer>::iterator it;
23  PixelRecoPointRZ zero(0.,0.);
24  for (it = allLayers.begin(); it != allLayers.end(); it++) {
25  PixelRecoPointRZ middle = it->face()== GeomDetEnumerators::barrel ?
26  PixelRecoPointRZ(it->position(), it->range().mean())
27  : PixelRecoPointRZ(it->range().mean(), it->position());
28 
29  float cotTheta = PixelRecoLineRZ(zero,middle).cotLine();
30  float x0 = getDataX0(*it).x0;
31 
32  DataX0 dataX0;
33  if (it->face()== GeomDetEnumerators::barrel) {
34  float sumX0D = theLayersData.sumX0D(zero, middle);
35  dataX0 = DataX0(x0, sumX0D, cotTheta);
36  } else {
37  float hrange= (it->range().max()-it->range().min())/2.;
38  float cot1 = it->position()/(it->range().mean()-hrange/2);
39  float cot2 = it->position()/(it->range().mean()+hrange/2);
40  PixelRecoLineRZ line1(zero,cot1);
41  PixelRecoLineRZ line2(zero,cot2);
42  float sum1 = theLayersData.sumX0D(zero,it->crossing(line1).first);
43  float sum2 = theLayersData.sumX0D(zero,it->crossing(line2).first);
44  float slope = (sum2-sum1)/(1/cot2-1/cot1);
45  float sumX0D = sum1 + slope*(1/cotTheta-1/cot1);
46  dataX0 = DataX0(x0, sumX0D, cotTheta);
47  dataX0.setForwardSumX0DSlope(slope);
48  }
49  setDataX0(*it, dataX0);
50  theLayersData.update(*it);
51  }
52  //cout << "MSLayersKeeperX0DetLayer LAYERS: "<<endl;
53  //theLayersData.print();
54 }
55 
56 // vector<MSLayer>
57 // MSLayersKeeperX0DetLayer::MSLayersKeeperX0DetLayerGeom::detLayers() const
58 // {
59 
60 // vector<MSLayer> result;
61 
62 // vector<const DetLayer*>::const_iterator it;
63 // for (it = theLayers.begin(); it != theLayers.end(); it++) {
64 
65 // // const DetUnit * du = (*it)->detUnits().front();
66 // const GeomDetUnit * du;
67 // //MP how access the geomdetunit??
68 // const MediumProperties * mp = du->surface().mediumProperties();
69 // float x0 = (mp) ? mp->radLen() : 0.03;
70 // cout << "MediumProperties: "<<mp<<" x0="<<x0<<endl;
71 // MSLayer layer(*it, DataX0(x0,0,0));
72 // result.push_back( layer);
73 // }
74 // return result;
75 // }
76 
virtual void init(const edm::EventSetup &iSetup)
static const double slope[3]
float cotLine() const
if(dp >Float(M_PI)) dp-