#include <ZdcNumberingScheme.h>
Public Member Functions | |
int | detectorLevel (const G4Step *) const |
void | detectorLevel (const G4Step *, int &, int *, G4String *) const |
virtual unsigned int | getUnitID (const G4Step *aStep) const |
void | setVerbosity (const int) |
ZdcNumberingScheme (int) | |
virtual | ~ZdcNumberingScheme () |
Static Public Member Functions | |
static unsigned int | packZdcIndex (int subDet, int layer, int fiber, int channel, int z) |
static void | unpackZdcIndex (const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z) |
Private Attributes | |
int | verbosity |
Definition at line 13 of file ZdcNumberingScheme.h.
ZdcNumberingScheme::ZdcNumberingScheme | ( | int | iv | ) |
Definition at line 13 of file ZdcNumberingScheme.cc.
References gather_cfg::cout, and verbosity.
ZdcNumberingScheme::~ZdcNumberingScheme | ( | ) | [virtual] |
Definition at line 19 of file ZdcNumberingScheme.cc.
References gather_cfg::cout, and verbosity.
int ZdcNumberingScheme::detectorLevel | ( | const G4Step * | aStep | ) | const |
Definition at line 162 of file ZdcNumberingScheme.cc.
References testEve_cfg::level.
Referenced by getUnitID().
void ZdcNumberingScheme::detectorLevel | ( | const G4Step * | aStep, |
int & | level, | ||
int * | copyno, | ||
G4String * | name | ||
) | const |
Definition at line 171 of file ZdcNumberingScheme.cc.
References i, and testEve_cfg::level.
unsigned int ZdcNumberingScheme::getUnitID | ( | const G4Step * | aStep | ) | const [virtual] |
Definition at line 27 of file ZdcNumberingScheme.cc.
References gather_cfg::cout, detectorLevel(), HcalZDCDetId::EM, HcalZDCDetId::HAD, getHLTprescales::index, testEve_cfg::level, HcalZDCDetId::LUM, mergeVDriftHistosByStation::name, packZdcIndex(), DetId::rawId(), and Unknown.
Referenced by ZdcSD::setDetUnitId().
{ unsigned intindex=0; uint32_t index = 0; int level = detectorLevel(aStep); if (level > 0) { int* copyno = new int[level]; G4String* name = new G4String[level]; detectorLevel(aStep, level, copyno, name); int zside = 0; int channel = 0; int fiber = 0; int layer = 0; HcalZDCDetId::Section section = HcalZDCDetId::Unknown; for (int ich=0; ich < level; ich++) { if (name[ich] == "ZDC") { if(copyno[ich] == 1)zside = 1; if(copyno[ich] == 2)zside = -1; } else if (name[ich] == "ZDC_EMLayer") { section = HcalZDCDetId::EM; layer = copyno[ich]; } else if (name[ich] == "ZDC_EMFiber") { fiber = copyno[ich]; if (fiber < 20) channel = 1; else if (fiber < 39) channel = 2; else if (fiber < 58) channel = 3; else if (fiber < 77) channel = 4; else channel = 5; } else if (name[ich] == "ZDC_LumLayer") { section = HcalZDCDetId::LUM; layer = copyno[ich]; channel = layer; } else if (name[ich] == "ZDC_LumGas") { fiber = 1; } else if (name[ich] == "ZDC_HadLayer") { section = HcalZDCDetId::HAD; layer = copyno[ich]; if (layer < 6) channel = 1; else if (layer < 12) channel = 2; else if (layer < 18) channel = 3; else channel = 4; } else if (name[ich] == "ZDC_HadFiber") { fiber = copyno[ich]; } } // intindex = myPacker.packZdcIndex (section, layer, fiber, channel, zside); intindex = packZdcIndex (section, layer, fiber, channel, zside); bool true_for_positive_eta = true; //if(zside == 1)true_for_positive_eta = true; if(zside == -1)true_for_positive_eta = false; HcalZDCDetId zdcId(section, true_for_positive_eta, channel); index = zdcId.rawId(); #ifdef debug std::cout<<"DetectorId: "; std::cout<<zdcId<<std::endl; std::cout<< "ZdcNumberingScheme:" << " getUnitID - # of levels = " << level << std::endl; for (int ich = 0; ich < level; ich++) std::cout<< " " << ich << ": copyno " << copyno[ich] << " name=" << name[ich] << " section " << section << " zside " << zside << " layer " << layer << " fiber " << fiber << " channel " << channel << "packedIndex =" << intindex << " detId raw: "<<index<<std::endl; #endif delete[] copyno; delete[] name; } return index; }
unsigned ZdcNumberingScheme::packZdcIndex | ( | int | subDet, |
int | layer, | ||
int | fiber, | ||
int | channel, | ||
int | z | ||
) | [static] |
pack the Unit ID for Zdc
z = 1,2 = -z,+z; subDet = 1,2,3 = EM,Lum,HAD; fiber = 1-96 (EM,HAD), 1 (Lum); channel = 1-5 (EM), layer# (Lum), 1-3 (HAD)
Definition at line 127 of file ZdcNumberingScheme.cc.
References gather_cfg::cout, and unpackZdcIndex().
Referenced by getUnitID().
{ unsigned int idx = ((z-1)&1)<<20; //bit 20 idx += (channel&7)<<17; //bits 17-19 idx += (fiber&255)<<9; //bits 9-16 idx += (layer&127)<<2; //bits 2-8 idx += (section&3); //bits 0-1 #ifdef debug std::cout<< "ZDC packing: section " << section << " layer " << layer << " fiber " << fiber << " channel " << channel << " zside " << z << "idx: " <<idx << std::endl; int newsubdet, newlayer, newfiber, newchannel, newz; unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz); #endif return idx; }
void ZdcNumberingScheme::setVerbosity | ( | const int | iv | ) |
void ZdcNumberingScheme::unpackZdcIndex | ( | const unsigned int & | idx, |
int & | subDet, | ||
int & | layer, | ||
int & | fiber, | ||
int & | channel, | ||
int & | z | ||
) | [static] |
Definition at line 146 of file ZdcNumberingScheme.cc.
References gather_cfg::cout.
Referenced by packZdcIndex(), and ZdcTestAnalysis::update().
{ z = 1 + ((idx>>20)&1); channel = (idx>>17)&7; fiber = (idx>>9)&255; layer = (idx>>2)&127; section = idx&3; #ifdef debug std::cout<< "ZDC unpacking: idx:"<< idx << " -> section " << section << " layer " << layer << " fiber " << fiber << " channel " << channel << " zside " << z << std::endl; #endif }
int ZdcNumberingScheme::verbosity [private] |
Definition at line 38 of file ZdcNumberingScheme.h.
Referenced by setVerbosity(), ZdcNumberingScheme(), and ~ZdcNumberingScheme().