CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
EcalBarrelNumberingScheme Class Reference

#include <EcalBarrelNumberingScheme.h>

Inheritance diagram for EcalBarrelNumberingScheme:
EcalNumberingScheme CaloNumberingScheme

Public Member Functions

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

Private Member Functions

std::pair< int, int > numbers (const std::string &) const
 

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 11 of file EcalBarrelNumberingScheme.h.

Constructor & Destructor Documentation

◆ EcalBarrelNumberingScheme()

EcalBarrelNumberingScheme::EcalBarrelNumberingScheme ( )

Definition at line 11 of file EcalBarrelNumberingScheme.cc.

12 #ifdef EDM_ML_DEBUG
13  edm::LogVerbatim("EcalGeom") << "Creating EcalBarrelNumberingScheme";
14 #endif
15 }
Log< level::Info, true > LogVerbatim

◆ ~EcalBarrelNumberingScheme()

EcalBarrelNumberingScheme::~EcalBarrelNumberingScheme ( )
override

Definition at line 17 of file EcalBarrelNumberingScheme.cc.

17  {
18 #ifdef EDM_ML_DEBUG
19  edm::LogVerbatim("EcalGeom") << "Deleting EcalBarrelNumberingScheme";
20 #endif
21 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ getUnitID()

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

Implements EcalNumberingScheme.

Definition at line 23 of file EcalBarrelNumberingScheme.cc.

References TauDecayModes::dec, PVValHelper::eta, EcalBaseNumber::getCopyNumber(), EcalBaseNumber::getLevelName(), EcalBaseNumber::getLevels(), dqmdumpme::k, numbers(), phi, nano_mu_digi_cff::rawId, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EcalDumpGeometry::dumpTouch().

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

◆ numbers()

std::pair< int, int > EcalBarrelNumberingScheme::numbers ( const std::string &  name) const
private

Definition at line 129 of file EcalBarrelNumberingScheme.cc.

References Skims_PA_cff::name.

Referenced by getUnitID().

129  {
130  int num1(-1), num2(-1);
131  if (name.find('#') != std::string::npos) {
132  uint32_t ip1 = name.find('#');
133  if (name.find('!') != std::string::npos) {
134  uint32_t ip2 = name.find('!');
135  num1 = ::atoi(name.substr(ip1 + 1, ip2 - ip1 - 1).c_str());
136  if (name.find('#', ip2) != std::string::npos) {
137  uint32_t ip3 = name.find('#', ip2);
138  num2 = ::atoi(name.substr(ip3 + 1, name.size() - ip3 - 1).c_str());
139  }
140  }
141  }
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("EcalGeom") << "EcalBarrelNumberingScheme::Numbers from " << name << " are " << num1 << " and "
144  << num2;
145 #endif
146  return std::make_pair(num1, num2);
147 }
Log< level::Info, true > LogVerbatim