9 #include "CLHEP/Units/GlobalSystemOfUnits.h"
10 #include "G4LogicalVolumeStore.hh"
16 lvCAHS(0),lvCHDS(0),lvCAER(0),
17 lvCEDR(0),lvCAHR(0),lvCHDR(0),
18 lvC3EF(0),lvC3HF(0),lvC4EF(0),
20 edm::LogInfo(
"ForwardSim") <<
"Creating CastorNumberingScheme";
21 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
22 std::vector<lvp>::const_iterator lvcite;
23 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
24 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAST") == 0)
lvCAST = (*lvcite);
25 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAES") == 0)
lvCAES = (*lvcite);
26 if (strcmp(((*lvcite)->GetName()).c_str(),
"CEDS") == 0)
lvCEDS = (*lvcite);
27 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAHS") == 0)
lvCAHS = (*lvcite);
28 if (strcmp(((*lvcite)->GetName()).c_str(),
"CHDS") == 0)
lvCHDS = (*lvcite);
29 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAER") == 0)
lvCAER = (*lvcite);
30 if (strcmp(((*lvcite)->GetName()).c_str(),
"CEDR") == 0)
lvCEDR = (*lvcite);
31 if (strcmp(((*lvcite)->GetName()).c_str(),
"CAHR") == 0)
lvCAHR = (*lvcite);
32 if (strcmp(((*lvcite)->GetName()).c_str(),
"CHDR") == 0)
lvCHDR = (*lvcite);
33 if (strcmp(((*lvcite)->GetName()).c_str(),
"C3EF") == 0)
lvC3EF = (*lvcite);
34 if (strcmp(((*lvcite)->GetName()).c_str(),
"C3HF") == 0)
lvC3HF = (*lvcite);
35 if (strcmp(((*lvcite)->GetName()).c_str(),
"C4EF") == 0)
lvC4EF = (*lvcite);
36 if (strcmp(((*lvcite)->GetName()).c_str(),
"C4HF") == 0)
lvC4HF = (*lvcite);
39 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme:: LogicalVolume pointers\n"
51 edm::LogInfo(
"ForwardSim") <<
"Deleting CastorNumberingScheme";
56 uint32_t intindex = 0;
59 int level, copyno[20];
64 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme number of levels= " <<
level;
74 for (
int ich=0; ich <
level; ich++) {
81 if (copyno[ich]<5) {sector = 5-copyno[ich] ;
82 }
else{sector = 13-copyno[ich] ;}
85 if (copyno[ich]<5) {sector = 5-copyno[ich] ;
86 }
else{sector = 13-copyno[ich] ;}
93 module = copyno[ich] + 2;
105 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme " <<
"ich = " << ich
106 <<
"copyno" << copyno[ich] <<
"name = "
107 << lvs[ich]->GetName();
122 intindex =
packIndex(zside, sector, module);
124 bool true_for_positive_eta =
false;
125 if(zside == 1)true_for_positive_eta =
true;
126 if(zside == -1)true_for_positive_eta =
false;
129 index = castorId.
rawId();
132 LogDebug(
"ForwardSim") <<
"CastorNumberingScheme :" <<
" zside "
133 << zside <<
" sector " << sector <<
" module "
134 << module <<
" UnitID 0x" << std::hex << intindex
153 uint32_t
idx=((z-1)&1)<<8;
172 sector = (idx>>4)&15;
177 int* copyno,
lvp* lvs)
const {
180 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
182 if (touch) level = ((touch->GetHistoryDepth())+1);
185 int i = level -
ii - 1;
186 lvs[
ii] = touch->GetVolume(i)->GetLogicalVolume();
187 copyno[
ii] = touch->GetReplicaNumber(i);
static void unpackIndex(const uint32_t &idx, int &z, int §or, int &zmodule)
uint32_t rawId() const
get the raw id
virtual ~CastorNumberingScheme()
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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)