CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
lst::EndcapGeometry Class Reference

#include <EndcapGeometry.h>

Public Member Functions

 EndcapGeometry ()=default
 
 EndcapGeometry (std::string const &filename)
 
void fillGeoMapArraysExplicit ()
 
float getdxdy_slope (unsigned int detid) const
 
void load (std::string const &)
 

Public Attributes

std::vector< unsigned int > geoMapDetId_buf
 
std::vector< float > geoMapPhi_buf
 
unsigned int nEndCapMap
 

Private Attributes

std::map< unsigned int, float > centroid_phis_
 
std::map< unsigned int, float > dxdy_slope_
 

Detailed Description

Definition at line 9 of file EndcapGeometry.h.

Constructor & Destructor Documentation

◆ EndcapGeometry() [1/2]

lst::EndcapGeometry::EndcapGeometry ( )
default

◆ EndcapGeometry() [2/2]

lst::EndcapGeometry::EndcapGeometry ( std::string const &  filename)

Definition at line 8 of file EndcapGeometry.cc.

References corrVsCorr::filename, and load().

8 { load(filename); }
void load(std::string const &)

Member Function Documentation

◆ fillGeoMapArraysExplicit()

void lst::EndcapGeometry::fillGeoMapArraysExplicit ( )

Definition at line 42 of file EndcapGeometry.cc.

References hcalRecHitTable_cff::detId, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and VtxSmearedParameters_cfi::Phi.

42  {
43  nEndCapMap = centroid_phis_.size();
44 
45  geoMapDetId_buf.reserve(nEndCapMap);
46  geoMapPhi_buf.reserve(nEndCapMap);
47 
48  for (auto it = centroid_phis_.begin(); it != centroid_phis_.end(); ++it) {
49  unsigned int detId = it->first;
50  float Phi = it->second;
51  geoMapPhi_buf.push_back(Phi);
52  geoMapDetId_buf.push_back(detId);
53  }
54 }
std::map< unsigned int, float > centroid_phis_
std::vector< float > geoMapPhi_buf
unsigned int nEndCapMap
std::vector< unsigned int > geoMapDetId_buf

◆ getdxdy_slope()

float lst::EndcapGeometry::getdxdy_slope ( unsigned int  detid) const

Definition at line 56 of file EndcapGeometry.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

Referenced by lst::loadModulesFromFile().

56  {
57  auto res = dxdy_slope_.find(detid);
58  return res == dxdy_slope_.end() ? 0.f : res->second;
59 }
Definition: Electron.h:6
std::map< unsigned int, float > dxdy_slope_

◆ load()

void lst::EndcapGeometry::load ( std::string const &  filename)

Definition at line 10 of file EndcapGeometry.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid, corrVsCorr::filename, and compare_using_db::ifile.

Referenced by EndcapGeometry().

10  {
11  dxdy_slope_.clear();
12  centroid_phis_.clear();
13 
14  std::ifstream ifile(filename, std::ios::binary);
15  if (!ifile.is_open()) {
16  throw std::runtime_error("Unable to open file: " + filename);
17  }
18 
19  while (!ifile.eof()) {
20  unsigned int detid;
21  float dxdy_slope, centroid_phi;
22 
23  // Read the detid, dxdy_slope, and centroid_phi from binary file
24  ifile.read(reinterpret_cast<char*>(&detid), sizeof(detid));
25  ifile.read(reinterpret_cast<char*>(&dxdy_slope), sizeof(dxdy_slope));
26  ifile.read(reinterpret_cast<char*>(&centroid_phi), sizeof(centroid_phi));
27 
28  if (ifile) {
29  dxdy_slope_[detid] = dxdy_slope;
30  centroid_phis_[detid] = centroid_phi;
31  } else {
32  // End of file or read failed
33  if (!ifile.eof()) {
34  throw std::runtime_error("Failed to read Endcap Geometry binary data.");
35  }
36  }
37  }
38 
40 }
std::map< unsigned int, float > centroid_phis_
std::map< unsigned int, float > dxdy_slope_

Member Data Documentation

◆ centroid_phis_

std::map<unsigned int, float> lst::EndcapGeometry::centroid_phis_
private

Definition at line 12 of file EndcapGeometry.h.

◆ dxdy_slope_

std::map<unsigned int, float> lst::EndcapGeometry::dxdy_slope_
private

Definition at line 11 of file EndcapGeometry.h.

◆ geoMapDetId_buf

std::vector<unsigned int> lst::EndcapGeometry::geoMapDetId_buf

Definition at line 15 of file EndcapGeometry.h.

Referenced by lst::loadAndFillESHost().

◆ geoMapPhi_buf

std::vector<float> lst::EndcapGeometry::geoMapPhi_buf

Definition at line 16 of file EndcapGeometry.h.

Referenced by lst::loadAndFillESHost().

◆ nEndCapMap

unsigned int lst::EndcapGeometry::nEndCapMap

Definition at line 18 of file EndcapGeometry.h.

Referenced by lst::loadAndFillESHost().