9 #include "CLHEP/Units/GlobalSystemOfUnits.h" 10 #include "G4LogicalVolumeStore.hh" 31 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
32 std::vector<lvp>::const_iterator lvcite;
33 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
34 if (strcmp(((*lvcite)->GetName()).c_str(),
"CASTFar") == 0)
36 if (strcmp(((*lvcite)->GetName()).c_str(),
"CASTNear") == 0)
38 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAST") == 0)
40 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAES") == 0)
42 if (strcmp(((*lvcite)->GetName()).c_str(),
"CEDS") == 0)
44 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAHS") == 0)
46 if (strcmp(((*lvcite)->GetName()).c_str(),
"CHDS") == 0)
48 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAER") == 0)
50 if (strcmp(((*lvcite)->GetName()).c_str(),
"CEDR") == 0)
52 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAHR") == 0)
54 if (strcmp(((*lvcite)->GetName()).c_str(),
"CHDR") == 0)
56 if (strcmp(((*lvcite)->GetName()).c_str(),
"C3EF") == 0)
58 if (strcmp(((*lvcite)->GetName()).c_str(),
"C3HF") == 0)
60 if (strcmp(((*lvcite)->GetName()).c_str(),
"C4EF") == 0)
62 if (strcmp(((*lvcite)->GetName()).c_str(),
"C4HF") == 0)
67 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme:: LogicalVolume pointers\n" 72 <<
" for C3HF; " <<
lvC4EF <<
" for C4EF; " <<
lvC4HF <<
" for C4HF.";
74 LogDebug(
"ForwardSim") <<
"Call to init CastorNumberingScheme\n";
78 LogDebug(
"ForwardSim") <<
"Mod: " <<
mod <<
" Sec: " <<
sec <<
" Id: " << castorId.
rawId() <<
"\n";
88 int level, copyno[20];
93 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme number of levels= " <<
level;
101 bool farSide =
false;
102 int castorGeoVersion = 0;
105 for (
int ich = 0; ich <
level; ich++) {
108 assert(1 <= copyno[ich] && copyno[ich] <= 3);
109 zside = copyno[ich] == 1 ? 1 : 2;
112 castorGeoVersion = 1;
117 int copyn = copyno[ich];
118 if (castorGeoVersion == 1) {
145 sector = sector * 2 - 1;
149 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme " 150 <<
"ich = " << ich <<
"copyno = " << copyno[ich] <<
"name = " << lvs[ich]->GetName();
160 bool true_for_positive_eta =
false;
162 true_for_positive_eta =
true;
168 uint32_t intindex = 0;
170 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme: " 171 <<
" zside " <<
zside <<
" module " <<
module <<
" sector " << sector <<
" UnitID 0x" 187 uint32_t
idx = ((
z - 1) & 1) << 8;
188 idx += (sector & 15) << 4;
203 sector = (
idx >> 4) & 15;
209 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
212 level = ((touch->GetHistoryDepth()) + 1);
216 lvs[
ii] = touch->GetVolume(
i)->GetLogicalVolume();
217 copyno[
ii] = touch->GetReplicaNumber(
i);
Log< level::Info, true > LogVerbatim
virtual uint32_t getUnitID(const G4Step *aStep) const
void detectorLevel(const G4Step *, int &, int *, lvp *) const
static void unpackIndex(const uint32_t &idx, int &z, int §or, int &zmodule)
virtual ~CastorNumberingScheme()
constexpr uint32_t rawId() const
get the raw id
static uint32_t packIndex(int z, int sector, int zmodule)
T mod(const T &a, const T &b)