CMS 3D CMS Logo

List of all members | Public Member Functions
BTLNumberingScheme Class Reference

#include <BTLNumberingScheme.h>

Inheritance diagram for BTLNumberingScheme:
MTDNumberingScheme

Public Member Functions

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

Detailed Description

Definition at line 6 of file BTLNumberingScheme.h.

Constructor & Destructor Documentation

◆ BTLNumberingScheme()

BTLNumberingScheme::BTLNumberingScheme ( )

Definition at line 9 of file BTLNumberingScheme.cc.

10 #ifdef EDM_ML_DEBUG
11  edm::LogInfo("MTDGeom") << "Creating BTLNumberingScheme";
12 #endif
13 }

◆ ~BTLNumberingScheme()

BTLNumberingScheme::~BTLNumberingScheme ( )
override

Definition at line 15 of file BTLNumberingScheme.cc.

15  {
16 #ifdef EDM_ML_DEBUG
17  edm::LogInfo("MTDGeom") << "Deleting BTLNumberingScheme";
18 #endif
19 }

Member Function Documentation

◆ getUnitID()

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

Implements MTDNumberingScheme.

Definition at line 21 of file BTLNumberingScheme.cc.

21  {
22  const uint32_t nLevels(baseNumber.getLevels());
23 
24 #ifdef EDM_ML_DEBUG
25  edm::LogInfo("MTDGeom") << "BTLNumberingScheme geometry levels = " << nLevels;
26 #endif
27 
28  if (9 > nLevels) {
29  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
30  << "Not enough levels found in MTDBaseNumber ( " << nLevels << ") Returning 0";
31  return 0;
32  }
33 
34 #ifdef EDM_ML_DEBUG
35  edm::LogInfo("MTDGeom") << baseNumber.getLevelName(0) << ", " << baseNumber.getLevelName(1) << ", "
36  << baseNumber.getLevelName(2) << ", " << baseNumber.getLevelName(3) << ", "
37  << baseNumber.getLevelName(4) << ", " << baseNumber.getLevelName(5) << ", "
38  << baseNumber.getLevelName(6) << ", " << baseNumber.getLevelName(7) << ", "
39  << baseNumber.getLevelName(8);
40 #endif
41 
42  const uint32_t crystal(baseNumber.getCopyNumber(0));
43 
44  const uint32_t modCopy(baseNumber.getCopyNumber(2));
45  const uint32_t rodCopy(baseNumber.getCopyNumber(3));
46 
47  const std::string& modName(baseNumber.getLevelName(2)); // name of module volume
48  uint32_t pos = modName.find("Positive");
49 
50  const uint32_t zside = (pos <= strlen(modName.c_str()) ? 1 : 0);
51  std::string baseName = modName.substr(modName.find(':') + 1);
52 
53  // trick to accomodate both 54, 42 and 48 modules designs
54  const int modtyp(
55  ::atoi((baseName.substr(8, 1)).c_str()) == 9 || ::atoi((baseName.substr(8, 1)).c_str()) == 5 ||
56  (::atoi((baseName.substr(8, 1)).c_str()) == 7 && ::atoi((baseName.substr(7, 1)).c_str()) == 1)
57  ? ::atoi((baseName.substr(7, 1)).c_str()) + 1
58  : ::atoi((baseName.substr(7, 1)).c_str()));
59 
60  // error checking
61 
62  if (1 > crystal || 64 < crystal) {
63  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
64  << "****************** Bad crystal number = " << crystal
65  << ", Volume Number = " << baseNumber.getCopyNumber(0);
66  return 0;
67  }
68 
69  if (1 > modtyp || 3 < modtyp) {
70  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
71  << "****************** Bad module name = " << modName
72  << ", Volume Name = " << baseNumber.getLevelName(2);
73  return 0;
74  }
75 
76  if (1 > modCopy || 54 < modCopy) {
77  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
78  << "****************** Bad module copy = " << modCopy
79  << ", Volume Number = " << baseNumber.getCopyNumber(2);
80  return 0;
81  }
82 
83  if (1 > rodCopy || 36 < rodCopy) {
84  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
85  << "****************** Bad rod copy = " << rodCopy
86  << ", Volume Number = " << baseNumber.getCopyNumber(4);
87  return 0;
88  }
89 
90  // all inputs are fine. Go ahead and decode
91 
92  BTLDetId thisBTLdetid(zside, rodCopy, modCopy, modtyp, crystal);
93  const uint32_t intindex = thisBTLdetid.rawId();
94 
95 #ifdef EDM_ML_DEBUG
96  edm::LogInfo("MTDGeom") << "BTL Numbering scheme: "
97  << " rod = " << rodCopy << " zside = " << zside << " module = " << modCopy
98  << " modtyp = " << modtyp << " crystal = " << crystal << " Raw Id = " << intindex << "\n"
99  << thisBTLdetid;
100 #endif
101 
102  return intindex;
103 }

References MTDBaseNumber::getCopyNumber(), MTDBaseNumber::getLevelName(), MTDBaseNumber::getLevels(), DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::zside().

ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
pos
Definition: PixelAliasList.h:18
MTDBaseNumber::getCopyNumber
int getCopyNumber(int level) const
Definition: MTDBaseNumber.cc:32
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MTDBaseNumber::getLevels
int getLevels() const
Definition: MTDBaseNumber.cc:30
MTDBaseNumber::getLevelName
std::string const & getLevelName(int level) const
Definition: MTDBaseNumber.cc:43
BTLDetId
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0,...
Definition: BTLDetId.h:18
MTDNumberingScheme::MTDNumberingScheme
MTDNumberingScheme()
Definition: MTDNumberingScheme.cc:3
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256