CMS 3D CMS Logo

ETLNumberingScheme.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 
6 //#define EDM_ML_DEBUG
7 
9 #ifdef EDM_ML_DEBUG
10  edm::LogInfo("MTDGeom") << "Creating ETLNumberingScheme";
11 #endif
12 }
13 
15 #ifdef EDM_ML_DEBUG
16  edm::LogInfo("MTDGeom") << "Deleting ETLNumberingScheme";
17 #endif
18 }
19 
20 uint32_t ETLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
21  const uint32_t nLevels(baseNumber.getLevels());
22 
23 #ifdef EDM_ML_DEBUG
24  edm::LogInfo("MTDGeom") << "ETLNumberingScheme geometry levels = " << nLevels;
25 #endif
26 
27  if (11 > nLevels) {
28  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
29  << "Not enough levels found in MTDBaseNumber ( " << nLevels << ") Returning 0";
30  return 0;
31  }
32 
33  const uint32_t modCopy(baseNumber.getCopyNumber(2));
34 
35  const std::string& ringName(baseNumber.getLevelName(3)); // name of ring volume
36  const int modtyp(0);
37  std::string baseName = ringName.substr(ringName.find(":") + 1);
38  const int ringCopy(::atoi(baseName.c_str() + 4));
39 
40  // Side choice: up to scenario D38 is given by level 7 (HGCal v9)
41  int nSide(7);
42  const std::string& sideName(baseNumber.getLevelName(nSide));
43  // Side choice: from scenario D41 is given by level 8 (HGCal v10)
44  if (sideName.find("CALOECTSFront") != std::string::npos) {
45  nSide = 8;
46  }
47  const uint32_t sideCopy(baseNumber.getCopyNumber(nSide));
48  const uint32_t zside(sideCopy == 1 ? 1 : 0);
49 
50 #ifdef EDM_ML_DEBUG
51  edm::LogInfo("MTDGeom") << baseNumber.getLevelName(0) << ", " << baseNumber.getLevelName(1) << ", "
52  << baseNumber.getLevelName(2) << ", " << baseNumber.getLevelName(3) << ", "
53  << baseNumber.getLevelName(4) << ", " << baseNumber.getLevelName(5) << ", "
54  << baseNumber.getLevelName(6) << ", " << baseNumber.getLevelName(7) << ", "
55  << baseNumber.getLevelName(8) << ", " << baseNumber.getLevelName(9) << ", "
56  << baseNumber.getLevelName(10) << ", " << baseNumber.getLevelName(11);
57 #endif
58 
59  // error checking
60 
61  if (modtyp != 0) {
62  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
63  << "****************** Bad module name = " << modtyp
64  << ", Volume Name = " << baseNumber.getLevelName(4);
65  return 0;
66  }
67 
68  if (1 > modCopy || 176 < modCopy) {
69  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
70  << "****************** Bad module copy = " << modCopy
71  << ", Volume Number = " << baseNumber.getCopyNumber(4);
72  return 0;
73  }
74 
75  if (1 > ringCopy || 11 < ringCopy) {
76  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
77  << "****************** Bad ring copy = " << ringCopy
78  << ", Volume Number = " << baseNumber.getCopyNumber(3);
79  return 0;
80  }
81 
82  // all inputs are fine. Go ahead and decode
83 
84  ETLDetId thisETLdetid(zside, ringCopy, modCopy, modtyp);
85  const int32_t intindex = thisETLdetid.rawId();
86 
87 #ifdef EDM_ML_DEBUG
88  edm::LogInfo("MTDGeom") << "ETL Numbering scheme: "
89  << " ring = " << ringCopy << " zside = " << zside << " module = " << modCopy
90  << " modtyp = " << modtyp << " Raw Id = " << intindex << thisETLdetid;
91 #endif
92 
93  return intindex;
94 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
int zside(DetId const &)
int getLevels() const
~ETLNumberingScheme() override
int getCopyNumber(int level) const
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
std::string const & getLevelName(int level) const