4 #include <CLHEP/Units/SystemOfUnits.h> 8 int detectorLevel(
const G4Step* aStep) {
10 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
11 return (touch) ? ((touch->GetHistoryDepth()) + 1) : 0;
14 std::vector<int> detectorLevelCopyNo(
const G4Step* aStep,
int level) {
16 std::vector<int> copyno;
18 copyno.reserve(
level);
19 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
22 copyno.push_back(touch->GetReplicaNumber(
i));
31 unsigned intindex = 0;
32 int level = detectorLevel(aStep);
34 LogDebug(
"BHMSim") <<
"BHMNumberingScheme number of levels= " <<
level;
36 auto copyno = detectorLevelCopyNo(aStep,
level);
39 int subdet = copyno[0];
40 int zside = copyno[3];
43 LogDebug(
"BHMSim") <<
"BHMNumberingScheme : subdet " << subdet <<
" zside " <<
zside <<
" station " <<
station;
46 LogDebug(
"BHMSim") <<
"BHMNumberingScheme : UnitID 0x" << std::hex << intindex <<
std::dec;
52 unsigned int idx = ((6 << 28) | (subdet & 0x7) << 25);
54 LogDebug(
"BHMSim") <<
"BHM packing: subdet " << subdet <<
" zside " <<
zside <<
" station " <<
station <<
"-> 0x" 60 subdet = (
idx >> 25) >> 0x7;
63 LogDebug(
"BHMSim") <<
" Bsc unpacking: 0x " << std::hex <<
idx <<
std::dec <<
" -> subdet " << subdet <<
" zside "
unsigned int packIndex(int subdet, int zside, int station)
unsigned int getUnitID(const G4Step *aStep)
void unpackIndex(const unsigned int &idx, int &subdet, int &zside, int &station)