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 8 of file MSLayersKeeperX0Averaged.h.

Constructor & Destructor Documentation

◆ MSLayersKeeperX0Averaged()

MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged ( )
inline

Definition at line 10 of file MSLayersKeeperX0Averaged.h.

10 : isInitialised(false) {}

◆ ~MSLayersKeeperX0Averaged()

MSLayersKeeperX0Averaged::~MSLayersKeeperX0Averaged ( )
inlineoverride

Definition at line 11 of file MSLayersKeeperX0Averaged.h.

11 {}

Member Function Documentation

◆ init()

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

Reimplemented from MSLayersKeeper.

Definition at line 7 of file MSLayersKeeperX0Averaged.cc.

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 }

References GeomDetEnumerators::barrel, 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, MSLayersKeeper::setDataX0(), funct::sin(), slope, mathSSE::sqrt(), combinedConstraintHelpers::sum2(), MSLayer::sumX0D(), MSLayersKeeperX0AtEta::theHalfNBins, theLayersData, MSLayersKeeperX0AtEta::theLayersData, and MSLayer::DataX0::x0.

◆ layer()

MSLayer MSLayersKeeperX0Averaged::layer ( const DetLayer layer) const
inlineoverridevirtual

◆ layers()

const MSLayersAtAngle& MSLayersKeeperX0Averaged::layers ( float  cotTheta) const
inlineoverridevirtual

Implements MSLayersKeeper.

Definition at line 14 of file MSLayersKeeperX0Averaged.h.

14 { return theLayersData; }

Member Data Documentation

◆ isInitialised

bool MSLayersKeeperX0Averaged::isInitialised
private

Definition at line 17 of file MSLayersKeeperX0Averaged.h.

Referenced by init().

◆ theLayersData

MSLayersAtAngle MSLayersKeeperX0Averaged::theLayersData
private

Definition at line 18 of file MSLayersKeeperX0Averaged.h.

Referenced by init().

MSLayer::sumX0D
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:144
MSLayersKeeperX0Averaged::isInitialised
bool isInitialised
Definition: MSLayersKeeperX0Averaged.h:17
MSLayersKeeperX0AtEta::theLayersData
std::vector< MSLayersAtAngle > theLayersData
Definition: MSLayersKeeperX0AtEta.h:26
mps_fire.i
i
Definition: mps_fire.py:428
MultipleScatteringGeometry
Definition: MultipleScatteringGeometry.h:11
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
GeomDetEnumerators::barrel
Definition: GeomDetEnumerators.h:9
MSLayersKeeperX0AtEta::layers
const MSLayersAtAngle & layers(float cotTheta) const override
Definition: MSLayersKeeperX0AtEta.cc:19
MSLayersAtAngle::findLayer
const MSLayer * findLayer(const MSLayer &layer) const
Definition: MSLayersAtAngle.cc:34
PVValHelper::eta
Definition: PVValidationHelpers.h:70
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MSLayersKeeper::getDataX0
static const DataX0 & getDataX0(const MSLayer &l)
Definition: MSLayersKeeper.h:20
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
MSLayersKeeperX0Averaged::layer
MSLayer layer(const DetLayer *layer) const override
Definition: MSLayersKeeperX0Averaged.h:13
MSLayersAtAngle
Definition: MSLayersAtAngle.h:16
MSLayer
Definition: MSLayer.h:13
MSLayersKeeperX0AtEta::init
void init(const edm::EventSetup &iSetup) override
Definition: MSLayersKeeperX0AtEta.cc:37
MSLayersKeeper::setDataX0
static void setDataX0(MSLayer &l, const DataX0 &x0Data)
Definition: MSLayersKeeper.h:21
MSLayersKeeperX0AtEta
Definition: MSLayersKeeperX0AtEta.h:10
GeomDetEnumerators::endcap
Definition: GeomDetEnumerators.h:9
MSLayer::DataX0::x0
float x0
Definition: MSLayer.h:32
combinedConstraintHelpers::sum2
void sum2(T &x, T y)
Definition: CombinedKinematicConstraintT.h:74
MSLayersKeeper::DataX0
MSLayer::DataX0 DataX0
Definition: MSLayersKeeper.h:19
MSLayersKeeperX0Averaged::layers
const MSLayersAtAngle & layers(float cotTheta) const override
Definition: MSLayersKeeperX0Averaged.h:14
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
MSLayersKeeperX0AtEta::theHalfNBins
int theHalfNBins
Definition: MSLayersKeeperX0AtEta.h:24
MSLayersKeeperX0Averaged::theLayersData
MSLayersAtAngle theLayersData
Definition: MSLayersKeeperX0Averaged.h:18