CMS 3D CMS Logo

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: { break; }
24  }
25  return kCrystalsInPhi * ((mtdRR() % HALF_ROD > 0 ? mtdRR() % HALF_ROD : HALF_ROD) - 1) +
26  (crystal() % kCrystalsInPhi > 0 ? crystal() % kCrystalsInPhi : kCrystalsInPhi);
27 }
28 
30 int BTLDetId::ietaAbs(CrysLayout lay) const {
31  int kCrystalsInEta = 1, kCrystalsInPhi = 1;
32  std::array<int, 4> kTypeBoundaries = {};
33  switch (lay) {
34  case CrysLayout::tile: {
35  kCrystalsInEta = kCrystalsInEtaTile;
36  kCrystalsInPhi = kCrystalsInPhiTile;
37  kTypeBoundaries = kTypeBoundariesReference;
38  break;
39  }
40  case CrysLayout::bar: {
41  kCrystalsInEta = kCrystalsInEtaBar;
42  kCrystalsInPhi = kCrystalsInPhiBar;
43  kTypeBoundaries = kTypeBoundariesReference;
44  break;
45  }
46  case CrysLayout::barzflat: {
47  kCrystalsInEta = kCrystalsInEtaBarZ;
48  kCrystalsInPhi = kCrystalsInPhiBarZ;
49  kTypeBoundaries = kTypeBoundariesBarZflat;
50  break;
51  }
53  kCrystalsInEta = kCrystalsInEtaBarPhi;
54  kCrystalsInPhi = kCrystalsInPhiBarPhi;
55  kTypeBoundaries = kTypeBoundariesBarPhiFlat;
56  break;
57  }
58  default: { break; }
59  }
60  int etaRowInModule =
61  zside() > 0 ? (crystal() - 1) / kCrystalsInPhi + 1 : kCrystalsInEta - (crystal() - 1) / kCrystalsInPhi;
62  return kCrystalsInEta * (module() - 1) + kCrystalsInEta * kTypeBoundaries[(modType() - 1)] + etaRowInModule;
63 }
64 
66  int max_iphi = 1, max_ieta = 1;
67  switch (lay) {
68  case CrysLayout::tile: {
69  max_iphi = MAX_IPHI_TILE;
70  max_ieta = MAX_IETA_TILE;
71  break;
72  }
73  case CrysLayout::bar: {
74  max_iphi = MAX_IPHI_BAR;
75  max_ieta = MAX_IETA_BAR;
76  break;
77  }
78  case CrysLayout::barzflat: {
79  max_iphi = MAX_IPHI_BARZFLAT;
80  max_ieta = MAX_IETA_BARZFLAT;
81  break;
82  }
84  max_iphi = MAX_IPHI_BARPHIFLAT;
85  max_ieta = MAX_IETA_BARPHIFLAT;
86  break;
87  }
88  default: { break; }
89  }
90  return (max_ieta + (zside() > 0 ? ietaAbs(lay) - 1 : -ietaAbs(lay))) * max_iphi + iphi(lay) - 1;
91 }
92 
96  int max_iphi = 1, max_ieta = 1, nphi = 0, keta = 0, tmphi = hi + 1;
97  std::array<int, 4> kTypeBoundaries = {};
98  switch (lay) {
99  case CrysLayout::tile: {
100  max_iphi = MAX_IPHI_TILE;
101  max_ieta = MAX_IETA_TILE;
102  nphi = kCrystalsInPhiTile;
103  keta = kCrystalsInEtaTile;
104  kTypeBoundaries = kTypeBoundariesReference;
105  break;
106  }
107  case CrysLayout::bar: {
108  max_iphi = MAX_IPHI_BAR;
109  max_ieta = MAX_IETA_BAR;
110  nphi = kCrystalsInPhiBar;
111  keta = kCrystalsInEtaBar;
112  kTypeBoundaries = kTypeBoundariesReference;
113  break;
114  }
115  case CrysLayout::barzflat: {
116  max_iphi = MAX_IPHI_BARZFLAT;
117  max_ieta = MAX_IETA_BARZFLAT;
118  nphi = kCrystalsInPhiBarZ;
119  keta = kCrystalsInEtaBarZ;
120  kTypeBoundaries = kTypeBoundariesBarZflat;
121  break;
122  }
123  case CrysLayout::barphiflat: {
124  max_iphi = MAX_IPHI_BARPHIFLAT;
125  max_ieta = MAX_IETA_BARPHIFLAT;
126  nphi = kCrystalsInPhiBarPhi;
127  keta = kCrystalsInEtaBarPhi;
128  kTypeBoundaries = kTypeBoundariesBarPhiFlat;
129  break;
130  }
131  default: { break; }
132  }
133  int zside = 0, rod = 0, module = 0, modtype = 1, crystal = 0;
134  if (tmphi > max_ieta * max_iphi) {
135  zside = 1;
136  }
137  int ip = (tmphi - 1) % max_iphi + 1;
138  int ie = (tmphi - 1) / max_iphi - max_ieta;
139  ie = (zside == 1 ? ie + 1 : -ie);
140  rod = (ip - 1) / nphi + 1;
141  module = (ie - 1) / keta + 1;
142  if (module > kTypeBoundaries[1]) {
143  modtype = (module > kTypeBoundaries[2] ? 3 : 2);
144  }
145  if (modtype > 1) {
146  module = module - kTypeBoundaries[modtype - 1];
147  }
148  crystal = zside == 1 ? ((ip - 1) % nphi + 1) + ((ie - 1) % keta) * nphi
149  : ((ip - 1) % nphi + 1) + (keta - 1 - (ie - 1) % keta) * nphi;
150  return BTLDetId(zside, rod, module, modtype, crystal);
151 }
152 
154  int mod = kTypeBoundariesReference[1];
155  if (lay == CrysLayout::barzflat) {
156  mod = kTypeBoundariesBarZflat[1];
157  } else if (lay == CrysLayout::barphiflat) {
158  mod = kTypeBoundariesBarPhiFlat[1];
159  }
160  return mod;
161 }
162 
164  // reorganize the modules to count from 0 to 54
165  // (0 to 42 in the case of BarZflat geometry)
166  // remove module type
167  // remove crystal index
168 
169  int boundRef = modulesPerType(lay);
170 
171  return BTLDetId(mtdSide(), mtdRR(), module() + boundRef * (modType() - 1), 0, 1);
172 }
173 
174 #include <iomanip>
175 
176 std::ostream& operator<<(std::ostream& os, const BTLDetId& id) {
177  os << (MTDDetId&)id;
178  os << " BTL " << std::endl
179  << " Side : " << id.mtdSide() << std::endl
180  << " Rod : " << id.mtdRR() << std::endl
181  << " Module : " << id.module() << std::endl
182  << " Crystal type: " << id.modType() << std::endl
183  << " Crystal : " << id.crystal() << std::endl;
184  return os;
185 }
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:57
int modulesPerType(CrysLayout lay) const
Definition: BTLDetId.cc:153
CrysLayout
Definition: BTLDetId.h:70
static constexpr int kCrystalsInPhiBarPhi
Definition: BTLDetId.h:40
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:30
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:163
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:65
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:95
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
std::ostream & operator<<(std::ostream &os, const BTLDetId &id)
Definition: BTLDetId.cc:176
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:198
int modType() const
Definition: BTLDetId.h:99
static constexpr int MAX_IPHI_BARPHIFLAT
Definition: BTLDetId.h:64
int crystal() const
Definition: BTLDetId.h:102