9 #include "CLHEP/Units/GlobalSystemOfUnits.h" 10 #include "G4LogicalVolumeStore.hh" 21 edm::LogInfo(
"ForwardSim") <<
"Creating CastorNumberingScheme";
22 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
23 std::vector<lvp>::const_iterator lvcite;
24 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
25 if (strcmp(((*lvcite)->GetName()).c_str(),
"CASTFar") == 0)
lvCASTFar = (*lvcite);
26 if (strcmp(((*lvcite)->GetName()).c_str(),
"CASTNear") == 0)
lvCASTNear = (*lvcite);
27 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAST") == 0)
lvCAST = (*lvcite);
28 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAES") == 0)
lvCAES = (*lvcite);
29 if (strcmp(((*lvcite)->GetName()).c_str(),
"CEDS") == 0)
lvCEDS = (*lvcite);
30 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAHS") == 0)
lvCAHS = (*lvcite);
31 if (strcmp(((*lvcite)->GetName()).c_str(),
"CHDS") == 0)
lvCHDS = (*lvcite);
32 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAER") == 0)
lvCAER = (*lvcite);
33 if (strcmp(((*lvcite)->GetName()).c_str(),
"CEDR") == 0)
lvCEDR = (*lvcite);
34 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAHR") == 0)
lvCAHR = (*lvcite);
35 if (strcmp(((*lvcite)->GetName()).c_str(),
"CHDR") == 0)
lvCHDR = (*lvcite);
36 if (strcmp(((*lvcite)->GetName()).c_str(),
"C3EF") == 0)
lvC3EF = (*lvcite);
37 if (strcmp(((*lvcite)->GetName()).c_str(),
"C3HF") == 0)
lvC3HF = (*lvcite);
38 if (strcmp(((*lvcite)->GetName()).c_str(),
"C4EF") == 0)
lvC4EF = (*lvcite);
39 if (strcmp(((*lvcite)->GetName()).c_str(),
"C4HF") == 0)
lvC4HF = (*lvcite);
41 #ifdef castornumschemedebug 42 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme:: LogicalVolume pointers\n" 52 LogDebug(
"ForwardSim") <<
"Call to init CastorNumberingScheme\n";
54 for (
int sec=0; sec<17; sec++)
57 LogDebug(
"ForwardSim") <<
"Mod: " <<
mod <<
" Sec: " << sec <<
" Id: " << castorId.
rawId() <<
"\n";
70 int level, copyno[20];
74 #ifdef castornumschemedebug 75 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme number of levels= " <<
level;
85 int castorGeoVersion = 0;
88 for (
int ich=0; ich <
level; ich++) {
91 assert (1 <= copyno[ich] && copyno[ich] <= 3);
92 zside = copyno[ich] == 1 ? 1 : 2;
102 int copyn = copyno[ich];
103 if(castorGeoVersion == 1) {
123 module = copyno[ich];
127 module = copyno[ich] + 2;
135 sector = sector*2 - 1;
138 #ifdef castornumschemedebug 139 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme " <<
"ich = " << ich
140 <<
"copyno = " << copyno[ich] <<
"name = " 141 << lvs[ich]->GetName();
151 bool true_for_positive_eta =
false;
152 if(zside == 1) true_for_positive_eta =
true;
155 index = castorId.
rawId();
157 #ifdef castornumschemedebug 158 uint32_t intindex = 0;
159 intindex =
packIndex(zside, sector, module);
160 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme: " <<
" zside " 161 << zside <<
" module " << module <<
" sector " 162 << sector <<
" UnitID 0x" << std::hex << intindex
179 uint32_t
idx=((z-1)&1)<<8;
196 sector = (idx>>4)&15;
201 int* copyno,
lvp* lvs)
const {
204 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
206 if (touch) level = ((touch->GetHistoryDepth())+1);
209 int i = level -
ii - 1;
210 lvs[
ii] = touch->GetVolume(i)->GetLogicalVolume();
211 copyno[
ii] = touch->GetReplicaNumber(i);
constexpr uint32_t rawId() const
get the raw id
static void unpackIndex(const uint32_t &idx, int &z, int §or, int &zmodule)
virtual ~CastorNumberingScheme()
void detectorLevel(const G4Step *, int &, int *, lvp *) const
virtual uint32_t getUnitID(const G4Step *aStep) const
static uint32_t packIndex(int z, int sector, int zmodule)
T mod(const T &a, const T &b)