CMS 3D CMS Logo

HcalTestNumberingScheme.cc
Go to the documentation of this file.
1 // File: HcalTestNumberingScheme.cc
3 // Description: Numbering scheme for barrel electromagnetic calorimeter
8 
9 #include <iostream>
10 
11 //#define EDM_ML_DEBUG
12 
14  edm::LogVerbatim("HcalSim") << "Creating HcalTestNumberingScheme with TB Flag " << forTBH2;
15 }
16 
18  edm::LogVerbatim("HcalSim") << "Deleting HcalTestNumberingScheme";
19 }
20 
22  //pack it into an integer
23  uint32_t index = 0;
24  if (forTBH2) {
25  // TB H2 Case
26  int etaR = id.etaR;
27  int phi = id.phis;
28  HcalSubdetector subdet = (HcalSubdetector)(id.subdet);
29  if (subdet == HcalBarrel && phi > 4) { // HB2
30  if (etaR > 4 && etaR < 10)
31  index = HcalDetId(subdet, id.lay, id.phis, 1).rawId();
32  } else { // HB1
33  index = HcalDetId(subdet, etaR, id.phis, id.depth).rawId();
34  }
35  } else {
36  // Test case
37  index = HcalTestNumbering::packHcalIndex(id.subdet, id.zside, id.depth, id.etaR, id.phis, id.lay);
38  }
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HcalSim") << "HcalTestNumberingScheme det = " << id.subdet << " depth/lay = " << id.depth << "/"
41  << id.lay << " zside = " << id.zside << " eta/R = " << id.etaR << " phi = " << id.phis
42  << " packed index = 0x" << std::hex << index << std::dec << std::endl;
43 #endif
44  return index;
45 }
46 
47 uint32_t HcalTestNumberingScheme::packHcalIndex(int det, int z, int depth, int eta, int phi, int lay) {
48  return HcalTestNumbering::packHcalIndex(det, z, depth, eta, phi, lay);
49 }
50 
52  const uint32_t& idx, int& det, int& z, int& depth, int& eta, int& phi, int& lay) {
53  HcalTestNumbering::unpackHcalIndex(idx, det, z, depth, eta, phi, lay);
54 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int zside(DetId const &)
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
HcalSubdetector
Definition: HcalAssistant.h:31
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
HcalTestNumberingScheme()=delete
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id) override