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

MSLayer layer (const DetLayer *layer) const override
 
const MSLayersAtAnglelayers (float cotTheta) const override
 
 MSLayersKeeperX0Averaged (const GeometricSearchTracker &tracker, const MagneticField &bfield)
 
 ~MSLayersKeeperX0Averaged () override=default
 
- Public Member Functions inherited from MSLayersKeeper
virtual ~MSLayersKeeper ()
 

Private Attributes

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

Constructor & Destructor Documentation

◆ MSLayersKeeperX0Averaged()

MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged ( const GeometricSearchTracker tracker,
const MagneticField bfield 
)

Definition at line 7 of file MSLayersKeeperX0Averaged.cc.

References GeomDetEnumerators::barrel, GeomDetEnumerators::endcap, PVValHelper::eta, spr::find(), MSLayersAtAngle::findLayer(), relativeConstraints::geom, MSLayersKeeper::getDataX0(), mps_fire::i, hgcalTBTopologyTester_cfi::layers, MSLayersKeeperX0AtEta::layers(), LaserClient_cfi::nbins, MSLayersKeeper::setDataX0(), funct::sin(), slope, mathSSE::sqrt(), MSLayer::sumX0D(), MSLayersKeeperX0AtEta::theHalfNBins, theLayersData, MSLayersKeeperX0AtEta::theLayersData, PbPb_ZMuSkimMuonDPG_cff::tracker, and MSLayer::DataX0::x0.

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

◆ ~MSLayersKeeperX0Averaged()

MSLayersKeeperX0Averaged::~MSLayersKeeperX0Averaged ( )
overridedefault

Member Function Documentation

◆ layer()

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

Reimplemented from MSLayersKeeper.

Definition at line 14 of file MSLayersKeeperX0Averaged.h.

References pixelTopology::layer.

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

14 { return *theLayersData.findLayer(MSLayer(layer)); }
const MSLayer * findLayer(const MSLayer &layer) const
MSLayer layer(const DetLayer *layer) const override

◆ layers()

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

Implements MSLayersKeeper.

Definition at line 15 of file MSLayersKeeperX0Averaged.h.

15 { return theLayersData; }

Member Data Documentation

◆ theLayersData

MSLayersAtAngle MSLayersKeeperX0Averaged::theLayersData
private

Definition at line 18 of file MSLayersKeeperX0Averaged.h.

Referenced by MSLayersKeeperX0Averaged().