CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/SimG4CMS/Calo/src/HcalTestNumberingScheme.cc

Go to the documentation of this file.
00001 
00002 // File: HcalTestNumberingScheme.cc
00003 // Description: Numbering scheme for barrel electromagnetic calorimeter
00005 #include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.h"
00006 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00007 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00008 
00009 #include <iostream>
00010 
00011 HcalTestNumberingScheme::HcalTestNumberingScheme(bool forTB) : 
00012   HcalNumberingScheme(), forTBH2(forTB) {
00013   edm::LogInfo("HcalSim") << "Creating HcalTestNumberingScheme with TB Flag "
00014                           << forTBH2;
00015 }
00016 
00017 HcalTestNumberingScheme::~HcalTestNumberingScheme() {
00018   edm::LogInfo("HcalSim") << "Deleting HcalTestNumberingScheme";
00019 }
00020 
00021 uint32_t HcalTestNumberingScheme::getUnitID(const HcalNumberingFromDDD::HcalID 
00022                                             id) {
00023 
00024   //pack it into an integer
00025   uint32_t index = 0;
00026   if (forTBH2) {
00027     // TB H2 Case
00028     int etaR  = id.etaR;
00029     int phi   = id.phis;
00030     HcalSubdetector subdet =  (HcalSubdetector)(id.subdet);
00031     if (subdet == HcalBarrel && phi > 4) { // HB2 
00032       if (etaR > 4 && etaR < 10)
00033         index = HcalDetId(subdet,id.lay,id.phis,1).rawId();
00034     } else { // HB1
00035       index = HcalDetId(subdet,etaR,id.phis,id.depth).rawId();
00036     }
00037   } else {
00038     // Test case
00039     index = HcalTestNumbering::packHcalIndex(id.subdet, id.zside, id.depth, 
00040                                              id.etaR, id.phi, id.lay);
00041   }
00042 
00043   LogDebug("HcalSim") << "HcalTestNumberingScheme det = " << id.subdet 
00044                       << " depth/lay = " << id.depth << "/" << id.lay 
00045                       << " zside = " << id.zside << " eta/R = " << id.etaR 
00046                       << " phi = " << id.phi << " packed index = 0x" 
00047                       << std::hex << index << std::dec;
00048 
00049   return index;
00050 
00051 }
00052 
00053 uint32_t HcalTestNumberingScheme::packHcalIndex(int det, int z, int depth, 
00054                                                 int eta, int phi, int lay) {
00055 
00056   return  HcalTestNumbering::packHcalIndex(det, z, depth, eta, phi, lay);
00057 }
00058 
00059 void HcalTestNumberingScheme::unpackHcalIndex(const uint32_t & idx, 
00060                                               int& det, int& z, 
00061                                               int& depth, int& eta,
00062                                               int& phi, int& lay) {
00063 
00064   HcalTestNumbering::unpackHcalIndex(idx, det, z, depth, eta, phi, lay);
00065 }