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 }

◆ ~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 }

Member Function Documentation

◆ getUnitID()

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

Implements MTDNumberingScheme.

Definition at line 20 of file ETLNumberingScheme.cc.

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& ringName(baseNumber.getLevelName(3)); // name of ring volume
40  int modtyp(0);
41  std::string baseName = ringName.substr(ringName.find(":") + 1);
42  int ringCopy(::atoi(baseName.c_str() + 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) ? 2 : 1;
54  }
55 
56  // Side choice: up to scenario D38 is given by level 7 (HGCal v9)
57  int nSide(7);
58  const std::string& 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 || ETLDetId::kETLv4maxModule < modCopy))) {
86  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
87  << "****************** Bad module copy = " << modCopy
88  << ", Volume Number = " << baseNumber.getCopyNumber(4);
89  return 0;
90  }
91 
92  if ((preTDR && (1 > ringCopy || ETLDetId::kETLv1maxRing < ringCopy)) ||
93  (!preTDR && (1 > ringCopy || ETLDetId::kETLv4maxRing < ringCopy))) {
94  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
95  << "****************** Bad ring copy = " << ringCopy
96  << ", Volume Number = " << baseNumber.getCopyNumber(3);
97  return 0;
98  }
99 
100  // all inputs are fine. Go ahead and decode
101 
102  ETLDetId thisETLdetid(zside, ringCopy, modCopy, modtyp);
103  const uint32_t intindex = thisETLdetid.rawId();
104 
105 #ifdef EDM_ML_DEBUG
106  edm::LogInfo("MTDGeom") << "ETL Numbering scheme: "
107  << " ring = " << ringCopy << " zside = " << zside << " module = " << modCopy
108  << " modtyp = " << modtyp << " Raw Id = " << intindex << thisETLdetid;
109 #endif
110  if (!preTDR) {
111  ETLDetId altETLdetid(zside, discN, sectorS, sectorN, modCopy, modtyp);
112  const uint32_t altintindex = altETLdetid.rawId();
113  if (intindex != altintindex) {
114  edm::LogWarning("MTDGeom") << "Incorrect alternative construction \n"
115  << "disc = " << discN << " disc side = " << sectorS << " sector = " << sectorN << "\n"
116  << altETLdetid;
117  }
118  }
119 
120  return intindex;
121 }

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

relativeConstraints.ringName
ringName
Definition: relativeConstraints.py:54
ETLDetId::kETLv4maxRing
static constexpr int kETLv4maxRing
Definition: ETLDetId.h:33
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
ETLDetId::kETLv1maxModule
static constexpr int kETLv1maxModule
Definition: ETLDetId.h:23
edm::LogInfo
Definition: MessageLogger.h:254
ETLDetId::encodeSector
uint32_t encodeSector(uint32_t &disc, uint32_t &discside, uint32_t &sector) const
Definition: ETLDetId.h:62
MTDBaseNumber::getCopyNumber
int getCopyNumber(int level) const
Definition: MTDBaseNumber.cc:32
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
MTDBaseNumber::getLevels
int getLevels() const
Definition: MTDBaseNumber.cc:30
MTDBaseNumber::getLevelName
std::string const & getLevelName(int level) const
Definition: MTDBaseNumber.cc:43
MTDNumberingScheme::MTDNumberingScheme
MTDNumberingScheme()
Definition: MTDNumberingScheme.cc:3
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
ETLDetId::kETLv4maxModule
static constexpr int kETLv4maxModule
Definition: ETLDetId.h:34
ETLDetId::kETLv1maxRing
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:22