CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/SimG4CMS/Calo/src/HcalNumberingScheme.cc

Go to the documentation of this file.
00001 
00002 // File: HcalNumberingScheme.cc
00003 // Description: Numbering scheme for barrel electromagnetic calorimeter
00005 #include "SimG4CMS/Calo/interface/HcalNumberingScheme.h"
00006 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00007 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00008 
00009 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00010 #include <iostream>
00011 
00012 //#define DebugLog
00013 
00014 HcalNumberingScheme::HcalNumberingScheme() : CaloNumberingScheme(0) {
00015   edm::LogInfo("HcalSim") << "Creating HcalNumberingScheme";
00016 }
00017 
00018 HcalNumberingScheme::~HcalNumberingScheme() {
00019   edm::LogInfo("HcalSim") << "Deleting HcalNumberingScheme";
00020 }
00021 
00022 uint32_t HcalNumberingScheme::getUnitID(const HcalNumberingFromDDD::HcalID id){
00023 
00024   int zside = 2*(id.zside) - 1;
00025   int etaR  = zside*(id.etaR);
00026   HcalSubdetector subdet =  (HcalSubdetector)(id.subdet);
00027 
00028   //pack it into an integer
00029   // to be consistent with HcalDetId convention
00030   uint32_t index = HcalDetId(subdet,etaR,id.phis,id.depth).rawId();
00031 
00032 #ifdef DebugLog
00033   LogDebug("HcalSim") << "HcalNumberingScheme det = " << id.subdet 
00034                       << " depth/lay = " << id.depth << "/" << id.lay 
00035                       << " zside = " << id.zside << " eta/R = " << id.etaR 
00036                       << " phi = " << id.phis << " oldphi = " << id.phi
00037                       << " packed index = 0x" << std::hex << index << std::dec;
00038 #endif
00039   return index;
00040 
00041 }