CMS 3D CMS Logo

ESTBNumberingScheme.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 
8 
9  int ix[30] = {3, 2, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 1,
10  1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4};
11  int iy[30] = {4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1,
12  2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
13 
14  int i;
15  for(i=0; i<30; ++i) {
16  iX[i] = ix[i];
17  iY[i] = iy[i];
18  }
19 
20  edm::LogInfo("EcalGeom") << "Creating ESTBNumberingScheme";
21 }
22 
24  edm::LogInfo("EcalGeom") << "Deleting ESTBNumberingScheme";
25 }
26 
27 uint32_t ESTBNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
28  int level = baseNumber.getLevels();
29  uint32_t intIndex = 0;
30  if (level > 0) {
31 
32  // depth index - silicon layer 1-st or 2-nd
33  int layer = 0;
34  if(baseNumber.getLevelName(0) == "SFSX") {
35  layer = 1;
36  } else if (baseNumber.getLevelName(0) == "SFSY") {
37  layer = 2;
38  } else {
39  edm::LogWarning("EcalGeom") << "ESTBNumberingScheme: Wrong name"
40  << " of Presh. Si. Strip : "
41  << baseNumber.getLevelName(0);
42  }
43 
44  // Z index +Z = 1 ; -Z = 2
45  int zside = baseNumber.getCopyNumber("EREG");
46  zside=2*(1-zside)+1;
47  // wafer number
48  int wafer = baseNumber.getCopyNumber(3);
49  int x=0,y=0;
50  // strip number inside wafer
51  int strip = baseNumber.getCopyNumber(0);
52 
53  x = iX[wafer];
54  y = iY[wafer];
55 
56  intIndex = ESDetId(strip, x, y, layer, zside).rawId();
57 
58  LogDebug("EcalGeom") << "ESTBNumberingScheme : zside " << zside
59  << " layer " << layer << " wafer " << wafer << " X "
60  << x << " Y "<< y << " strip " << strip
61  << " UnitID 0x" << std::hex << intIndex << std::dec;
62  for (int ich = 0; ich < level; ich++) {
63  LogDebug("EcalGeom") << "Name = " << baseNumber.getLevelName(ich)
64  << " copy = " << baseNumber.getCopyNumber(ich);
65  }
66  }
67 
68  return intIndex;
69 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::string const & getLevelName(int level) const
virtual uint32_t getUnitID(const EcalBaseNumber &baseNumber) const
int getCopyNumber(int level) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int getLevels() const