CMS 3D CMS Logo

ESTBNumberingScheme.cc

Go to the documentation of this file.
00001 #include "Geometry/EcalCommonData/interface/ESTBNumberingScheme.h"
00002 #include "DataFormats/EcalDetId/interface/ESDetId.h"
00003 
00004 #include <iostream>
00005 
00006 ESTBNumberingScheme::ESTBNumberingScheme() : 
00007   EcalNumberingScheme() {
00008 
00009   int ix[30] = {3, 2, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 1,
00010                 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4};
00011   int iy[30] = {4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1,
00012                 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
00013 
00014   int i;
00015   for(i=0; i<30; ++i) {
00016     iX[i] = ix[i];
00017     iY[i] = iy[i];
00018   }
00019     
00020   edm::LogInfo("EcalGeom") << "Creating ESTBNumberingScheme";
00021 }
00022 
00023 ESTBNumberingScheme::~ESTBNumberingScheme() {
00024   edm::LogInfo("EcalGeom") << "Deleting ESTBNumberingScheme";
00025 }
00026 
00027 uint32_t ESTBNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const  {
00028   int level = baseNumber.getLevels();
00029   uint32_t intIndex = 0; 
00030   if (level > 0) {
00031 
00032     // depth index - silicon layer 1-st or 2-nd
00033     int layer = 0;
00034     if(baseNumber.getLevelName(0) == "SFSX") {
00035       layer = 1;
00036     } else if (baseNumber.getLevelName(0) == "SFSY") {
00037       layer = 2;
00038     } else {
00039       edm::LogWarning("EcalGeom") << "ESTBNumberingScheme: Wrong name"
00040                                  << " of Presh. Si. Strip : " 
00041                                  << baseNumber.getLevelName(0);
00042     }
00043 
00044     // Z index +Z = 1 ; -Z = 2
00045     int zside   = baseNumber.getCopyNumber("EREG");
00046     zside=2*(1-zside)+1;
00047     // wafer number
00048     int wafer = baseNumber.getCopyNumber(3);
00049     int x=0,y=0;
00050     // strip number inside wafer
00051     int strip = baseNumber.getCopyNumber(0);
00052 
00053     x = iX[wafer];
00054     y = iY[wafer];
00055     
00056     intIndex =  ESDetId(strip, x, y, layer, zside).rawId(); 
00057     
00058     LogDebug("EcalGeom") << "ESTBNumberingScheme : zside " << zside 
00059                         << " layer " << layer << " wafer " << wafer << " X " 
00060                         << x << " Y "<< y << " strip " << strip 
00061                         << " UnitID 0x" << std::hex << intIndex << std::dec;
00062     for (int ich = 0; ich < level; ich++) {
00063       LogDebug("EcalGeom") << "Name = " << baseNumber.getLevelName(ich) 
00064                           << " copy = " << baseNumber.getCopyNumber(ich);
00065     }
00066   }
00067 
00068   return intIndex;
00069 }

Generated on Tue Jun 9 17:37:24 2009 for CMSSW by  doxygen 1.5.4