test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
EcalBarrelNumberingScheme Class Reference

#include <EcalBarrelNumberingScheme.h>

Inheritance diagram for EcalBarrelNumberingScheme:
EcalNumberingScheme CaloNumberingScheme

Public Member Functions

 EcalBarrelNumberingScheme ()
 
virtual uint32_t getUnitID (const EcalBaseNumber &baseNumber) const
 
 ~EcalBarrelNumberingScheme ()
 
- Public Member Functions inherited from EcalNumberingScheme
 EcalNumberingScheme ()
 
virtual ~EcalNumberingScheme ()
 
- Public Member Functions inherited from CaloNumberingScheme
 CaloNumberingScheme (int iv=0)
 Constructor with optional verbosity control. More...
 
void setVerbosity (const int)
 Verbosity setting. More...
 
virtual ~CaloNumberingScheme ()
 

Additional Inherited Members

- Protected Attributes inherited from CaloNumberingScheme
int verbosity
 Verbosity field: Zero = quiet, increasing integers mean more output. More...
 

Detailed Description

Definition at line 10 of file EcalBarrelNumberingScheme.h.

Constructor & Destructor Documentation

EcalBarrelNumberingScheme::EcalBarrelNumberingScheme ( )

Definition at line 10 of file EcalBarrelNumberingScheme.cc.

10  :
12  edm::LogInfo("EcalGeom") << "Creating EcalBarrelNumberingScheme";
13 }
EcalBarrelNumberingScheme::~EcalBarrelNumberingScheme ( )

Definition at line 15 of file EcalBarrelNumberingScheme.cc.

15  {
16  edm::LogInfo("EcalGeom") << "Deleting EcalBarrelNumberingScheme";
17 }

Member Function Documentation

uint32_t EcalBarrelNumberingScheme::getUnitID ( const EcalBaseNumber baseNumber) const
virtual

Implements EcalNumberingScheme.

Definition at line 19 of file EcalBarrelNumberingScheme.cc.

References eta, EcalBaseNumber::getCopyNumber(), EcalBaseNumber::getLevelName(), EcalBaseNumber::getLevels(), phi, and AlCaHLTBitMon_QueryRunRegistry::string.

19  {
20 
21  const uint32_t nLevels ( baseNumber.getLevels() ) ;
22 
23 // LogDebug("EcalGeom") << "ECalBarrelNumberingScheme geometry levels = " << nLevels;
24 
25 
26  if( 12 > nLevels )
27  {
28  edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
29  << "Not enough levels found in EcalBaseNumber ( "
30  << nLevels
31  << ") Returning 0" ;
32  return 0;
33  }
34 
35  const std::string& cryName ( baseNumber.getLevelName( 0 ) ) ; // name of crystal volume
36 
37  const int cryType ( ::atoi( cryName.c_str() + 5 ) ) ;
38 
39  const int off ( 12 < nLevels ? 3 : 0 ) ;
40 
41  const uint32_t wallCopy ( baseNumber.getCopyNumber( 3 + off ) ) ;
42  const uint32_t hawCopy ( baseNumber.getCopyNumber( 4 + off ) ) ;
43  const uint32_t fawCopy ( baseNumber.getCopyNumber( 5 + off ) ) ;
44  const uint32_t supmCopy ( baseNumber.getCopyNumber( 6 + off ) ) ;
45 
46 // LogDebug("EcalGeom") << baseNumber.getLevelName(0) << ", "
47 // << baseNumber.getLevelName(1) << ", "
48 // << baseNumber.getLevelName(2) << ", "
49 // << baseNumber.getLevelName(3) << ", "
50 // << baseNumber.getLevelName(4) << ", "
51 // << baseNumber.getLevelName(5) << ", "
52 // << baseNumber.getLevelName(6) << ", "
53 // << baseNumber.getLevelName(7) ;
54 
55  // error checking
56 
57  if( 1 > cryType ||
58  17 < cryType )
59  {
60  edm::LogWarning("EdalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
61  << "****************** Bad crystal name = "
62  << cryName
63  << ", Volume Name = "
64  << baseNumber.getLevelName(0) ;
65  return 0 ;
66  }
67 
68  if( 1 > wallCopy ||
69  5 < wallCopy )
70  {
71  edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
72  << "****************** Bad wall copy = "
73  << wallCopy
74  << ", Volume Name = "
75  << baseNumber.getLevelName(3) ;
76  return 0 ;
77  }
78 
79  if( 1 > hawCopy ||
80  2 < hawCopy )
81  {
82  edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
83  << "****************** Bad haw copy = "
84  << hawCopy
85  << ", Volume Name = "
86  << baseNumber.getLevelName(4) ;
87  return 0 ;
88  }
89 
90  if( 1 > fawCopy ||
91  10 < fawCopy )
92  {
93  edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
94  << "****************** Bad faw copy = "
95  << fawCopy
96  << ", Volume Name = "
97  << baseNumber.getLevelName(5) ;
98  return 0 ;
99  }
100 
101  if( 1 > supmCopy ||
102  36 < supmCopy )
103  {
104  edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
105  << "****************** Bad supermodule copy = "
106  << supmCopy
107  << ", Volume Name = "
108  << baseNumber.getLevelName(6) ;
109  return 0 ;
110  }
111 
112  // all inputs are fine. Go ahead and decode
113 
114  const int32_t zsign ( 18 < supmCopy ? -1 : 1 ) ;
115 
116  const int32_t eta ( 5*( cryType - 1 ) + wallCopy ) ;
117 
118  const int32_t phi ( 18 < supmCopy ?
119  20*( supmCopy - 19 ) + 2*( 10 - fawCopy ) + 3 - hawCopy :
120  20*( supmCopy - 1 ) + 2*( fawCopy - 1 ) + hawCopy ) ;
121 
122  const int32_t intindex ( EBDetId( zsign*eta, phi ).rawId() ) ;
123 
124 /*
125  static int count ( 1 ) ;
126  if( 0==count%1000 )
127  {
128  std::cout<<"************************** NLEVELS="<<nLevels
129  <<", eta="<<eta<<", phi="<<phi<<", zsign="<<zsign<<std::endl;
130  }
131  ++count;
132 */
133 // LogDebug("EcalGeom") << "EcalBarrelNumberingScheme: "
134 // << "supmCopy = " << supmCopy
135 // << ", fawCopy = " << fawCopy
136 // << ", hawCopy = " << hawCopy
137 // << ", wallCopy = " << wallCopy
138 // << ", cryType = " << cryType
139 // << "\n zsign = " << zsign
140 // << ", eta = " << eta
141 // << ", phi = " << phi
142 // << ", packed index = 0x" << std::hex << intindex << std::dec ;
143 
144  return intindex ;
145 }
std::string const & getLevelName(int level) const
int getCopyNumber(int level) const
int getLevels() const