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") {
53 else if (name[ich] ==
"ZDC_EMFiber") {
66 else if (name[ich] ==
"ZDC_LumLayer") {
71 else if (name[ich] ==
"ZDC_LumGas") {
74 else if (name[ich] ==
"ZDC_HadLayer") {
86 else if (name[ich] ==
"ZDC_HadFiber") {
94 intindex =
packZdcIndex (section, layer, fiber, channel, zside);
97 bool true_for_positive_eta =
true;
99 if(zside == -1)true_for_positive_eta =
false;
101 HcalZDCDetId zdcId(section, true_for_positive_eta, channel);
102 index = zdcId.
rawId();
110 <<
" getUnitID - # of levels = "
111 << level << std::endl;
112 for (
int ich = 0; ich <
level; ich++)
113 std::cout<<
" " << ich <<
": copyno " << copyno[ich]
114 <<
" name=" << name[ich]
115 <<
" section " << section <<
" zside " << zside
116 <<
" layer " << layer <<
" fiber " << fiber
117 <<
" channel " << channel <<
"packedIndex ="
118 << intindex <<
" detId raw: "<<index<<std::endl;
132 unsigned int idx = ((z-1)&1)<<20;
133 idx += (channel&7)<<17;
134 idx += (fiber&255)<<9;
135 idx += (layer&127)<<2;
139 std::cout<<
"ZDC packing: section " << section <<
" layer " << layer <<
" fiber "
140 << fiber <<
" channel " << channel <<
" zside " << z <<
"idx: " <<idx << std::endl;
141 int newsubdet, newlayer, newfiber, newchannel, newz;
142 unpackZdcIndex(idx, newsubdet, newlayer, newfiber, newchannel, newz);
150 int& layer,
int& fiber,
151 int& channel,
int&
z) {
152 z = 1 + ((idx>>20)&1);
153 channel = (idx>>17)&7;
154 fiber = (idx>>9)&255;
155 layer = (idx>>2)&127;
159 std::cout<<
"ZDC unpacking: idx:"<< idx <<
" -> section " << section
160 <<
" layer " << layer <<
" fiber " << fiber <<
" channel "
161 << channel <<
" zside " << z << std::endl;
168 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
170 if (touch) level = ((touch->GetHistoryDepth())+1);
175 int* copyno, G4String*
name)
const {
179 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
180 for (
int ii = 0; ii <
level; ii++) {
181 int i = level - ii - 1;
182 name[ii] = touch->GetVolume(i)->GetName();
183 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