CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MSLayersKeeperX0Averaged Class Referencefinal

#include <MSLayersKeeperX0Averaged.h>

Inheritance diagram for MSLayersKeeperX0Averaged:
MSLayersKeeper

Public Member Functions

void init (const edm::EventSetup &iSetup) override
 
MSLayer layer (const DetLayer *layer) const override
 
const MSLayersAtAnglelayers (float cotTheta) const override
 
 MSLayersKeeperX0Averaged ()
 
 ~MSLayersKeeperX0Averaged () override
 
- Public Member Functions inherited from MSLayersKeeper
virtual ~MSLayersKeeper ()
 

Private Attributes

bool isInitialised
 
MSLayersAtAngle theLayersData
 

Additional Inherited Members

- Protected Types inherited from MSLayersKeeper
typedef MSLayer::DataX0 DataX0
 
- Static Protected Member Functions inherited from MSLayersKeeper
static const DataX0getDataX0 (const MSLayer &l)
 
static void setDataX0 (MSLayer &l, const DataX0 &x0Data)
 

Detailed Description

Definition at line 6 of file MSLayersKeeperX0Averaged.h.

Constructor & Destructor Documentation

MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged ( )
inline

Definition at line 8 of file MSLayersKeeperX0Averaged.h.

MSLayersKeeperX0Averaged::~MSLayersKeeperX0Averaged ( )
inlineoverride

Definition at line 9 of file MSLayersKeeperX0Averaged.h.

References MSLayersKeeper::init().

9 {}

Member Function Documentation

void MSLayersKeeperX0Averaged::init ( const edm::EventSetup iSetup)
overridevirtual

Reimplemented from MSLayersKeeper.

Definition at line 7 of file MSLayersKeeperX0Averaged.cc.

References GeomDetEnumerators::barrel, MultipleScatteringGeometry::detLayers(), GeomDetEnumerators::endcap, PVValHelper::eta, spr::find(), MSLayersAtAngle::findLayer(), relativeConstraints::geom, MSLayersKeeper::getDataX0(), mps_fire::i, MSLayersKeeperX0AtEta::init(), isInitialised, hgcalTopologyTester_cfi::layers, MSLayersKeeperX0AtEta::layers(), LaserClient_cfi::nbins, MultipleScatteringGeometry::otherLayers(), MSLayersKeeper::setDataX0(), funct::sin(), slope, mathSSE::sqrt(), combinedConstraintHelpers::sum2(), MSLayer::sumX0D(), MSLayersKeeperX0AtEta::theHalfNBins, theLayersData, MSLayersKeeperX0AtEta::theLayersData, and MSLayer::DataX0::x0.

7  {
8  if (isInitialised)
9  return;
10  isInitialised = true;
11  // cout << "HERE INITIALISATION! MSLayersKeeperX0Averaged"<<endl;
12  MSLayersKeeperX0AtEta layersX0Eta;
13  layersX0Eta.init(iSetup);
15  vector<MSLayer> allLayers = geom.detLayers(iSetup);
16  vector<MSLayer>::iterator it;
17  for (int i = -1; i <= 1; i++) {
18  float eta = i * (-1.8);
19  vector<MSLayer> tmpLayers = geom.otherLayers(eta, iSetup);
20  vector<MSLayer>::const_iterator ic;
21  for (ic = tmpLayers.begin(); ic != tmpLayers.end(); ic++) {
22  it = find(allLayers.begin(), allLayers.end(), *ic);
23  if (it == allLayers.end())
24  allLayers.push_back(*ic);
25  }
26  }
27 
28  for (it = allLayers.begin(); it != allLayers.end(); it++) {
29  float cotTheta = (it->face() == GeomDetEnumerators::barrel) ? it->range().mean() / it->position()
30  : it->position() / it->range().mean();
31 
32  int nbins = 0;
33  float sumX0 = 0.;
34  for (int ibin = 0; ibin < 2 * layersX0Eta.theHalfNBins; ibin++) {
35  const MSLayersAtAngle &layers = layersX0Eta.theLayersData[ibin];
36  const MSLayer *aLayer = layers.findLayer(*it);
37  if (aLayer) {
38  nbins++;
39  sumX0 += getDataX0(*aLayer).x0;
40  }
41  }
42  if (nbins == 0)
43  nbins = 1;
44 
45  float hrange = (it->range().max() - it->range().min()) / 2.;
46  DataX0 dataX0;
47  if (it->face() == GeomDetEnumerators::endcap) {
48  float cot1 = it->position() / (it->range().mean() - hrange / 2);
49  float cot2 = it->position() / (it->range().mean() + hrange / 2);
50  const MSLayer *aLayer1 = layersX0Eta.layers(cot1).findLayer(*it);
51  const MSLayer *aLayer2 = layersX0Eta.layers(cot1).findLayer(*it);
52  float sum1 = aLayer1 ? aLayer1->sumX0D(cot1) : 0.;
53  float sum2 = aLayer2 ? aLayer2->sumX0D(cot2) : 0.;
54  float slope = (sum2 - sum1) / (1 / cot2 - 1 / cot1);
55  float sumX0D = sum1 + slope * (1 / cotTheta - 1 / cot1);
56  dataX0 = DataX0(sumX0 / nbins, sumX0D, cotTheta);
57  dataX0.setForwardSumX0DSlope(slope);
58  } else {
59  float sumX0D = 0;
60  int nb = 10;
61  for (int i = 0; i < nb; i++) {
62  float cot = (it->range().mean() + (2 * i + 1 - nb) * hrange / nb) / it->position();
63  float sin = 1 / sqrt(1 + cot * cot);
64  const MSLayer *aLayer = layersX0Eta.layers(cot).findLayer(*it);
65  if (aLayer)
66  sumX0D += aLayer->sumX0D(cot) * sqrt(sin);
67  }
68  dataX0 = DataX0(sumX0 / nbins, sumX0D / nb, 0);
69  }
70  setDataX0(*it, dataX0);
71  }
72  theLayersData = MSLayersAtAngle(allLayers);
73  // cout << "MSLayersKeeperX0Averaged - LAYERS:"<<endl;
74  // theLayersData.print();
75  // cout << "END OF LAYERS"<<endl;
76 }
const MSLayersAtAngle & layers(float cotTheta) const override
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:145
const MSLayersAtAngle & layers(float cotTheta) const override
static const double slope[3]
MSLayer::DataX0 DataX0
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void init(const edm::EventSetup &iSetup) override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static void setDataX0(MSLayer &l, const DataX0 &x0Data)
T sqrt(T t)
Definition: SSEVec.h:19
static const DataX0 & getDataX0(const MSLayer &l)
const MSLayer * findLayer(const MSLayer &layer) const
std::vector< MSLayersAtAngle > theLayersData
MSLayer MSLayersKeeperX0Averaged::layer ( const DetLayer layer) const
inlineoverridevirtual

Reimplemented from MSLayersKeeper.

Definition at line 11 of file MSLayersKeeperX0Averaged.h.

Referenced by geometryXMLparser.DTAlignable::index(), and geometryXMLparser.CSCAlignable::index().

11 { return *theLayersData.findLayer(MSLayer(layer)); }
const MSLayer * findLayer(const MSLayer &layer) const
const MSLayersAtAngle& MSLayersKeeperX0Averaged::layers ( float  cotTheta) const
inlineoverridevirtual

Implements MSLayersKeeper.

Definition at line 12 of file MSLayersKeeperX0Averaged.h.

12 { return theLayersData; }

Member Data Documentation

bool MSLayersKeeperX0Averaged::isInitialised
private

Definition at line 15 of file MSLayersKeeperX0Averaged.h.

Referenced by init().

MSLayersAtAngle MSLayersKeeperX0Averaged::theLayersData
private

Definition at line 16 of file MSLayersKeeperX0Averaged.h.

Referenced by init().