test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 DebugLog
12 
14  HcalNumberingScheme(), forTBH2(forTB) {
15  edm::LogInfo("HcalSim") << "Creating HcalTestNumberingScheme with TB Flag "
16  << forTBH2;
17 }
18 
20  edm::LogInfo("HcalSim") << "Deleting HcalTestNumberingScheme";
21 }
22 
24  id) {
25 
26  //pack it into an integer
27  uint32_t index = 0;
28  if (forTBH2) {
29  // TB H2 Case
30  int etaR = id.etaR;
31  int phi = id.phis;
32  HcalSubdetector subdet = (HcalSubdetector)(id.subdet);
33  if (subdet == HcalBarrel && phi > 4) { // HB2
34  if (etaR > 4 && etaR < 10)
35  index = HcalDetId(subdet,id.lay,id.phis,1).rawId();
36  } else { // HB1
37  index = HcalDetId(subdet,etaR,id.phis,id.depth).rawId();
38  }
39  } else {
40  // Test case
41  index = HcalTestNumbering::packHcalIndex(id.subdet, id.zside, id.depth,
42  id.etaR, id.phis, id.lay);
43  }
44 #ifdef DebugLog
45  edm::LogInfo("HcalSim") << "HcalTestNumberingScheme det = " << id.subdet
46  << " depth/lay = " << id.depth << "/" << id.lay
47  << " zside = " << id.zside << " eta/R = " << id.etaR
48  << " phi = " << id.phis << " packed index = 0x"
49  << std::hex << index << std::dec << std::endl;
50 #endif
51  return index;
52 
53 }
54 
55 uint32_t HcalTestNumberingScheme::packHcalIndex(int det, int z, int depth,
56  int eta, int phi, int lay) {
57 
58  return HcalTestNumbering::packHcalIndex(det, z, depth, eta, phi, lay);
59 }
60 
61 void HcalTestNumberingScheme::unpackHcalIndex(const uint32_t & idx,
62  int& det, int& z,
63  int& depth, int& eta,
64  int& phi, int& lay) {
65 
66  HcalTestNumbering::unpackHcalIndex(idx, det, z, depth, eta, phi, lay);
67 }
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
int zside(DetId const &)
float float float z
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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)
Geom::Phi< T > phi() const
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)