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 ( )

Definition at line 9 of file BTLNumberingScheme.cc.

9  :
11 #ifdef EDM_ML_DEBUG
12  edm::LogInfo("MTDGeom") << "Creating BTLNumberingScheme";
13 #endif
14 }
BTLNumberingScheme::~BTLNumberingScheme ( )
override

Definition at line 16 of file BTLNumberingScheme.cc.

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

Member Function Documentation

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

Implements MTDNumberingScheme.

Definition at line 22 of file BTLNumberingScheme.cc.

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

22  {
23 
24  const uint32_t nLevels ( baseNumber.getLevels() ) ;
25 
26 #ifdef EDM_ML_DEBUG
27  edm::LogInfo("MTDGeom") << "BTLNumberingScheme geometry levels = " << nLevels;
28 #endif
29 
30  if( 9 > nLevels )
31  {
32  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
33  << "Not enough levels found in MTDBaseNumber ( "
34  << nLevels
35  << ") Returning 0" ;
36  return 0;
37  }
38 
39 #ifdef EDM_ML_DEBUG
40  edm::LogInfo("MTDGeom") << baseNumber.getLevelName(0) << ", "
41  << baseNumber.getLevelName(1) << ", "
42  << baseNumber.getLevelName(2) << ", "
43  << baseNumber.getLevelName(3) << ", "
44  << baseNumber.getLevelName(4) << ", "
45  << baseNumber.getLevelName(5) << ", "
46  << baseNumber.getLevelName(6) << ", "
47  << baseNumber.getLevelName(7) << ", "
48  << baseNumber.getLevelName(8);
49 #endif
50 
51  const uint32_t crystal ( baseNumber.getCopyNumber( 0 ) ) ;
52 
53  const uint32_t modCopy ( baseNumber.getCopyNumber( 2 ) ) ;
54  const uint32_t rodCopy ( baseNumber.getCopyNumber( 3 ) ) ;
55 
56  const std::string& modName ( baseNumber.getLevelName( 2 ) ) ; // name of module volume
57  uint32_t pos = modName.find("Positive");
58 
59  const uint32_t zside = ( pos <= strlen(modName.c_str()) ? 1 : 0 );
60  std::string baseName = modName.substr(modName.find(":")+1);
61 
62  // trick to accomodate both 54 and 42 modules designs
63  const int modtyp ( ::atoi( (baseName.substr(8,1)).c_str() ) == 9 || ::atoi( (baseName.substr(8,1)).c_str() ) == 5 ?
64  ::atoi( (baseName.substr(7,1)).c_str() ) + 1 : ::atoi( (baseName.substr(7,1)).c_str() ) ) ;
65 
66  // error checking
67 
68  if( 1 > crystal ||
69  64 < crystal )
70  {
71  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
72  << "****************** Bad crystal number = "
73  << crystal
74  << ", Volume Number = "
75  << baseNumber.getCopyNumber(0);
76  return 0 ;
77  }
78 
79  if( 1 > modtyp ||
80  3 < modtyp )
81  {
82  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
83  << "****************** Bad module name = "
84  << modName
85  << ", Volume Name = "
86  << baseNumber.getLevelName(2) ;
87  return 0 ;
88  }
89 
90  if( 1 > modCopy ||
91  54 < modCopy )
92  {
93  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
94  << "****************** Bad module copy = "
95  << modCopy
96  << ", Volume Number = "
97  << baseNumber.getCopyNumber(2) ;
98  return 0 ;
99  }
100 
101  if( 1 > rodCopy ||
102  36 < rodCopy )
103  {
104  edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
105  << "****************** Bad rod copy = "
106  << rodCopy
107  << ", Volume Number = "
108  << baseNumber.getCopyNumber(4) ;
109  return 0 ;
110  }
111 
112  // all inputs are fine. Go ahead and decode
113 
114  BTLDetId thisBTLdetid( zside, rodCopy, modCopy, modtyp, crystal );
115  const int32_t intindex = thisBTLdetid.rawId() ;
116 
117 #ifdef EDM_ML_DEBUG
118  edm::LogInfo("MTDGeom") << "BTL Numbering scheme: "
119  << " rod = " << rodCopy
120  << " zside = " << zside
121  << " module = " << modCopy
122  << " modtyp = " << modtyp
123  << " crystal = " << crystal
124  << " Raw Id = " << intindex
125  << thisBTLdetid;
126 #endif
127 
128  return intindex ;
129 }
int zside(DetId const &)
int getLevels() const
int getCopyNumber(int level) const
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
std::string const & getLevelName(int level) const