Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // File: EcalHodoscopeNumberingScheme.cc
0003 // Description: Numbering scheme for TB H4 hodoscope detector
0004 ///////////////////////////////////////////////////////////////////////////////
0005 
0006 #include "Geometry/EcalTestBeam/interface/EcalHodoscopeNumberingScheme.h"
0007 #include "SimDataFormats/EcalTestBeam/interface/HodoscopeDetId.h"
0008 
0009 #include <iostream>
0010 
0011 EcalHodoscopeNumberingScheme::EcalHodoscopeNumberingScheme() : EcalNumberingScheme() {
0012   edm::LogInfo("EcalTBGeom") << "Creating EcalHodoscopeNumberingScheme";
0013 }
0014 
0015 EcalHodoscopeNumberingScheme::~EcalHodoscopeNumberingScheme() {
0016   edm::LogInfo("EcalTBGeom") << "Deleting EcalHodoscopeNumberingScheme";
0017 }
0018 
0019 uint32_t EcalHodoscopeNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
0020   int level = baseNumber.getLevels();
0021   uint32_t intIndex = 0;
0022   if (level > 0) {
0023     // depth index - plans and fibers
0024     if (baseNumber.getLevelName(0) == "FIBR") {
0025       uint32_t iFibr;
0026 
0027       if (baseNumber.getCopyNumber(0) > 32)
0028         iFibr = 2 * (baseNumber.getCopyNumber(0) - 33);
0029       else
0030         iFibr = 2 * baseNumber.getCopyNumber(0) - 1;
0031 
0032       const uint32_t iPlane = baseNumber.getCopyNumber(1) - 1;
0033 
0034       LogDebug("EcalTBGeom") << "Fibr/plane " << iFibr << " " << iPlane;
0035 
0036       intIndex = HodoscopeDetId(iPlane, iFibr).rawId();
0037 
0038       LogDebug("EcalTBGeom") << "Index for fiber volume " << baseNumber.getLevelName(0) << " in plane "
0039                              << baseNumber.getLevelName(1) << " = " << intIndex;
0040     }
0041   }
0042   return intIndex;
0043 }