CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //
23 // member functions
24 //
25 
26 uint32_t HcalTBNumberingScheme::getUnitID(const uint32_t idHit,
27  const int mode) {
28 
29  int subdet, zside, group, ieta, iphi, lay;
30  HcalTestNumbering::unpackHcalIndex(idHit, subdet, zside, group,
31  ieta, iphi, lay);
32  LogDebug("HcalTBSim") << "HcalTBNumberingScheme: i/p ID 0x" << std::hex
33  << idHit << std::dec << " det " << zside << " group "
34  << group << " layer " << lay << " eta " << ieta
35  << " phi " << iphi;
36 
37  uint32_t idunit;
38  if (subdet == static_cast<int>(HcalBarrel)) {
39  if (lay <= 17) group = 1;
40  else 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,
64  ieta, iphi, lay);
65  LogDebug("HcalTBSim") << "HcalTBNumberingScheme: idHit 0x" << std::hex
66  << idHit << " idunit 0x" << idunit << std::dec << "\n"
67  << "HcalTBNumberingScheme: o/p ID 0x" << std::hex
68  << idunit << std::dec << " det " << zside << " group "
69  << group << " layer " << lay << " eta " << ieta
70  << " phi " << iphi;
71 
72  return idunit;
73 }
74 
75 std::vector<uint32_t> HcalTBNumberingScheme::getUnitIDs(const int type,
76  const int mode) {
77 
78  std::vector<uint32_t> tmp;
79  int iphi, ieta, lay;
80  uint32_t id;
81 
82  if (type != 1) {
83  // Include HB and HO id's
84  if (mode>0) {
85  // HB1 and masked part of HB2
86  for (ieta=1; ieta<17; ieta++) {
87  for (iphi=1; iphi<9; iphi++) {
88  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,1);
89  tmp.push_back(id);
90  }
91  }
92  // HO behind HB1
93  for (ieta=1; ieta<16; ieta++) {
94  for (iphi=2; iphi<5; iphi++) {
95  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,2);
96  tmp.push_back(id);
97  }
98  }
99  // HB2
100  for (lay=1; lay<18; lay++) {
101  for (iphi=5; iphi<9; iphi++) {
102  id = HcalTestNumbering::packHcalIndex(0,0,1,0,iphi,lay);
103  tmp.push_back(id);
104  }
105  }
106  // HO behind HB2
107  lay = 18;
108  for (ieta=1; ieta<16; ieta++) {
109  for (iphi=5; iphi<8; iphi++) {
110  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,lay);
111  tmp.push_back(id);
112  }
113  }
114  } else {
115  // HB1 & HB2
116  for (ieta=1; ieta<17; ieta++) {
117  for (iphi=1; iphi<9; iphi++) {
118  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,1);
119  tmp.push_back(id);
120  }
121  }
122  // HO behind HB
123  for (ieta=1; ieta<16; ieta++) {
124  for (iphi=2; iphi<8; iphi++) {
125  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,2);
126  tmp.push_back(id);
127  }
128  }
129  }
130  }
131 
132  if (type > 0) {
133  // Include HE id's
134  for (ieta=15; ieta<17; ieta++) {
135  for (iphi=3; iphi<7; iphi++) {
136  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,3);
137  tmp.push_back(id);
138  }
139  }
140  for (iphi=3; iphi<7; iphi++) {
141  id = HcalTestNumbering::packHcalIndex(0,0,1,17,iphi,1);
142  tmp.push_back(id);
143  }
144  for (ieta=18; ieta<21; ieta++) {
145  for (iphi=3; iphi<7; iphi++) {
146  for (int idep=1; idep<3; idep++) {
147  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,idep);
148  tmp.push_back(id);
149  }
150  }
151  }
152  for (ieta=21; ieta<26; ieta++) {
153  for (iphi=2; iphi<4; iphi++) {
154  for (int idep=1; idep<3; idep++) {
155  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,idep);
156  tmp.push_back(id);
157  }
158  }
159  }
160  }
161 
162  return tmp;
163 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
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)
tuple group
Definition: watchdog.py:82
static uint32_t getUnitID(const uint32_t id, const int mode)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100