Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:03

0001 #include "Geometry/EcalCommonData/interface/ESTBNumberingScheme.h"
0002 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0003 
0004 #include <iostream>
0005 
0006 ESTBNumberingScheme::ESTBNumberingScheme() : EcalNumberingScheme() {
0007   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};
0008   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};
0009 
0010   int i;
0011   for (i = 0; i < 30; ++i) {
0012     iX[i] = ix[i];
0013     iY[i] = iy[i];
0014   }
0015 
0016   edm::LogInfo("EcalGeom") << "Creating ESTBNumberingScheme";
0017 }
0018 
0019 ESTBNumberingScheme::~ESTBNumberingScheme() { edm::LogInfo("EcalGeom") << "Deleting ESTBNumberingScheme"; }
0020 
0021 uint32_t ESTBNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
0022   int level = baseNumber.getLevels();
0023   uint32_t intIndex = 0;
0024   if (level > 0) {
0025     // depth index - silicon layer 1-st or 2-nd
0026     int layer = 0;
0027     if (baseNumber.getLevelName(0) == "SFSX") {
0028       layer = 1;
0029     } else if (baseNumber.getLevelName(0) == "SFSY") {
0030       layer = 2;
0031     } else {
0032       edm::LogWarning("EcalGeom") << "ESTBNumberingScheme: Wrong name"
0033                                   << " of Presh. Si. Strip : " << baseNumber.getLevelName(0);
0034     }
0035 
0036     // Z index +Z = 1 ; -Z = 2
0037     int zside = baseNumber.getCopyNumber("EREG");
0038     zside = 2 * (1 - zside) + 1;
0039     // wafer number
0040     int wafer = baseNumber.getCopyNumber(3);
0041     int x = 0, y = 0;
0042     // strip number inside wafer
0043     int strip = baseNumber.getCopyNumber(0);
0044 
0045     x = iX[wafer];
0046     y = iY[wafer];
0047 
0048     intIndex = ESDetId(strip, x, y, layer, zside).rawId();
0049 
0050     LogDebug("EcalGeom") << "ESTBNumberingScheme : zside " << zside << " layer " << layer << " wafer " << wafer << " X "
0051                          << x << " Y " << y << " strip " << strip << " UnitID 0x" << std::hex << intIndex << std::dec;
0052     for (int ich = 0; ich < level; ich++) {
0053       LogDebug("EcalGeom") << "Name = " << baseNumber.getLevelName(ich) << " copy = " << baseNumber.getCopyNumber(ich);
0054     }
0055   }
0056 
0057   return intIndex;
0058 }