9 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 std::cout <<
"Creating ZDCNumberingScheme" << std::endl;
21 std::cout<<
" Deleting ZdcNumberingScheme" << std::endl;
34 int* copyno =
new int[
level];
45 for (
int ich=0; ich <
level; ich++) {
46 if (name[ich] ==
"ZDC") {
47 if(copyno[ich] == 1)zside = 1;
48 if(copyno[ich] == 2)zside = -1;
50 else if (name[ich] ==
"ZDC_EMLayer") {
54 else if (name[ich] ==
"ZDC_EMFiber") {
67 else if (name[ich] ==
"ZDC_LumLayer") {
72 else if (name[ich] ==
"ZDC_LumGas") {
75 else if (name[ich] ==
"ZDC_HadLayer") {
87 else if (name[ich] ==
"ZDC_HadFiber") {
93 intindex =
packZdcIndex (section, layer, fiber, channel, zside);
94 bool true_for_positive_eta =
true;
96 if(zside == -1)true_for_positive_eta =
false;
98 HcalZDCDetId zdcId(section, true_for_positive_eta, channel);
99 index = zdcId.
rawId();
107 <<
" getUnitID - # of levels = "
108 << level << std::endl;
109 for (
int ich = 0; ich <
level; ich++)
110 std::cout<<
" " << ich <<
": copyno " << copyno[ich]
111 <<
" name=" << name[ich]
112 <<
" section " << section <<
" zside " << zside
113 <<
" layer " << layer <<
" fiber " << fiber
114 <<
" channel " << channel <<
"packedIndex ="
115 << intindex <<
" detId raw: "<<index<<std::endl;
129 unsigned int idx = ((z-1)&1)<<20;
130 idx += (channel&7)<<17;
131 idx += (fiber&255)<<9;
132 idx += (layer&127)<<2;
136 std::cout<<
"ZDC packing: section " << section <<
" layer " << layer <<
" fiber "
137 << fiber <<
" channel " << channel <<
" zside " << z <<
"idx: " <<idx << std::endl;
138 int newsubdet, newlayer, newfiber, newchannel, newz;
139 unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
147 int& layer,
int& fiber,
148 int& channel,
int&
z) {
149 z = 1 + ((idx>>20)&1);
150 channel = (idx>>17)&7;
151 fiber = (idx>>9)&255;
152 layer = (idx>>2)&127;
156 std::cout<<
"ZDC unpacking: idx:"<< idx <<
" -> section " << section
157 <<
" layer " << layer <<
" fiber " << fiber <<
" channel "
158 << channel <<
" zside " << z << std::endl;
165 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
167 if (touch) level = ((touch->GetHistoryDepth())+1);
172 int* copyno, G4String*
name)
const {
176 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
177 for (
int ii = 0; ii <
level; ii++) {
178 int i = level - ii - 1;
179 name[ii] = touch->GetVolume(i)->GetName();
180 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
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