CMS 3D CMS Logo

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