CMS 3D CMS Logo

List of all members | Public Member Functions
ETLNumberingScheme Class Reference

#include <ETLNumberingScheme.h>

Inheritance diagram for ETLNumberingScheme:
MTDNumberingScheme

Public Member Functions

 ETLNumberingScheme ()
 
uint32_t getUnitID (const MTDBaseNumber &baseNumber) const override
 
 ~ETLNumberingScheme () override
 
- Public Member Functions inherited from MTDNumberingScheme
 MTDNumberingScheme ()
 
virtual ~MTDNumberingScheme ()
 

Detailed Description

Definition at line 6 of file ETLNumberingScheme.h.

Constructor & Destructor Documentation

◆ ETLNumberingScheme()

ETLNumberingScheme::ETLNumberingScheme ( )

Definition at line 8 of file ETLNumberingScheme.cc.

9 #ifdef EDM_ML_DEBUG
10  edm::LogInfo("MTDGeom") << "Creating ETLNumberingScheme";
11 #endif
12 }
Log< level::Info, false > LogInfo

◆ ~ETLNumberingScheme()

ETLNumberingScheme::~ETLNumberingScheme ( )
override

Definition at line 14 of file ETLNumberingScheme.cc.

14  {
15 #ifdef EDM_ML_DEBUG
16  edm::LogInfo("MTDGeom") << "Deleting ETLNumberingScheme";
17 #endif
18 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ getUnitID()

uint32_t ETLNumberingScheme::getUnitID ( const MTDBaseNumber baseNumber) const
overridevirtual

Implements MTDNumberingScheme.

Definition at line 20 of file ETLNumberingScheme.cc.

References ETLDetId::encodeSector(), MTDBaseNumber::getCopyNumber(), MTDBaseNumber::getLevelName(), MTDBaseNumber::getLevels(), ETLDetId::kETLv1maxModule, ETLDetId::kETLv1maxRing, ETLDetId::kETLv4maxModule, ETLDetId::kETLv4maxRing, ETLDetId::kETLv5maxModule, SiStripPI::max, DetId::rawId(), relativeConstraints::ringName, and ecaldqm::zside().

20  {
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  // Discriminate pre-TDR and TDR scenarios
34 
35  const bool preTDR = (baseNumber.getLevelName(3).find("Ring") != std::string::npos);
36 
37  const uint32_t modCopy(baseNumber.getCopyNumber(2));
38 
39  const std::string_view& ringName(baseNumber.getLevelName(3)); // name of ring volume
40  int modtyp(0);
41  std::string_view baseName = ringName.substr(ringName.find(':') + 1);
42  int ringCopy(::atoi(baseName.data() + 4));
43 
44  uint32_t discN, sectorS, sectorN;
45  if (!preTDR) {
46  discN = (baseNumber.getLevelName(4).find("Disc1") != std::string::npos) ? 0 : 1;
47  sectorS = (baseNumber.getLevelName(3).find("Front") != std::string::npos) ? 0 : 1;
48  sectorN = baseNumber.getCopyNumber(3);
49 
50  ETLDetId tmpId;
51  ringCopy = static_cast<int>(tmpId.encodeSector(discN, sectorS, sectorN));
52 
53  modtyp = (baseNumber.getLevelName(2).find("_Left") != std::string::npos) ? 1 : 2;
54  }
55 
56  // Side choice: up to scenario D38 is given by level 7 (HGCal v9)
57  int nSide(7);
58  const std::string_view& sideName(baseNumber.getLevelName(nSide));
59  // Side choice: from scenario D41 is given by level 8 (HGCal v10)
60  if (sideName.find("CALOECTSFront") != std::string::npos) {
61  nSide = 8;
62  }
63  const uint32_t sideCopy(baseNumber.getCopyNumber(nSide));
64  const uint32_t zside(sideCopy == 1 ? 1 : 0);
65 
66 #ifdef EDM_ML_DEBUG
67  edm::LogInfo("MTDGeom") << baseNumber.getLevelName(0) << ", " << baseNumber.getLevelName(1) << ", "
68  << baseNumber.getLevelName(2) << ", " << baseNumber.getLevelName(3) << ", "
69  << baseNumber.getLevelName(4) << ", " << baseNumber.getLevelName(5) << ", "
70  << baseNumber.getLevelName(6) << ", " << baseNumber.getLevelName(7) << ", "
71  << baseNumber.getLevelName(8) << ", " << baseNumber.getLevelName(9) << ", "
72  << baseNumber.getLevelName(10) << ", " << baseNumber.getLevelName(11);
73 #endif
74 
75  // error checking
76 
77  if ((modtyp != 0 && preTDR) || (modtyp == 0 && !preTDR)) {
78  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
79  << "****************** Bad module name = " << modtyp
80  << ", Volume Name = " << baseNumber.getLevelName(4);
81  return 0;
82  }
83 
84  if ((preTDR && (1 > modCopy || ETLDetId::kETLv1maxModule < modCopy)) ||
85  (!preTDR && (1 > modCopy ||
86  static_cast<unsigned>(std::max(ETLDetId::kETLv4maxModule, ETLDetId::kETLv5maxModule)) < modCopy))) {
87  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
88  << "****************** Bad module copy = " << modCopy
89  << ", Volume Number = " << baseNumber.getCopyNumber(4);
90  return 0;
91  }
92 
93  if ((preTDR && (1 > ringCopy || ETLDetId::kETLv1maxRing < ringCopy)) ||
94  (!preTDR && (1 > ringCopy || ETLDetId::kETLv4maxRing < ringCopy))) {
95  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
96  << "****************** Bad ring copy = " << ringCopy
97  << ", Volume Number = " << baseNumber.getCopyNumber(3);
98  return 0;
99  }
100 
101  // all inputs are fine. Go ahead and decode
102 
103  ETLDetId thisETLdetid(zside, ringCopy, modCopy, modtyp);
104  const uint32_t intindex = thisETLdetid.rawId();
105 
106 #ifdef EDM_ML_DEBUG
107  edm::LogInfo("MTDGeom") << "ETL Numbering scheme: "
108  << " ring = " << ringCopy << " zside = " << zside << " module = " << modCopy
109  << " modtyp = " << modtyp << " Raw Id = " << intindex << thisETLdetid;
110 #endif
111  if (!preTDR) {
112  ETLDetId altETLdetid(zside, discN, sectorS, sectorN, modCopy, modtyp);
113  const uint32_t altintindex = altETLdetid.rawId();
114  if (intindex != altintindex) {
115  edm::LogWarning("MTDGeom") << "Incorrect alternative construction \n"
116  << "disc = " << discN << " disc side = " << sectorS << " sector = " << sectorN << "\n"
117  << altETLdetid;
118  }
119  }
120 
121  return intindex;
122 }
int getCopyNumber(int level) const
int getLevels() const
static constexpr int kETLv4maxModule
Definition: ETLDetId.h:41
int zside(DetId const &)
static constexpr int kETLv1maxModule
Definition: ETLDetId.h:29
uint32_t encodeSector(uint32_t &disc, uint32_t &discside, uint32_t &sector) const
Definition: ETLDetId.h:88
std::string_view const & getLevelName(int level) const
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:28
Log< level::Info, false > LogInfo
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
Log< level::Warning, false > LogWarning
static constexpr int kETLv5maxModule
Definition: ETLDetId.h:46
static constexpr int kETLv4maxRing
Definition: ETLDetId.h:39