CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CaloTowerHardcodeGeometryLoader Class Reference

#include <CaloTowerHardcodeGeometryLoader.h>

Public Member Functions

std::unique_ptr< CaloSubdetectorGeometryload (const CaloTowerTopology *limits, const HcalTopology *hcaltopo, const HcalDDDRecConstants *hcons)
 

Private Member Functions

void makeCell (uint32_t din, CaloSubdetectorGeometry *geom) const
 

Private Attributes

const HcalTopologym_hcaltopo
 
const HcalDDDRecConstantsm_hcons
 
const CaloTowerTopologym_limits
 
std::vector< double > theHBHEEtaBounds
 
std::vector< double > theHFEtaBounds
 

Detailed Description

Author
J. Mans - Minnesota

Definition at line 15 of file CaloTowerHardcodeGeometryLoader.h.

Member Function Documentation

◆ load()

std::unique_ptr< CaloSubdetectorGeometry > CaloTowerHardcodeGeometryLoader::load ( const CaloTowerTopology limits,
const HcalTopology hcaltopo,
const HcalDDDRecConstants hcons 
)

Definition at line 15 of file CaloTowerHardcodeGeometryLoader.cc.

References filterCSVwithJSON::copy, cropTnPTrees::din, HcalTopology::firstHBRing(), HcalTopology::firstHERing(), HcalTopology::firstHFRing(), relativeConstraints::geom, HcalDDDRecConstants::getEtaTable(), HcalDDDRecConstants::getEtaTableHF(), CaloTowerTopology::lastHBRing(), HcalTopology::lastHBRing(), CaloTowerTopology::lastHERing(), HcalTopology::lastHERing(), HcalTopology::lastHFRing(), TH2PolyOfflineMaps::limits, m_hcaltopo, m_hcons, m_limits, makeCell(), CaloTowerTopology::sizeForDenseIndexing(), theHBHEEtaBounds, and theHFEtaBounds.

Referenced by CaloTowerHardcodeGeometryEP::produce().

17  {
18  m_limits = limits;
19  m_hcaltopo = hcaltopo;
20  m_hcons = hcons;
21 
22  //get eta limits from hcal rec constants
25 
26 #ifdef EDM_ML_DEUG
27  std::ostringstream st1;
28  st1 << "CaloTowerHardcodeGeometryLoader: theHBHEEtaBounds = ";
29  std::copy(theHBHEEtaBounds.begin(), theHBHEEtaBounds.end(), std::ostream_iterator<double>(st1, ","));
30  edm::LogVerbatim("HCalGeom") << st1.str();
31 
32  edm::LogVerbatim("HCalGeom") << "CaloTowerHardcodeGeometryLoader: lastHBRing = " << m_limits->lastHBRing()
33  << ", lastHERing = " << m_limits->lastHERing();
34  edm::LogVerbatim("HCalGeom") << "CaloTowerHardcodeGeometryLoader: HcalTopology: firstHBRing = "
35  << hcaltopo->firstHBRing() << ", lastHBRing = " << hcaltopo->lastHBRing()
36  << ", firstHERing = " << hcaltopo->firstHERing()
37  << ", lastHERing = " << hcaltopo->lastHERing()
38  << ", firstHFRing = " << hcaltopo->firstHFRing()
39  << ", lastHFRing = " << hcaltopo->lastHFRing();
40 #endif
41 
43 
44  if (nullptr == geom->cornersMgr())
45  geom->allocateCorners(geom->numberOfCellsForCorners());
46  if (nullptr == geom->parMgr())
47  geom->allocatePar(geom->numberOfParametersPerShape() * geom->numberOfShapes(), geom->numberOfParametersPerShape());
48 
49  // simple loop
50  for (uint32_t din = 0; din < m_limits->sizeForDenseIndexing(); ++din) {
51  makeCell(din, geom);
52  }
53  edm::LogInfo("Geometry") << "CaloTowersHardcodeGeometry made " << m_limits->sizeForDenseIndexing() << " towers.";
54  return std::unique_ptr<CaloSubdetectorGeometry>(geom);
55 }
Log< level::Info, true > LogVerbatim
uint32_t sizeForDenseIndexing() const
int lastHERing() const
int firstHBRing() const
Definition: HcalTopology.h:91
void makeCell(uint32_t din, CaloSubdetectorGeometry *geom) const
int lastHBRing() const
Definition: HcalTopology.h:92
const std::vector< double > & getEtaTable() const
const std::vector< double > & getEtaTableHF() const
Log< level::Info, false > LogInfo
int lastHERing() const
Definition: HcalTopology.h:94
int lastHFRing() const
Definition: HcalTopology.h:97
int firstHFRing() const
Definition: HcalTopology.h:96
int firstHERing() const
Definition: HcalTopology.h:93
int lastHBRing() const

◆ makeCell()

void CaloTowerHardcodeGeometryLoader::makeCell ( uint32_t  din,
CaloSubdetectorGeometry geom 
) const
private

Definition at line 57 of file CaloTowerHardcodeGeometryLoader.cc.

References funct::abs(), CaloTowerTopology::convertCTtoHcal(), funct::cos(), CaloTowerTopology::detIdFromDenseIndex(), cropTnPTrees::din, PVValHelper::eta, HLT_2024v10_cff::eta1, HLT_2024v10_cff::eta2, CaloTowerTopology::firstHERing(), HcalTopology::firstHFRing(), relativeConstraints::geom, CaloCellGeometry::getParmPtr(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::hh, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, CaloTowerTopology::lastHERing(), m_hcaltopo, m_limits, M_PI, HcalTopology::nPhiBins(), phi, point, alignCSCRings::r, Validation_hcalonly_cfi::sign, funct::sin(), nnet::tanh(), theHBHEEtaBounds, theHFEtaBounds, Calorimetry_cff::thickness, x, y, and z.

Referenced by load().

57  {
58  const double EBradius = 143.0; // cm
59  const double HOradius = 406.0 + 1.0;
60  const double EEz = 320.0; // rough (cm)
61  const double HEz = 568.0; // back (cm)
62  const double HFz = 1100.0;
63  const double HFthick = 165;
64  // Tower 17 is the last EB tower
65 
66  //use CT topology to get the DetId for this dense index
68  int ieta = id.ieta();
69  int iphi = id.iphi();
70 
71  //use CT topology to get proper ieta for hcal
72  int etaRing = m_limits->convertCTtoHcal(abs(ieta));
73  int sign = (ieta > 0) ? (1) : (-1);
74  double eta1, eta2;
75 
76 #ifdef EDM_ML_DEUG
77  edm::LogVerbatim("HCalGeom") << "CaloTowerHardcodeGeometryLoader: ieta = " << ieta << ", iphi = " << iphi
78  << ", etaRing = " << etaRing;
79 #endif
80 
81  if (abs(ieta) > m_limits->lastHERing()) {
82  eta1 = theHFEtaBounds.at(etaRing - m_hcaltopo->firstHFRing());
83  eta2 = theHFEtaBounds.at(etaRing - m_hcaltopo->firstHFRing() + 1);
84  } else {
85  eta1 = theHBHEEtaBounds.at(etaRing - 1);
86  eta2 = theHBHEEtaBounds.at(etaRing);
87  }
88  double eta = 0.5 * (eta1 + eta2);
89  double deta = (eta2 - eta1);
90 
91  // in radians
92  double dphi_nominal = 2.0 * M_PI / m_hcaltopo->nPhiBins(1); // always the same
93  double dphi_half = M_PI / m_hcaltopo->nPhiBins(etaRing); // half-width
94 
95  double phi_low = dphi_nominal * (iphi - 1); // low-edge boundaries are constant...
96  double phi = phi_low + dphi_half;
97 
98 #ifdef EDM_ML_DEUG
99  edm::LogVerbatim("HCalGeom") << "CaloTowerHardcodeGeometryLoader: eta1 = " << eta1 << ", eta2 = " << eta2
100  << ", eta = " << eta << ", phi = " << phi;
101 #endif
102 
103  double x, y, z, thickness;
104  bool alongZ = true;
105  if (abs(ieta) > m_limits->lastHERing()) { // forward
106  z = HFz;
107  double r = z / sinh(eta);
108  x = r * cos(phi);
109  y = r * sin(phi);
110  thickness = HFthick / tanh(eta);
111  } else if (abs(ieta) > m_limits->firstHERing() + 1) { // EE-containing
112  z = EEz;
113  double r = z / sinh(eta);
114  x = r * cos(phi);
115  y = r * sin(phi);
116  thickness = (HEz - EEz) / tanh(eta);
117  } else { // EB-containing
118  x = EBradius * cos(phi);
119  y = EBradius * sin(phi);
120  alongZ = false;
121  z = EBradius * sinh(eta);
122  thickness = (HOradius - EBradius) * cosh(eta);
123  }
124 
125  z *= sign;
126  GlobalPoint point(x, y, z);
127 
128  const double mysign(!alongZ ? 1 : -1);
129  std::vector<CCGFloat> hh;
130  hh.reserve(5);
131  hh.emplace_back(deta / 2);
132  hh.emplace_back(dphi_half);
133  hh.emplace_back(mysign * thickness / 2.);
134 
135  hh.emplace_back(fabs(eta));
136  hh.emplace_back(fabs(z));
137 
138 #ifdef EDM_ML_DEUG
139  edm::LogVerbatim("HCalGeom") << "CaloTowerHardcodeGeometryLoader: x = " << x << ", y = " << y << ", z = " << z
140  << ", thickness = " << thickness;
141 #endif
142 
143  geom->newCell(point, point, point, CaloCellGeometry::getParmPtr(hh, geom->parMgr(), geom->parVecVec()), id);
144 }
Log< level::Info, true > LogVerbatim
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int lastHERing() const
CaloTowerDetId detIdFromDenseIndex(uint32_t din) const
int firstHERing() const
int convertCTtoHcal(int ct_ieta) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
ALPAKA_FN_ACC ALPAKA_FN_INLINE void uint32_t const uint32_t CACellT< TrackerTraits > uint32_t CellNeighborsVector< TrackerTraits > CellTracksVector< TrackerTraits > HitsConstView< TrackerTraits > hh
#define M_PI
int firstHFRing() const
Definition: HcalTopology.h:96
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
int nPhiBins(int etaRing) const
how many phi segments in this ring

Member Data Documentation

◆ m_hcaltopo

const HcalTopology* CaloTowerHardcodeGeometryLoader::m_hcaltopo
private

Definition at line 24 of file CaloTowerHardcodeGeometryLoader.h.

Referenced by load(), and makeCell().

◆ m_hcons

const HcalDDDRecConstants* CaloTowerHardcodeGeometryLoader::m_hcons
private

Definition at line 25 of file CaloTowerHardcodeGeometryLoader.h.

Referenced by load().

◆ m_limits

const CaloTowerTopology* CaloTowerHardcodeGeometryLoader::m_limits
private

Definition at line 23 of file CaloTowerHardcodeGeometryLoader.h.

Referenced by load(), and makeCell().

◆ theHBHEEtaBounds

std::vector<double> CaloTowerHardcodeGeometryLoader::theHBHEEtaBounds
private

Definition at line 26 of file CaloTowerHardcodeGeometryLoader.h.

Referenced by load(), and makeCell().

◆ theHFEtaBounds

std::vector<double> CaloTowerHardcodeGeometryLoader::theHFEtaBounds
private

Definition at line 26 of file CaloTowerHardcodeGeometryLoader.h.

Referenced by load(), and makeCell().