9 #include "CLHEP/Units/GlobalSystemOfUnits.h" 16 std::cout <<
"Creating ZDCNumberingScheme" << std::endl;
21 std::cout<<
" Deleting ZdcNumberingScheme" << std::endl;
33 int* copyno =
new int[
level];
44 for (
int ich=0; ich <
level; ich++) {
45 if (name[ich] ==
"ZDC") {
46 if(copyno[ich] == 1)zside = 1;
47 if(copyno[ich] == 2)zside = -1;
49 else if (name[ich] ==
"ZDC_EMLayer") {
55 else if (name[ich] ==
"ZDC_EMFiber") {
68 else if (name[ich] ==
"ZDC_LumLayer") {
73 else if (name[ich] ==
"ZDC_HadLayer") {
86 else if (name[ich] ==
"ZDC_LumGas") {
89 else if (name[ich] ==
"ZDC_HadFiber") {
97 intindex =
packZdcIndex (section, layer, fiber, channel, zside);
100 bool true_for_positive_eta =
true;
101 if(zside == -1)true_for_positive_eta =
false;
103 HcalZDCDetId zdcId(section, true_for_positive_eta, channel);
104 index = zdcId.
rawId();
112 <<
" getUnitID - # of levels = " 113 << level << std::endl;
114 for (
int ich = 0; ich <
level; ich++)
115 std::cout<<
" " << ich <<
": copyno " << copyno[ich]
116 <<
" name=" << name[ich]
117 <<
" section " << section <<
" zside " << zside
118 <<
" layer " << layer <<
" fiber " << fiber
119 <<
" channel " << channel <<
"packedIndex =" 120 << intindex <<
" detId raw: "<<index<<std::endl;
134 unsigned int idx = ((z-1)&1)<<20;
135 idx += (channel&7)<<17;
136 idx += (fiber&255)<<9;
137 idx += (layer&127)<<2;
141 std::cout<<
"ZDC packing: section " << section <<
" layer " << layer <<
" fiber " 142 << fiber <<
" channel " << channel <<
" zside " << z <<
"idx: " <<idx << std::endl;
143 int newsubdet, newlayer, newfiber, newchannel, newz;
144 unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
152 int& layer,
int& fiber,
153 int& channel,
int&
z) {
154 z = 1 + ((idx>>20)&1);
155 channel = (idx>>17)&7;
156 fiber = (idx>>9)&255;
157 layer = (idx>>2)&127;
161 std::cout<<
"ZDC unpacking: idx:"<< idx <<
" -> section " << section
162 <<
" layer " << layer <<
" fiber " << fiber <<
" channel " 163 << channel <<
" zside " << z << std::endl;
170 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
172 if (touch) level = ((touch->GetHistoryDepth())+1);
177 int* copyno, G4String*
name)
const {
181 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
183 int i = level -
ii - 1;
184 name[
ii] = touch->GetVolume(i)->GetName();
185 copyno[
ii] = touch->GetReplicaNumber(i);
static unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z)
virtual unsigned int getUnitID(const G4Step *aStep) const
constexpr uint32_t rawId() const
get the raw id
virtual ~ZdcNumberingScheme()
void setVerbosity(const int)
static void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
int detectorLevel(const G4Step *) const