Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:29:04

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // File: HcalNumberingScheme.cc
0003 // Description: Numbering scheme for barrel electromagnetic calorimeter
0004 ///////////////////////////////////////////////////////////////////////////////
0005 #include "SimG4CMS/Calo/interface/HcalNumberingScheme.h"
0006 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0007 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0008 
0009 #include <iostream>
0010 
0011 //#define EDM_ML_DEBUG
0012 
0013 HcalNumberingScheme::HcalNumberingScheme() : CaloNumberingScheme(0) {
0014   edm::LogVerbatim("HcalSim") << "Creating HcalNumberingScheme";
0015 }
0016 
0017 HcalNumberingScheme::~HcalNumberingScheme() { edm::LogVerbatim("HcalSim") << "Deleting HcalNumberingScheme"; }
0018 
0019 uint32_t HcalNumberingScheme::getUnitID(const HcalNumberingFromDDD::HcalID& id) {
0020   int zside = 2 * (id.zside) - 1;
0021   int etaR = zside * (id.etaR);
0022   HcalSubdetector subdet = (HcalSubdetector)(id.subdet);
0023 
0024   //pack it into an integer
0025   // to be consistent with HcalDetId convention
0026   HcalDetId hid(subdet, etaR, id.phis, id.depth);
0027   uint32_t index = hid.rawId();
0028 
0029 #ifdef EDM_ML_DEBUG
0030   edm::LogVerbatim("HcalSim") << "HcalNumberingScheme det = " << id.subdet << " depth/lay = " << id.depth << "/"
0031                               << id.lay << " zside = " << id.zside << " eta/R = " << id.etaR << " phi = " << id.phis
0032                               << " oldphi = " << id.phi << " packed index = 0x" << std::hex << index << std::dec << " "
0033                               << hid << " " << HcalDetId(index);
0034 #endif
0035   return index;
0036 }