CMS 3D CMS Logo

ETLNumberingScheme.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 
6 //#define EDM_ML_DEBUG
7 
10 #ifdef EDM_ML_DEBUG
11  edm::LogInfo("MTDGeom") << "Creating ETLNumberingScheme";
12 #endif
13 }
14 
16 #ifdef EDM_ML_DEBUG
17  edm::LogInfo("MTDGeom") << "Deleting ETLNumberingScheme";
18 #endif
19 }
20 
21 uint32_t ETLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
22 
23  const uint32_t nLevels ( baseNumber.getLevels() ) ;
24 
25 #ifdef EDM_ML_DEBUG
26  edm::LogInfo("MTDGeom") << "ETLNumberingScheme geometry levels = " << nLevels;
27 #endif
28 
29 
30  if( 11 > nLevels )
31  {
32  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
33  << "Not enough levels found in MTDBaseNumber ( "
34  << nLevels
35  << ") Returning 0" ;
36  return 0;
37  }
38 
39  const uint32_t modCopy ( baseNumber.getCopyNumber( 2 ) ) ;
40 
41  const std::string& ringName ( baseNumber.getLevelName( 3 ) ) ; // name of ring volume
42  const int modtyp(0) ;
43  std::string baseName = ringName.substr(ringName.find(":")+1);
44  const int ringCopy ( ::atoi( baseName.c_str() + 4 ) );
45 
46  const uint32_t sideCopy ( baseNumber.getCopyNumber( 7 ) ) ;
47  const uint32_t zside ( sideCopy == 1 ? 1 : 0 ) ;
48 
49 #ifdef EDM_ML_DEBUG
50  edm::LogInfo("MTDGeom") << baseNumber.getLevelName(0) << ", "
51  << baseNumber.getLevelName(1) << ", "
52  << baseNumber.getLevelName(2) << ", "
53  << baseNumber.getLevelName(3) << ", "
54  << baseNumber.getLevelName(4) << ", "
55  << baseNumber.getLevelName(5) << ", "
56  << baseNumber.getLevelName(6) << ", "
57  << baseNumber.getLevelName(7) << ", "
58  << baseNumber.getLevelName(8) << ", "
59  << baseNumber.getLevelName(9) << ", "
60  << baseNumber.getLevelName(10) << ", "
61  << baseNumber.getLevelName(11) ;
62 #endif
63 
64  // error checking
65 
66  if( modtyp != 0 )
67  {
68  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
69  << "****************** Bad module name = "
70  << modtyp
71  << ", Volume Name = "
72  << baseNumber.getLevelName(4) ;
73  return 0 ;
74  }
75 
76  if( 1 > modCopy ||
77  176 < modCopy )
78  {
79  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
80  << "****************** Bad module copy = "
81  << modCopy
82  << ", Volume Number = "
83  << baseNumber.getCopyNumber(4) ;
84  return 0 ;
85  }
86 
87  if( 1 > ringCopy ||
88  11 < ringCopy )
89  {
90  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
91  << "****************** Bad ring copy = "
92  << ringCopy
93  << ", Volume Number = "
94  << baseNumber.getCopyNumber(3) ;
95  return 0 ;
96  }
97 
98  // all inputs are fine. Go ahead and decode
99 
100  ETLDetId thisETLdetid( zside, ringCopy, modCopy, modtyp );
101  const int32_t intindex = thisETLdetid.rawId() ;
102 
103 #ifdef EDM_ML_DEBUG
104  edm::LogInfo("MTDGeom") << "ETL Numbering scheme: "
105  << " ring = " << ringCopy
106  << " zside = " << zside
107  << " module = " << modCopy
108  << " modtyp = " << modtyp
109  << " Raw Id = " << intindex
110  << thisETLdetid;
111 #endif
112 
113  return intindex ;
114 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
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