CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BTLDetId.cc
Go to the documentation of this file.
2 
4 int BTLDetId::iphi(CrysLayout lay) const {
5  int kCrystalsInPhi = 1;
6  switch (lay) {
7  case CrysLayout::tile: {
8  kCrystalsInPhi = kCrystalsInPhiTile;
9  break;
10  }
11  case CrysLayout::bar: {
12  kCrystalsInPhi = kCrystalsInPhiBar;
13  break;
14  }
15  case CrysLayout::barzflat: {
16  kCrystalsInPhi = kCrystalsInPhiBarZ;
17  break;
18  }
20  kCrystalsInPhi = kCrystalsInPhiBarPhi;
21  break;
22  }
23  default: {
24  break;
25  }
26  }
27  return kCrystalsInPhi * ((mtdRR() % HALF_ROD > 0 ? mtdRR() % HALF_ROD : HALF_ROD) - 1) +
28  (crystal() % kCrystalsInPhi > 0 ? crystal() % kCrystalsInPhi : kCrystalsInPhi);
29 }
30 
32 int BTLDetId::ietaAbs(CrysLayout lay) const {
33  int kCrystalsInEta = 1, kCrystalsInPhi = 1;
34  std::array<int, 4> kTypeBoundaries = {};
35  switch (lay) {
36  case CrysLayout::tile: {
37  kCrystalsInEta = kCrystalsInEtaTile;
38  kCrystalsInPhi = kCrystalsInPhiTile;
39  kTypeBoundaries = kTypeBoundariesReference;
40  break;
41  }
42  case CrysLayout::bar: {
43  kCrystalsInEta = kCrystalsInEtaBar;
44  kCrystalsInPhi = kCrystalsInPhiBar;
45  kTypeBoundaries = kTypeBoundariesReference;
46  break;
47  }
48  case CrysLayout::barzflat: {
49  kCrystalsInEta = kCrystalsInEtaBarZ;
50  kCrystalsInPhi = kCrystalsInPhiBarZ;
51  kTypeBoundaries = kTypeBoundariesBarZflat;
52  break;
53  }
55  kCrystalsInEta = kCrystalsInEtaBarPhi;
56  kCrystalsInPhi = kCrystalsInPhiBarPhi;
57  kTypeBoundaries = kTypeBoundariesBarPhiFlat;
58  break;
59  }
60  default: {
61  break;
62  }
63  }
64  int etaRowInModule =
65  zside() > 0 ? (crystal() - 1) / kCrystalsInPhi + 1 : kCrystalsInEta - (crystal() - 1) / kCrystalsInPhi;
66  return kCrystalsInEta * (module() - 1) + kCrystalsInEta * kTypeBoundaries[(modType() - 1)] + etaRowInModule;
67 }
68 
70  int max_iphi = 1, max_ieta = 1;
71  switch (lay) {
72  case CrysLayout::tile: {
73  max_iphi = MAX_IPHI_TILE;
74  max_ieta = MAX_IETA_TILE;
75  break;
76  }
77  case CrysLayout::bar: {
78  max_iphi = MAX_IPHI_BAR;
79  max_ieta = MAX_IETA_BAR;
80  break;
81  }
82  case CrysLayout::barzflat: {
83  max_iphi = MAX_IPHI_BARZFLAT;
84  max_ieta = MAX_IETA_BARZFLAT;
85  break;
86  }
88  max_iphi = MAX_IPHI_BARPHIFLAT;
89  max_ieta = MAX_IETA_BARPHIFLAT;
90  break;
91  }
92  default: {
93  break;
94  }
95  }
96  return (max_ieta + (zside() > 0 ? ietaAbs(lay) - 1 : -ietaAbs(lay))) * max_iphi + iphi(lay) - 1;
97 }
98 
102  int max_iphi = 1, max_ieta = 1, nphi = 0, keta = 0, tmphi = hi + 1;
103  std::array<int, 4> kTypeBoundaries = {};
104  switch (lay) {
105  case CrysLayout::tile: {
106  max_iphi = MAX_IPHI_TILE;
107  max_ieta = MAX_IETA_TILE;
109  keta = kCrystalsInEtaTile;
110  kTypeBoundaries = kTypeBoundariesReference;
111  break;
112  }
113  case CrysLayout::bar: {
114  max_iphi = MAX_IPHI_BAR;
115  max_ieta = MAX_IETA_BAR;
117  keta = kCrystalsInEtaBar;
118  kTypeBoundaries = kTypeBoundariesReference;
119  break;
120  }
121  case CrysLayout::barzflat: {
122  max_iphi = MAX_IPHI_BARZFLAT;
123  max_ieta = MAX_IETA_BARZFLAT;
125  keta = kCrystalsInEtaBarZ;
126  kTypeBoundaries = kTypeBoundariesBarZflat;
127  break;
128  }
129  case CrysLayout::barphiflat: {
130  max_iphi = MAX_IPHI_BARPHIFLAT;
131  max_ieta = MAX_IETA_BARPHIFLAT;
133  keta = kCrystalsInEtaBarPhi;
134  kTypeBoundaries = kTypeBoundariesBarPhiFlat;
135  break;
136  }
137  default: {
138  break;
139  }
140  }
141  int zside = 0, rod = 0, module = 0, modtype = 1, crystal = 0;
142  if (tmphi > max_ieta * max_iphi) {
143  zside = 1;
144  }
145  int ip = (tmphi - 1) % max_iphi + 1;
146  int ie = (tmphi - 1) / max_iphi - max_ieta;
147  ie = (zside == 1 ? ie + 1 : -ie);
148  rod = (ip - 1) / nphi + 1;
149  module = (ie - 1) / keta + 1;
150  if (module > kTypeBoundaries[1]) {
151  modtype = (module > kTypeBoundaries[2] ? 3 : 2);
152  }
153  if (modtype > 1) {
154  module = module - kTypeBoundaries[modtype - 1];
155  }
156  crystal = zside == 1 ? ((ip - 1) % nphi + 1) + ((ie - 1) % keta) * nphi
157  : ((ip - 1) % nphi + 1) + (keta - 1 - (ie - 1) % keta) * nphi;
158  return BTLDetId(zside, rod, module, modtype, crystal);
159 }
160 
162  int mod = kTypeBoundariesReference[1];
163  if (lay == CrysLayout::barzflat) {
164  mod = kTypeBoundariesBarZflat[1];
165  } else if (lay == CrysLayout::barphiflat) {
166  mod = kTypeBoundariesBarPhiFlat[1];
167  }
168  return mod;
169 }
170 
172  // reorganize the modules to count from 0 to 54
173  // (0 to 42 in the case of BarZflat geometry)
174  // remove module type
175  // remove crystal index
176 
177  int boundRef = modulesPerType(lay);
178 
179  return BTLDetId(mtdSide(), mtdRR(), module() + boundRef * (modType() - 1), 0, 1);
180 }
181 
182 #include <iomanip>
183 
184 std::ostream& operator<<(std::ostream& os, const BTLDetId& id) {
185  os << (MTDDetId&)id;
186  os << " BTL " << std::endl
187  << " Side : " << id.mtdSide() << std::endl
188  << " Rod : " << id.mtdRR() << std::endl
189  << " Module : " << id.module() << std::endl
190  << " Crystal type: " << id.modType() << std::endl
191  << " Crystal : " << id.crystal() << std::endl;
192  return os;
193 }
const int nphi
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:57
int modulesPerType(CrysLayout lay) const
Definition: BTLDetId.cc:161
CrysLayout
Definition: BTLDetId.h:70
static constexpr int kCrystalsInPhiBarPhi
Definition: BTLDetId.h:40
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:32
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
static constexpr int MAX_IPHI_BAR
Definition: BTLDetId.h:58
static constexpr std::array< int, 4 > kTypeBoundariesBarZflat
Definition: BTLDetId.h:32
BTLDetId()
Definition: BTLDetId.h:75
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:171
static constexpr int HALF_ROD
Definition: BTLDetId.h:52
static constexpr std::array< int, 4 > kTypeBoundariesBarPhiFlat
Definition: BTLDetId.h:33
static constexpr int MAX_IETA_TILE
Definition: BTLDetId.h:55
static constexpr int MAX_IPHI_BARZFLAT
Definition: BTLDetId.h:62
static constexpr int MAX_IPHI_TILE
Definition: BTLDetId.h:56
static constexpr int kCrystalsInPhiBar
Definition: BTLDetId.h:36
static constexpr int MAX_IETA_BARPHIFLAT
Definition: BTLDetId.h:63
int mtdRR() const
Definition: MTDDetId.h:64
int hashedIndex(CrysLayout lay) const
Definition: BTLDetId.cc:69
int mtdSide() const
Definition: MTDDetId.h:59
static constexpr int kCrystalsInEtaBarPhi
Definition: BTLDetId.h:41
static constexpr int kCrystalsInPhiTile
Definition: BTLDetId.h:34
int iphi(CrysLayout lay) const
Definition: BTLDetId.cc:4
BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const
Definition: BTLDetId.cc:101
static constexpr int kCrystalsInEtaBar
Definition: BTLDetId.h:37
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:31
static constexpr int MAX_IETA_BARZFLAT
Definition: BTLDetId.h:61
int module() const
Definition: BTLDetId.h:96
static constexpr int kCrystalsInEtaBarZ
Definition: BTLDetId.h:39
int zside() const
Definition: MTDDetId.h:61
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
static constexpr int kCrystalsInEtaTile
Definition: BTLDetId.h:35
static constexpr int kCrystalsInPhiBarZ
Definition: BTLDetId.h:38
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int modType() const
Definition: BTLDetId.h:99
static constexpr int MAX_IPHI_BARPHIFLAT
Definition: BTLDetId.h:64
int crystal() const
Definition: BTLDetId.h:102