11 #include "CLHEP/Units/GlobalSystemOfUnits.h" 17 int detectorLevel(
const G4Step* aStep) {
19 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
22 level = ((touch->GetHistoryDepth()) + 1);
26 void detectorLevel(
const G4Step* aStep,
int level, std::vector<int>& copyno, std::vector<G4String>&
name) {
29 copyno.reserve(
level);
31 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
35 copyno.push_back(touch->GetReplicaNumber(
i));
44 int level = detectorLevel(aStep);
47 std::vector<int> copyno;
48 std::vector<G4String>
name;
50 detectorLevel(aStep,
level, copyno,
name);
58 for (
int ich = 0; ich <
level; ich++) {
59 if (
name[ich] ==
"ZDC") {
64 }
else if (
name[ich] ==
"ZDC_EMLayer") {
69 }
else if (
name[ich] ==
"ZDC_EMFiber") {
81 }
else if (
name[ich] ==
"ZDC_LumLayer") {
85 }
else if (
name[ich] ==
"ZDC_HadLayer") {
98 else if (
name[ich] ==
"ZDC_LumGas") {
100 }
else if (
name[ich] ==
"ZDC_HadFiber") {
107 unsigned intindex = 0;
111 bool true_for_positive_eta =
true;
113 true_for_positive_eta =
false;
122 <<
" getUnitID - # of levels = " <<
level;
123 for (
int ich = 0; ich <
level; ich++)
124 edm::LogVerbatim(
"ForwardSim") <<
" " << ich <<
": copyno " << copyno[ich] <<
" name=" <<
name[ich]
125 <<
" section " <<
section <<
" zside " <<
zside <<
" layer " << layer
126 <<
" fiber " << fiber <<
" channel " << channel <<
"packedIndex =" << intindex
136 unsigned int idx = ((z - 1) & 1) << 20;
137 idx += (channel & 7) << 17;
138 idx += (fiber & 255) << 9;
139 idx += (layer & 127) << 2;
143 edm::LogVerbatim(
"ForwardSim") <<
"ZDC packing: section " <<
section <<
" layer " << layer <<
" fiber " << fiber
144 <<
" channel " << channel <<
" zside " << z <<
"idx: " << std::hex <<
idx 146 int newsubdet, newlayer, newfiber, newchannel, newz;
154 z = 1 + ((
idx >> 20) & 1);
155 channel = (
idx >> 17) & 7;
156 fiber = (
idx >> 9) & 255;
157 layer = (
idx >> 2) & 127;
162 <<
" fiber " << fiber <<
" channel " << channel <<
" zside " << z;
Log< level::Info, true > LogVerbatim
unsigned int getUnitID(const G4Step *aStep)
constexpr uint32_t rawId() const
get the raw id
unsigned int packZdcIndex(int subDet, int layer, int fiber, int channel, int z)
void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
std::string getName(const G4String &)