CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
MSLayersKeeperX0AtEta Class Referencefinal

#include <MSLayersKeeperX0AtEta.h>

Inheritance diagram for MSLayersKeeperX0AtEta:
MSLayersKeeper

Public Member Functions

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

Private Member Functions

float eta (int idxBin) const
 
int idxBin (float eta) const
 

Static Private Member Functions

static void setX0 (std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &)
 

Private Attributes

float theDeltaEta
 
int theHalfNBins
 
std::vector< MSLayersAtAngletheLayersData
 

Friends

class MSLayersKeeperX0Averaged
 

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 13 of file MSLayersKeeperX0AtEta.h.

Constructor & Destructor Documentation

◆ MSLayersKeeperX0AtEta()

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

Definition at line 37 of file MSLayersKeeperX0AtEta.cc.

References newFWLiteAna::bin, HLT_2022v15_cff::candidates, PVValHelper::eta, ALCARECOTkAlBeamHalo_cff::etaMax, MSLayersAtAngle::findLayer(), newFWLiteAna::found, hgcalTopologyTester_cfi::layers, makeLayoutFileForGui::layout, mps_splice::line, SiStripPI::max, MultipleScatteringX0Data::maxEta(), MultipleScatteringX0Data::nBinsEta(), jetsAK4_CHS_cff::sort, PbPb_ZMuSkimMuonDPG_cff::tracker, and SiPixelPI::zero.

37  {
38  const float BIG = 99999.;
39 
40  // set size from data file
41  MultipleScatteringX0Data msX0data;
42  theHalfNBins = msX0data.nBinsEta();
43  float etaMax = msX0data.maxEta();
44  theDeltaEta = (theHalfNBins != 0) ? etaMax / theHalfNBins : BIG;
45 
46  theLayersData = vector<MSLayersAtAngle>(max(2 * theHalfNBins, 1));
48  for (int idxbin = 0; idxbin < 2 * theHalfNBins; idxbin++) {
49  float etaValue = eta(idxbin);
50  float cotTheta = sinh(etaValue);
51 
52  vector<MSLayer> layers = layout.detLayers(etaValue, 0, bfield);
53  vector<MSLayer> tmplay = layout.otherLayers(etaValue);
54  layers.insert(layers.end(), tmplay.begin(), tmplay.end());
55  sort(layers.begin(), layers.end());
56  setX0(layers, etaValue, msX0data);
58  PixelRecoPointRZ zero(0., 0.);
59  PixelRecoLineRZ line(zero, cotTheta);
60  vector<MSLayer>::iterator it;
61  for (it = layers.begin(); it != layers.end(); it++) {
62  float x0 = getDataX0(*it).x0;
63  float sumX0D = theLayersData[idxbin].sumX0D(zero, it->crossing(line).first);
64  setDataX0(*it, DataX0(x0, sumX0D, cotTheta));
65  theLayersData[idxbin].update(*it);
66  }
67  }
68 
69  // add layers not seen from nominal vertex but crossed if
70  // vertex seperated from nominal by less than 3 sigma
71  for (int idxbin = 0; idxbin < 2 * theHalfNBins; idxbin++) {
72  float etaValue = eta(idxbin);
73  for (int isign = -1; isign <= 1; isign += 2) {
74  float z = isign * 15.9; //3 sigma from zero
75  const MSLayersAtAngle& layersAtAngle = theLayersData[idxbin];
76  vector<MSLayer> candidates = layout.detLayers(etaValue, z, bfield);
77  vector<MSLayer>::iterator it;
78  for (it = candidates.begin(); it != candidates.end(); it++) {
79  if (layersAtAngle.findLayer(*it))
80  continue;
81  const MSLayer* found = nullptr;
82  int bin = idxbin;
83  while (!found) {
84  bin--;
85  if (bin < 0)
86  break;
87  found = theLayersData[bin].findLayer(*it);
88  }
89  bin = idxbin;
90  while (!found) {
91  bin++;
92  if (bin > 2 * theHalfNBins - 1)
93  break;
94  found = theLayersData[bin].findLayer(*it);
95  }
96  if (found)
97  theLayersData[idxbin].update(*found);
98  }
99  }
100  }
101 
102  // cout << "LAYERS, size=: "<<theLayersData.size()<< endl;
103  /*
104  for (int idxbin = 0; idxbin <= theHalfNBins; idxbin+=25) {
105  float etaValue = eta(idxbin);
106  const MSLayersAtAngle & layers= theLayersData[idxbin];
107  cout << "ETA: "<< etaValue <<" (bin:"<<idxbin<<") #layers:"
108  <<layers.size()<<endl;
109  layers.print();
110  }
111  for (int idxbin = 2*theHalfNBins-1; idxbin > theHalfNBins; idxbin-=25) {
112  float etaValue = eta(idxbin);
113  const MSLayersAtAngle & layers= theLayersData[idxbin];
114  cout << "ETA: "<< etaValue <<" (bin:"<<idxbin<<") #layers:"
115  <<layers.size()<<endl;
116  layers.print();
117  }
118 */
119 }
MSLayer::DataX0 DataX0
const MSLayersAtAngle & layers(float cotTheta) const override
const MSLayer * findLayer(const MSLayer &layer) const
static void setDataX0(MSLayer &l, const DataX0 &x0Data)
float eta(int idxBin) const
static const DataX0 & getDataX0(const MSLayer &l)
static void setX0(std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &)
std::vector< MSLayersAtAngle > theLayersData

◆ ~MSLayersKeeperX0AtEta()

MSLayersKeeperX0AtEta::~MSLayersKeeperX0AtEta ( )
overridedefault

Member Function Documentation

◆ eta()

float MSLayersKeeperX0AtEta::eta ( int  idxBin) const
private

◆ idxBin()

int MSLayersKeeperX0AtEta::idxBin ( float  eta) const
private

◆ layers()

const MSLayersAtAngle & MSLayersKeeperX0AtEta::layers ( float  cotTheta) const
overridevirtual

Implements MSLayersKeeper.

Definition at line 19 of file MSLayersKeeperX0AtEta.cc.

References PVValHelper::eta.

Referenced by MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged().

19  {
20  float eta = unsafe_asinhf(cotTheta);
21  return theLayersData[idxBin(eta)];
22 }
int idxBin(float eta) const
float eta(int idxBin) const
std::vector< MSLayersAtAngle > theLayersData

◆ setX0()

void MSLayersKeeperX0AtEta::setX0 ( std::vector< MSLayer > &  layers,
float  eta,
const SumX0AtEtaDataProvider sumX0 
)
staticprivate

Definition at line 122 of file MSLayersKeeperX0AtEta.cc.

References GeomDetEnumerators::barrel, PVValHelper::eta, hgcalTopologyTester_cfi::layers, mps_splice::line, funct::sqr(), mathSSE::sqrt(), and SumX0AtEtaDataProvider::sumX0atEta().

122  {
123  const float BIG = 99999.;
124  float cotTheta = sinh(eta);
125  float sinTheta = 1 / sqrt(1 + sqr(cotTheta));
126  float cosTheta = cotTheta * sinTheta;
127 
128  float sumX0atAngleLast = 0.;
129  vector<MSLayer>::iterator il;
130  for (il = layers.begin(); il != layers.end(); il++) {
131  PixelRecoLineRZ line(PixelRecoPointRZ(0., 0.), cotTheta);
132  float rL = (*il).crossing(line).first.r();
133  float rN = (il + 1 != layers.end()) ? (il + 1)->crossing(line).first.r() : BIG;
134  float rBound = (rL + rN) / 2.;
135  float sumX0atAngle = sumX0.sumX0atEta(eta, rBound);
136 
137  float dX0 = (il->face() == GeomDetEnumerators::barrel) ? (sumX0atAngle - sumX0atAngleLast) * sinTheta
138  : (sumX0atAngle - sumX0atAngleLast) * fabs(cosTheta);
139 
140  setDataX0(*il, DataX0(dX0, 0, cotTheta));
141  sumX0atAngleLast = sumX0atAngle;
142  }
143 }
MSLayer::DataX0 DataX0
const MSLayersAtAngle & layers(float cotTheta) const override
virtual float sumX0atEta(float eta, float r) const =0
static void setDataX0(MSLayer &l, const DataX0 &x0Data)
T sqrt(T t)
Definition: SSEVec.h:19
float eta(int idxBin) const
Square< F >::type sqr(const F &f)
Definition: Square.h:14

Friends And Related Function Documentation

◆ MSLayersKeeperX0Averaged

friend class MSLayersKeeperX0Averaged
friend

Definition at line 28 of file MSLayersKeeperX0AtEta.h.

Member Data Documentation

◆ theDeltaEta

float MSLayersKeeperX0AtEta::theDeltaEta
private

Definition at line 26 of file MSLayersKeeperX0AtEta.h.

◆ theHalfNBins

int MSLayersKeeperX0AtEta::theHalfNBins
private

◆ theLayersData

std::vector<MSLayersAtAngle> MSLayersKeeperX0AtEta::theLayersData
private