10 #include "G4LogicalVolumeStore.hh"
14 #include "G4TransportationManager.hh"
23 G4LogicalVolume *BP, *
ID, *
CALO, *MU, *TTR;
27 static const VolumeHolder vh = [&]() {
29 G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
30 for (
size_t i=0;
i<lvs->size();++
i) {
32 if ( !(*lvs)[
i] ) {
continue; }
33 if ( (*lvs)[
i]->GetName() ==
"BeamPipe::BeamPipe" ) {
h.BP = (*lvs)[
i]; }
34 else if ( (*lvs)[
i]->GetName() ==
"IDET::IDET" || (*lvs)[
i]->GetName() ==
"ITK::ITK" ) {
h.ID = (*lvs)[
i]; }
35 else if ( (*lvs)[
i]->GetName() ==
"CALO::CALO" ) {
h.CALO = (*lvs)[
i]; }
36 else if ( (*lvs)[
i]->GetName() ==
"MUONQ02::MUONQ02" ) {
h.MU = (*lvs)[
i]; }
37 else if ( (*lvs)[
i]->GetName() ==
"TTR_BARREL::TTR_BARREL" ) {
h.TTR = (*lvs)[
i]; }
40 const auto& worldVolume = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
48 const G4StepPoint *postStep = aStep->GetPostStepPoint();
49 bool leavingG4World = postStep->GetStepStatus()==fWorldBoundary;
51 if ( leavingG4World ) {
90 const G4ThreeVector &postPos = postStep.GetPosition();
112 if (lv==
nullptr) {
return false; }
117 if ( lv->GetName() ==
"BeamPipe::BeamPipe" ||
118 lv->GetName() ==
"IDET::IDET" ||
119 lv->GetName() ==
"ITK::ITK" ||
120 lv->GetName() ==
"CALO::CALO" ||
121 lv->GetName() ==
"MUONQ02::MUONQ02" ||
122 lv->GetName() ==
"TTR_BARREL::TTR_BARREL" ) {
123 if(
depth!=volLevel) {
125 description <<
"Volume " << lv->GetName() <<
" at depth " <<
depth <<
" instead of depth " << volLevel;
126 G4Exception(
"iGeant4::ISFG4GeoHelper",
"checkVolumeDepth", FatalException,
description);
131 else if ( lv->GetName()==
"BeamPipe::BeamPipeCentral" ) {
132 if (
depth!=volLevel+1) {
134 description <<
"Volume " << lv->GetName() <<
" at depth " <<
depth <<
" instead of depth " << volLevel+1;
135 G4Exception(
"iGeant4::ISFG4GeoHelper",
"checkVolumeDepth", FatalException,
description);
140 else if ( lv->GetName().find(
"CavernInfra")!=std::string::npos ) {
141 if (
depth==volLevel-1) {
150 for (
unsigned int i=0;
i<lv->GetNoDaughters(); ++
i) {
151 Cavern =
Cavern || checkVolumeDepth( lv->GetDaughter(
i)->GetLogicalVolume() , volLevel ,
depth+1 );
155 description <<
"No CavernInfra volume registered at depth " << volLevel-1;
156 G4Exception(
"iGeant4::ISFG4GeoHelper",
"checkVolumeDepth", FatalException,
description);