CMS 3D CMS Logo

HcalTBNumberingScheme.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestBeam
4 // Class : HcalTBNumberingScheme
5 //
6 // Implementation:
7 // Numbering scheme for test beam hadron calorimeter
8 //
9 // Original Author:
10 // Created: Tue May 16 10:14:34 CEST 2006
11 //
12 
13 // system include files
14 #include <iostream>
15 
16 // user include files
21 
22 //#define EDM_ML_DEBUG
23 //
24 // member functions
25 //
26 
27 uint32_t HcalTBNumberingScheme::getUnitID(const uint32_t idHit, const int mode) {
28  int subdet, zside, group, ieta, iphi, lay;
29  HcalTestNumbering::unpackHcalIndex(idHit, subdet, zside, group, ieta, iphi, lay);
30 #ifdef EDM_ML_DEBUG
31  edm::LogVerbatim("HcalTBSim") << "HcalTBNumberingScheme: i/p ID 0x" << std::hex << idHit << std::dec << " det "
32  << zside << " group " << group << " layer " << lay << " eta " << ieta << " phi "
33  << iphi;
34 #endif
35  uint32_t idunit;
36  if (subdet == static_cast<int>(HcalBarrel)) {
37  if (lay <= 17)
38  group = 1;
39  else
40  group = 2;
41  }
42  if (mode > 0) {
43  if (subdet == static_cast<int>(HcalBarrel) && iphi > 4) {
44  if (lay <= 17) {
45  // HB2 (unmasked and masked)
46  if (ieta > 4 && ieta < 10) {
47  idunit = HcalTestNumbering::packHcalIndex(0, 0, 1, 0, iphi, lay);
48  } else {
49  idunit = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, group);
50  }
51  } else {
52  // HO behind HB2
53  idunit = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, 18);
54  }
55  } else {
56  // HB1, HE, HO behind HB1
57  idunit = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, group);
58  }
59  } else {
60  idunit = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, group);
61  }
62 
63  HcalTestNumbering::unpackHcalIndex(idunit, subdet, zside, group, ieta, iphi, lay);
64 #ifdef EDM_ML_DEBUG
65  edm::LogVerbatim("HcalTBSim") << "HcalTBNumberingScheme: idHit 0x" << std::hex << idHit << " idunit 0x" << idunit
66  << std::dec << "\n"
67  << "HcalTBNumberingScheme: o/p ID 0x" << std::hex << idunit << std::dec << " det "
68  << zside << " group " << group << " layer " << lay << " eta " << ieta << " phi "
69  << iphi;
70 #endif
71  return idunit;
72 }
73 
74 std::vector<uint32_t> HcalTBNumberingScheme::getUnitIDs(const int type, const int mode) {
75  std::vector<uint32_t> tmp;
76  int iphi, ieta, lay;
77  uint32_t id;
78 
79  if (type != 1) {
80  // Include HB and HO id's
81  if (mode > 0) {
82  // HB1 and masked part of HB2
83  for (ieta = 1; ieta < 17; ieta++) {
84  for (iphi = 1; iphi < 9; iphi++) {
85  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, 1);
86  tmp.push_back(id);
87  }
88  }
89  // HO behind HB1
90  for (ieta = 1; ieta < 16; ieta++) {
91  for (iphi = 2; iphi < 5; iphi++) {
92  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, 2);
93  tmp.push_back(id);
94  }
95  }
96  // HB2
97  for (lay = 1; lay < 18; lay++) {
98  for (iphi = 5; iphi < 9; iphi++) {
99  id = HcalTestNumbering::packHcalIndex(0, 0, 1, 0, iphi, lay);
100  tmp.push_back(id);
101  }
102  }
103  // HO behind HB2
104  lay = 18;
105  for (ieta = 1; ieta < 16; ieta++) {
106  for (iphi = 5; iphi < 8; iphi++) {
107  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, lay);
108  tmp.push_back(id);
109  }
110  }
111  } else {
112  // HB1 & HB2
113  for (ieta = 1; ieta < 17; ieta++) {
114  for (iphi = 1; iphi < 9; iphi++) {
115  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, 1);
116  tmp.push_back(id);
117  }
118  }
119  // HO behind HB
120  for (ieta = 1; ieta < 16; ieta++) {
121  for (iphi = 2; iphi < 8; iphi++) {
122  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, 2);
123  tmp.push_back(id);
124  }
125  }
126  }
127  }
128 
129  if (type > 0) {
130  // Include HE id's
131  for (ieta = 15; ieta < 17; ieta++) {
132  for (iphi = 3; iphi < 7; iphi++) {
133  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, 3);
134  tmp.push_back(id);
135  }
136  }
137  for (iphi = 3; iphi < 7; iphi++) {
138  id = HcalTestNumbering::packHcalIndex(0, 0, 1, 17, iphi, 1);
139  tmp.push_back(id);
140  }
141  for (ieta = 18; ieta < 21; ieta++) {
142  for (iphi = 3; iphi < 7; iphi++) {
143  for (int idep = 1; idep < 3; idep++) {
144  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, idep);
145  tmp.push_back(id);
146  }
147  }
148  }
149  for (ieta = 21; ieta < 26; ieta++) {
150  for (iphi = 2; iphi < 4; iphi++) {
151  for (int idep = 1; idep < 3; idep++) {
152  id = HcalTestNumbering::packHcalIndex(0, 0, 1, ieta, iphi, idep);
153  tmp.push_back(id);
154  }
155  }
156  }
157  }
158 
159  return tmp;
160 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
static std::vector< uint32_t > getUnitIDs(const int type, const int mode)
static uint32_t getUnitID(const uint32_t id, const int mode)
tmp
align.sh
Definition: createJobs.py:716