CMS 3D CMS Logo

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

#include <EcalEndcapNumberingScheme.h>

Inheritance diagram for EcalEndcapNumberingScheme:
EcalNumberingScheme CaloNumberingScheme

Public Member Functions

 EcalEndcapNumberingScheme ()
 
uint32_t getUnitID (const EcalBaseNumber &baseNumber) const override
 
 ~EcalEndcapNumberingScheme () 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 ()
 

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 EcalEndcapNumberingScheme.h.

Constructor & Destructor Documentation

EcalEndcapNumberingScheme::EcalEndcapNumberingScheme ( )

Definition at line 10 of file EcalEndcapNumberingScheme.cc.

11  edm::LogVerbatim("EcalGeom") << "Creating EcalEndcapNumberingScheme";
12 }
Log< level::Info, true > LogVerbatim
EcalEndcapNumberingScheme::~EcalEndcapNumberingScheme ( )
override

Definition at line 14 of file EcalEndcapNumberingScheme.cc.

14  {
15  edm::LogVerbatim("EcalGeom") << "Deleting EcalEndcapNumberingScheme";
16 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

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

Implements EcalNumberingScheme.

Definition at line 17 of file EcalEndcapNumberingScheme.cc.

References TauDecayModes::dec, DetId::Ecal, EcalBaseNumber::getCopyNumber(), EcalBaseNumber::getLevelName(), EcalBaseNumber::getLevels(), gpuClustering::id, isotrackApplyRegressor::k, DetId::rawId(), EEDetId::SCCRYSTALMODE, EEDetId::Subdet, EEDetId::validDetId(), and ecaldqm::zside().

Referenced by EcalDumpGeometry::dumpTouch().

17  {
18  const uint32_t nLevels(baseNumber.getLevels());
19 
20 #ifdef EDM_ML_DEBUG
21  edm::LogVerbatim("EcalGeom") << "ECalEndcapNumberingScheme geometry levels = " << nLevels;
22  for (uint32_t k = 0; k < nLevels; ++k)
23  edm::LogVerbatim("EcalGeom") << "[" << k << "] " << baseNumber.getLevelName(k) << ":"
24  << baseNumber.getCopyNumber(k);
25 #endif
26  if (7 > nLevels) {
27  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
28  << "Not enough levels found in EcalBaseNumber ( " << nLevels << ") Returning 0";
29  return 0;
30  }
31 
32  if (nLevels <= 10) {
33  // Static geometry
34 
35  if (baseNumber.getLevels() < 1) {
36  edm::LogWarning("EcalGeom") << "EalEndcaplNumberingScheme::getUnitID: No "
37  << "level found in EcalBaseNumber Returning 0";
38  return 0;
39  }
40 
41  int PVid = baseNumber.getCopyNumber(0);
42  int MVid = 1;
43  if (baseNumber.getLevels() > 1)
44  MVid = baseNumber.getCopyNumber(1);
45  else
46  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID: Null"
47  << " pointer to alveole ! Use default id=1";
48 
49  int zs = baseNumber.getCopyNumber("EREG");
50  int zside = 2 * (1 - zs) + 1;
51  int module_number = MVid;
52  int crystal_number = PVid;
53 
54  uint32_t intindex = EEDetId(module_number, crystal_number, zside, EEDetId::SCCRYSTALMODE).rawId();
55 
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("EcalGeom") << "EcalEndcapNumberingScheme: zside = " << zs << ":" << zside
58  << " super crystal = " << module_number << " crystal = " << crystal_number
59  << " packed index = 0x" << std::hex << intindex << std::dec;
60 #endif
61  return intindex;
62  } else {
63  // algorithmic geometry
64 
65  const int ic(baseNumber.getCopyNumber(0) % 100); // crystal #, 0-44
66  const int icx(ic / 10);
67  const int icy(ic % 5);
68  const int is(baseNumber.getCopyNumber(2) % 100); // supercrystal #, 0-99
69  const int isx(is / 10);
70  const int isy(is % 10);
71 
72  const int iq(3 - 2 * baseNumber.getCopyNumber(3)); // quadrant #, -1, +1
73  const int id(3 - 2 * baseNumber.getCopyNumber(5)); // dee #, -1, +1
74 
75  const int iz(3 - 2 * baseNumber.getCopyNumber(7)); // z: -1, +1
76 
77  const int ix(50 + id * iz * (5 * isx + icx + 1) - (id * iz - 1) / 2); // x: 1-100
78  const int iy(50 + id * iq * (5 * isy + icy + 1) - (id * iq - 1) / 2); // y: 1-100
79 
80  const uint32_t idet(DetId(DetId::Ecal, EEDetId::Subdet) | (((0 < iz ? 0x4000 : 0)) + (ix << 7) + iy));
81 
82  //*************************** ERROR CHECKING **********************************
83 
84  if (0 > icx || 4 < icx || 0 > icy || 4 < icy) {
85  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
86  << "****************** Bad crystal number = " << ic
87  << ", Volume Name = " << baseNumber.getLevelName(0);
88  return 0;
89  }
90 
91  if (0 > isx || 9 < isx || 0 > isy || 9 < isy) {
92  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
93  << "****************** Bad supercrystal number = " << is
94  << ", Volume Name = " << baseNumber.getLevelName(3);
95  return 0;
96  }
97 
98  if (1 != iq && -1 != iq) {
99  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
100  << "****************** Bad quadrant number = " << iq
101  << ", Volume Name = " << baseNumber.getLevelName(4);
102  return 0;
103  }
104 
105  if (1 != id && -1 != id) {
106  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
107  << "****************** Bad dee number = " << id
108  << ", Volume Name = " << baseNumber.getLevelName(6);
109  return 0;
110  }
111 
112  if (-1 != iz && 1 != iz) {
113  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
114  << "****************** Bad z-end number = " << iz
115  << ", Volume Name = " << baseNumber.getLevelName(8);
116  return 0;
117  }
118 
119  if (!EEDetId::validDetId(ix, iy, iz)) {
120  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
121  << "****************** Bad DetId numbers = " << ix << ", " << iy << ", " << iz;
122  return 0;
123  }
124 
125 #ifdef EDM_ML_DEBUG
126  edm::LogVerbatim("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): " << std::dec << ix << ", " << iy << ", "
127  << iq << ", " << id << ", " << iz << ", " << std::hex << idet << std::dec;
128  edm::LogVerbatim("EcalGeom") << "ECalEndcapNumberingScheme::EEDetId: " << EEDetId(idet);
129 #endif
130  return idet;
131  }
132 }
Log< level::Info, true > LogVerbatim
uint16_t *__restrict__ id
std::string const & getLevelName(int level) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int getCopyNumber(int level) const
int zside(DetId const &)
static const int SCCRYSTALMODE
Definition: EEDetId.h:336
Definition: DetId.h:17
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
Log< level::Warning, false > LogWarning
int getLevels() const