11 #include <CLHEP/Units/SystemOfUnits.h> 15 int detectorLevel(
const G4Step* aStep) {
17 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
18 return (touch) ? ((touch->GetHistoryDepth()) + 1) : 0;
21 void detectorLevel(
const G4Step* aStep,
int level, std::vector<int>& copyno, std::vector<G4String>&
name) {
24 copyno.reserve(
level);
26 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
30 copyno.push_back(touch->GetReplicaNumber(
i));
38 unsigned int intindex = 0;
39 int level = detectorLevel(aStep);
41 LogDebug(
"BscSim") <<
"BscNumberingScheme number of levels= " <<
level;
44 std::vector<int> copyno;
45 std::vector<G4String>
name;
46 detectorLevel(aStep,
level, copyno,
name);
51 for (
int ich = 0; ich <
level; ich++) {
53 if (
name[ich] ==
"BSC1" ||
name[ich] ==
"BSC2") {
54 zside = copyno[ich] - 1;
55 }
else if (
name[ich] ==
"BSCTrap") {
57 station = 2 * (copyno[ich] - 1);
58 }
else if (
name[ich] ==
"BSCTubs") {
61 }
else if (
name[ich] ==
"BSCTTop") {
63 }
else if (
name[ich] ==
"BSC2Pad") {
68 LogDebug(
"BscSim") <<
"BscNumberingScheme " 69 <<
"ich=" << ich <<
"copyno" << copyno[ich] <<
"name=" <<
name[ich];
72 LogDebug(
"BscSim") <<
"BscNumberingScheme : det " << det <<
" zside " <<
zside <<
" station " <<
station 73 <<
" UnitID 0x" << std::hex << intindex <<
std::dec;
75 for (
int ich = 0; ich <
level; ich++)
76 LogDebug(
"BscSim") <<
" name = " <<
name[ich] <<
" copy = " << copyno[ich];
78 LogDebug(
"BscSim") <<
" packed index = 0x" << std::hex << intindex <<
std::dec;
85 unsigned int idx = 6 << 28;
87 idx += (det << 3) & 24;
89 LogDebug(
"BscSim") <<
"Bsc packing: det " << det <<
" zside " <<
zside <<
" station " <<
station <<
"-> 0x" 99 det = (
idx & 24) >> 3;
101 LogDebug(
"BscSim") <<
" Bsc unpacking: 0x " << std::hex <<
idx <<
std::dec <<
" -> det " << det <<
" zside "
void unpackBscIndex(const unsigned int &idx)
std::string getName(const G4String &)
unsigned int packBscIndex(int det, int zside, int station)
unsigned int getUnitID(const G4Step *aStep)