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 // $Id: HcalTBNumberingScheme.cc,v 1.2 2006/06/04 13:59:38 sunanda Exp $
12 //
13 
14 // system include files
15 #include <iostream>
16 
17 // user include files
22 
23 //
24 // member functions
25 //
26 
27 uint32_t HcalTBNumberingScheme::getUnitID(const uint32_t idHit,
28  const int mode) {
29 
30  int subdet, zside, group, ieta, iphi, lay;
31  HcalTestNumbering::unpackHcalIndex(idHit, subdet, zside, group,
32  ieta, iphi, lay);
33  LogDebug("HcalTBSim") << "HcalTBNumberingScheme: i/p ID 0x" << std::hex
34  << idHit << std::dec << " det " << zside << " group "
35  << group << " layer " << lay << " eta " << ieta
36  << " phi " << iphi;
37 
38  uint32_t idunit;
39  if (subdet == static_cast<int>(HcalBarrel)) {
40  if (lay <= 17) group = 1;
41  else group = 2;
42  }
43  if (mode > 0) {
44  if (subdet == static_cast<int>(HcalBarrel) && iphi > 4) {
45  if (lay <= 17) {
46  // HB2 (unmasked and masked)
47  if (ieta > 4 && ieta < 10) {
48  idunit = HcalTestNumbering::packHcalIndex(0,0,1,0,iphi,lay);
49  } else {
50  idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,group);
51  }
52  } else {
53  // HO behind HB2
54  idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,18);
55  }
56  } else {
57  // HB1, HE, HO behind HB1
58  idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,group);
59  }
60  } else {
61  idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,group);
62  }
63 
64  HcalTestNumbering::unpackHcalIndex(idunit, subdet, zside, group,
65  ieta, iphi, lay);
66  LogDebug("HcalTBSim") << "HcalTBNumberingScheme: idHit 0x" << std::hex
67  << idHit << " idunit 0x" << idunit << std::dec << "\n"
68  << "HcalTBNumberingScheme: o/p ID 0x" << std::hex
69  << idunit << std::dec << " det " << zside << " group "
70  << group << " layer " << lay << " eta " << ieta
71  << " phi " << iphi;
72 
73  return idunit;
74 }
75 
76 std::vector<uint32_t> HcalTBNumberingScheme::getUnitIDs(const int type,
77  const int mode) {
78 
79  std::vector<uint32_t> tmp;
80  int iphi, ieta, lay;
81  uint32_t id;
82 
83  if (type != 1) {
84  // Include HB and HO id's
85  if (mode>0) {
86  // HB1 and masked part of HB2
87  for (ieta=1; ieta<17; ieta++) {
88  for (iphi=1; iphi<9; iphi++) {
89  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,1);
90  tmp.push_back(id);
91  }
92  }
93  // HO behind HB1
94  for (ieta=1; ieta<16; ieta++) {
95  for (iphi=2; iphi<5; iphi++) {
96  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,2);
97  tmp.push_back(id);
98  }
99  }
100  // HB2
101  for (lay=1; lay<18; lay++) {
102  for (iphi=5; iphi<9; iphi++) {
103  id = HcalTestNumbering::packHcalIndex(0,0,1,0,iphi,lay);
104  tmp.push_back(id);
105  }
106  }
107  // HO behind HB2
108  lay = 18;
109  for (ieta=1; ieta<16; ieta++) {
110  for (iphi=5; iphi<8; iphi++) {
111  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,lay);
112  tmp.push_back(id);
113  }
114  }
115  } else {
116  // HB1 & HB2
117  for (ieta=1; ieta<17; ieta++) {
118  for (iphi=1; iphi<9; iphi++) {
119  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,1);
120  tmp.push_back(id);
121  }
122  }
123  // HO behind HB
124  for (ieta=1; ieta<16; ieta++) {
125  for (iphi=2; iphi<8; iphi++) {
126  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,2);
127  tmp.push_back(id);
128  }
129  }
130  }
131  }
132 
133  if (type > 0) {
134  // Include HE id's
135  for (ieta=15; ieta<17; ieta++) {
136  for (iphi=3; iphi<7; iphi++) {
137  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,3);
138  tmp.push_back(id);
139  }
140  }
141  for (iphi=3; iphi<7; iphi++) {
142  id = HcalTestNumbering::packHcalIndex(0,0,1,17,iphi,1);
143  tmp.push_back(id);
144  }
145  for (ieta=18; ieta<21; ieta++) {
146  for (iphi=3; iphi<7; iphi++) {
147  for (int idep=1; idep<3; idep++) {
148  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,idep);
149  tmp.push_back(id);
150  }
151  }
152  }
153  for (ieta=21; ieta<26; ieta++) {
154  for (iphi=2; iphi<4; iphi++) {
155  for (int idep=1; idep<3; idep++) {
156  id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,idep);
157  tmp.push_back(id);
158  }
159  }
160  }
161  }
162 
163  return tmp;
164 }
#define LogDebug(id)
type
Definition: HCALResponse.h:22
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)
int mode
Definition: AMPTWrapper.h:139
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100