13 #include "G4VPhysicalVolume.hh"
14 #include "G4PVPlacement.hh"
15 #include "G4Transform3D.hh"
16 #include "G4LogicalVolume.hh"
17 #include "G4VSolid.hh"
18 #include "G4Region.hh"
19 #include "G4RegionStore.hh"
21 #include "G4GenericMessenger.hh"
22 #include "G4VisAttributes.hh"
23 #include "G4Version.hh"
43 "Define the input envelope GDML file");
44 envCmd.SetToBeBroadcasted(
false);
45 envCmd.SetStates(G4State_PreInit);
47 "Define the input GDML file");
48 gdmlCmd.SetToBeBroadcasted(
false);
49 gdmlCmd.SetStates(G4State_PreInit);
51 "Define material definition file");
52 matCmd.SetToBeBroadcasted(
false);
53 matCmd.SetStates(G4State_PreInit);
60 G4Exception(
"eASTBeamPipe::Construct",
"eASTBeamPipe000",
61 FatalException,
"GDML file is not specified.");
65 #if G4VERSION_NUMBER > 1100
70 G4LogicalVolume* envelopeLog =
nullptr;
77 envelopeLog = tempWorld->GetLogicalVolume();
85 auto tempWorldLog = tempWorld->GetLogicalVolume();
86 auto tempWorldSolid = tempWorldLog->GetSolid();
88 if(tempWorldLog->GetNoDaughters()>1)
90 G4ExceptionDescription ed;
91 ed <<
"Envelope GDML file <" <<
envGdmlFileName <<
"> has more than one volumes.\n"
92 <<
"We cannot use it as an envelope";
93 G4Exception(
"eASTBeamPipe::Construct",
"eASTBeamPipe001",FatalException,ed);
96 auto envPhys = tempWorldLog->GetDaughter(0);
97 envelopeLog = envPhys->GetLogicalVolume();
101 delete tempWorldSolid;
107 auto tempEnvLog = tempEnv->GetLogicalVolume();
108 auto tempEnvSolid = tempEnvLog->GetSolid();
109 G4int ndaughter = G4int(tempEnvLog->GetNoDaughters());
110 for(G4int idaughter=0;idaughter<ndaughter;idaughter++)
112 auto daughter = tempEnvLog->GetDaughter(idaughter);
113 if(daughter->GetName().find(
"Vacuumvolume")!=std::string::npos)
116 delete daughter->GetLogicalVolume()->GetSolid();
117 delete daughter->GetLogicalVolume();
121 if(daughter->GetName().find(
"beryllium")!=std::string::npos)
124 auto visBery =
new G4VisAttributes(G4Colour(1.0,0.0,0.0));
125 daughter->GetLogicalVolume()->SetVisAttributes(visBery);
127 daughter->SetMotherLogical(envelopeLog);
128 envelopeLog->AddDaughter(daughter);
136 auto visAtt =
new G4VisAttributes(G4Colour(0.5,0.0,0.0));
137 visAtt->SetVisibility(
false);
139 envelopeLog->SetVisAttributes(visAtt);
143 envelopeLog->SetRegion(
pRegion);
144 pRegion->AddRootLogicalVolume(envelopeLog);
147 regInfo->SetBeamPipe();
148 pRegion->SetUserInformation(regInfo);
150 Locate(envelopeLog,worldPhys);