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  // Side choice: up to scenario D38 is given by level 7 (HGCal v9)
47  int nSide(7);
48  const std::string& sideName ( baseNumber.getLevelName( nSide ) ) ;
49  // Side choice: from scenario D41 is given by level 8 (HGCal v10)
50  if ( sideName.find("CALOECTSFront") != std::string::npos ) { nSide = 8 ;}
51  const uint32_t sideCopy ( baseNumber.getCopyNumber( nSide ) ) ;
52  const uint32_t zside ( sideCopy == 1 ? 1 : 0 ) ;
53 
54 #ifdef EDM_ML_DEBUG
55  edm::LogInfo("MTDGeom") << baseNumber.getLevelName(0) << ", "
56  << baseNumber.getLevelName(1) << ", "
57  << baseNumber.getLevelName(2) << ", "
58  << baseNumber.getLevelName(3) << ", "
59  << baseNumber.getLevelName(4) << ", "
60  << baseNumber.getLevelName(5) << ", "
61  << baseNumber.getLevelName(6) << ", "
62  << baseNumber.getLevelName(7) << ", "
63  << baseNumber.getLevelName(8) << ", "
64  << baseNumber.getLevelName(9) << ", "
65  << baseNumber.getLevelName(10) << ", "
66  << baseNumber.getLevelName(11) ;
67 #endif
68 
69  // error checking
70 
71  if( modtyp != 0 )
72  {
73  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
74  << "****************** Bad module name = "
75  << modtyp
76  << ", Volume Name = "
77  << baseNumber.getLevelName(4) ;
78  return 0 ;
79  }
80 
81  if( 1 > modCopy ||
82  176 < modCopy )
83  {
84  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
85  << "****************** Bad module copy = "
86  << modCopy
87  << ", Volume Number = "
88  << baseNumber.getCopyNumber(4) ;
89  return 0 ;
90  }
91 
92  if( 1 > ringCopy ||
93  11 < ringCopy )
94  {
95  edm::LogWarning("MTDGeom") << "ETLNumberingScheme::getUnitID(): "
96  << "****************** Bad ring copy = "
97  << ringCopy
98  << ", Volume Number = "
99  << baseNumber.getCopyNumber(3) ;
100  return 0 ;
101  }
102 
103  // all inputs are fine. Go ahead and decode
104 
105  ETLDetId thisETLdetid( zside, ringCopy, modCopy, modtyp );
106  const int32_t intindex = thisETLdetid.rawId() ;
107 
108 #ifdef EDM_ML_DEBUG
109  edm::LogInfo("MTDGeom") << "ETL Numbering scheme: "
110  << " ring = " << ringCopy
111  << " zside = " << zside
112  << " module = " << modCopy
113  << " modtyp = " << modtyp
114  << " Raw Id = " << intindex
115  << thisETLdetid;
116 #endif
117 
118  return intindex ;
119 }
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