Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:53

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // File: HcalTestNumberingScheme.cc
0003 // Description: Numbering scheme for barrel electromagnetic calorimeter
0004 ///////////////////////////////////////////////////////////////////////////////
0005 #include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.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 HcalTestNumberingScheme::HcalTestNumberingScheme(bool forTB) : HcalNumberingScheme(), forTBH2(forTB) {
0014   edm::LogVerbatim("HcalSim") << "Creating HcalTestNumberingScheme with TB Flag " << forTBH2;
0015 }
0016 
0017 HcalTestNumberingScheme::~HcalTestNumberingScheme() {
0018   edm::LogVerbatim("HcalSim") << "Deleting HcalTestNumberingScheme";
0019 }
0020 
0021 uint32_t HcalTestNumberingScheme::getUnitID(const HcalNumberingFromDDD::HcalID& id) {
0022   //pack it into an integer
0023   uint32_t index = 0;
0024   if (forTBH2) {
0025     // TB H2 Case
0026     int etaR = id.etaR;
0027     int phi = id.phis;
0028     HcalSubdetector subdet = (HcalSubdetector)(id.subdet);
0029     if (subdet == HcalBarrel && phi > 4) {  // HB2
0030       if (etaR > 4 && etaR < 10)
0031         index = HcalDetId(subdet, id.lay, id.phis, 1).rawId();
0032     } else {  // HB1
0033       index = HcalDetId(subdet, etaR, id.phis, id.depth).rawId();
0034     }
0035   } else {
0036     // Test case
0037     index = HcalTestNumbering::packHcalIndex(id.subdet, id.zside, id.depth, id.etaR, id.phis, id.lay);
0038   }
0039 #ifdef EDM_ML_DEBUG
0040   edm::LogVerbatim("HcalSim") << "HcalTestNumberingScheme det = " << id.subdet << " depth/lay = " << id.depth << "/"
0041                               << id.lay << " zside = " << id.zside << " eta/R = " << id.etaR << " phi = " << id.phis
0042                               << " packed index = 0x" << std::hex << index << std::dec << std::endl;
0043 #endif
0044   return index;
0045 }
0046 
0047 uint32_t HcalTestNumberingScheme::packHcalIndex(int det, int z, int depth, int eta, int phi, int lay) {
0048   return HcalTestNumbering::packHcalIndex(det, z, depth, eta, phi, lay);
0049 }
0050 
0051 void HcalTestNumberingScheme::unpackHcalIndex(
0052     const uint32_t& idx, int& det, int& z, int& depth, int& eta, int& phi, int& lay) {
0053   HcalTestNumbering::unpackHcalIndex(idx, det, z, depth, eta, phi, lay);
0054 }