CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ESTBNumberingScheme.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 
7  int ix[30] = {3, 2, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4};
8  int iy[30] = {4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
9 
10  int i;
11  for (i = 0; i < 30; ++i) {
12  iX[i] = ix[i];
13  iY[i] = iy[i];
14  }
15 
16  edm::LogInfo("EcalGeom") << "Creating ESTBNumberingScheme";
17 }
18 
19 ESTBNumberingScheme::~ESTBNumberingScheme() { edm::LogInfo("EcalGeom") << "Deleting ESTBNumberingScheme"; }
20 
21 uint32_t ESTBNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
22  int level = baseNumber.getLevels();
23  uint32_t intIndex = 0;
24  if (level > 0) {
25  // depth index - silicon layer 1-st or 2-nd
26  int layer = 0;
27  if (baseNumber.getLevelName(0) == "SFSX") {
28  layer = 1;
29  } else if (baseNumber.getLevelName(0) == "SFSY") {
30  layer = 2;
31  } else {
32  edm::LogWarning("EcalGeom") << "ESTBNumberingScheme: Wrong name"
33  << " of Presh. Si. Strip : " << baseNumber.getLevelName(0);
34  }
35 
36  // Z index +Z = 1 ; -Z = 2
37  int zside = baseNumber.getCopyNumber("EREG");
38  zside = 2 * (1 - zside) + 1;
39  // wafer number
40  int wafer = baseNumber.getCopyNumber(3);
41  int x = 0, y = 0;
42  // strip number inside wafer
43  int strip = baseNumber.getCopyNumber(0);
44 
45  x = iX[wafer];
46  y = iY[wafer];
47 
48  intIndex = ESDetId(strip, x, y, layer, zside).rawId();
49 
50  LogDebug("EcalGeom") << "ESTBNumberingScheme : zside " << zside << " layer " << layer << " wafer " << wafer << " X "
51  << x << " Y " << y << " strip " << strip << " UnitID 0x" << std::hex << intIndex << std::dec;
52  for (int ich = 0; ich < level; ich++) {
53  LogDebug("EcalGeom") << "Name = " << baseNumber.getLevelName(ich) << " copy = " << baseNumber.getCopyNumber(ich);
54  }
55  }
56 
57  return intIndex;
58 }
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 &)
constexpr std::array< uint8_t, layerIndexSize > layer
Log< level::Info, false > LogInfo
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
tuple level
Definition: testEve_cfg.py:47
Log< level::Warning, false > LogWarning
int getLevels() const
#define LogDebug(id)