18 #include "G4RunManager.hh"
19 #include "G4VPhysicalVolume.hh"
20 #include "G4PVPlacement.hh"
21 #include "G4LogicalVolume.hh"
23 #include "G4NistManager.hh"
24 #include "G4Material.hh"
25 #include "G4VisAttributes.hh"
26 #include "G4Region.hh"
27 #include "G4RegionStore.hh"
43 G4Exception(
"eASTDetectorConstruction::eASTDetectorConstruction()",
44 "eAST01230", FatalException,
45 "eASTDetectorConstruction is constructed twice!!");
54 {
delete comp.second; }
63 components[compName] = comp;
72 G4Exception(
"eASTDetectorConstruction::Construct()",
73 "eAST01231", FatalException,
74 "No detector component is registered. Nothing to construct!!");
78 auto air = G4NistManager::Instance()->FindOrBuildMaterial(
"G4_AIR");
79 auto worldLog =
new G4LogicalVolume(worldBox,air,
"worldLog");
80 auto visAtt =
new G4VisAttributes(G4Colour(0.5,0.5,0.5));
82 visAtt->SetForceWireframe();
83 worldLog->SetVisAttributes(visAtt);
84 fWorld =
new G4PVPlacement(0,G4ThreeVector(),worldLog,
"worldPhys",0,0,0);
86 auto worldDefRegion = G4RegionStore::GetInstance()
87 ->GetRegion(
"DefaultRegionForTheWorld");
89 worldDefRegionInfo->SetExperimentalHall();
90 worldDefRegion->SetUserInformation(worldDefRegionInfo);
94 G4cout <<
"##### Constructing " << comp.first <<
"........." << G4endl;
100 for(
auto comp : components)
109 #include "G4AutoLock.hh"
112 G4Mutex constructSDandFieldMutex = G4MUTEX_INITIALIZER;
117 G4AutoLock l(&constructSDandFieldMutex);
124 G4cout <<
"##### Activating magnetic field........." << G4endl;
130 #include "G4UnitsTable.hh"
131 #include "G4VSolid.hh"
135 G4cout <<
"*********** List of registered solids *************" << G4endl;
137 auto itr = store->begin();
138 for(;itr!=store->end();itr++)
143 G4cout << (*itr)->GetName() << G4endl;
146 G4cout << (*itr)->GetName()
147 <<
"\t volume = " << G4BestUnit((*itr)->GetCubicVolume(),
"Volume")
148 <<
"\t surface = " << G4BestUnit((*itr)->GetSurfaceArea(),
"Surface")
158 #include "G4LogicalVolume.hh"
160 #include "G4Material.hh"
161 #include "G4VSensitiveDetector.hh"
164 G4cout <<
"*********** List of registered logical volumes *************" << G4endl;
166 auto itr = store->begin();
167 for(;itr!=store->end();itr++)
169 G4cout << (*itr)->GetName() <<
"\t Solid = " << (*itr)->GetSolid()->GetName();
170 if((*itr)->GetMaterial())
171 { G4cout <<
"\t Material = " << (*itr)->GetMaterial()->GetName() << G4endl; }
173 { G4cout <<
"\t Material : not defined " << G4endl; }
175 G4cout <<
"\t region = ";
176 if((*itr)->GetRegion())
177 { G4cout << (*itr)->GetRegion()->GetName(); }
179 { G4cout <<
"not defined"; }
180 G4cout <<
"\t sensitive detector = ";
181 if((*itr)->GetSensitiveDetector())
182 { G4cout << (*itr)->GetSensitiveDetector()->GetName(); }
184 { G4cout <<
"not defined"; }
186 G4cout <<
"\t daughters = " << (*itr)->GetNoDaughters();
187 if((*itr)->GetNoDaughters()>0)
189 switch((*itr)->CharacteriseDaughters())
192 G4cout <<
" (placement)";
break;
194 G4cout <<
" (replica : " << (*itr)->GetDaughter(0)->GetMultiplicity() <<
")";
break;
196 G4cout <<
" (parameterized : " << (*itr)->GetDaughter(0)->GetMultiplicity() <<
")";
break;
203 if((*itr)->GetMaterial())
204 { G4cout <<
"\t weight = " << G4BestUnit((*itr)->GetMass(),
"Mass") << G4endl; }
206 { G4cout <<
"\t weight : not available" << G4endl; }
210 #include "G4VPhysicalVolume.hh"
214 G4cout <<
"*********** List of registered physical volumes *************" << G4endl;
216 auto itr = store->begin();
217 for(;itr!=store->end();itr++)
222 G4cout << (*itr)->GetName() << G4endl;
225 G4cout << (*itr)->GetName()
226 <<
"\t logical volume = " << (*itr)->GetLogicalVolume()->GetName()
227 <<
"\t mother logical = ";
228 if((*itr)->GetMotherLogical())
229 { G4cout << (*itr)->GetMotherLogical()->GetName(); }
231 { G4cout <<
"not defined"; }
235 G4cout << (*itr)->GetName()
236 <<
"\t logical volume = " << (*itr)->GetLogicalVolume()->GetName()
237 <<
"\t mother logical = ";
238 if((*itr)->GetMotherLogical())
239 { G4cout << (*itr)->GetMotherLogical()->GetName(); }
241 { G4cout <<
"not defined"; }
242 G4cout <<
"\t type = ";
243 switch((*itr)->VolumeType())
246 G4cout <<
"placement";
break;
248 G4cout <<
"replica";
break;
250 G4cout <<
"parameterized";
break;
260 G4int maxErr, G4double tol)
262 G4cout <<
"*********** Checking overlap for <" << physVolName <<
"> *************" << G4endl;
263 G4bool checkAll = (physVolName==
"**ALL**");
265 auto itr = store->begin();
266 G4VPhysicalVolume* physVol =
nullptr;
267 for(;itr!=store->end();itr++)
269 if(checkAll || (*itr)->GetName()==physVolName)
272 physVol->CheckOverlaps(nSpots,tol,
true,maxErr);
276 return (physVol!=
nullptr);
279 #include "G4Region.hh"
280 #include "G4RegionStore.hh"
281 #include "G4RunManagerKernel.hh"
286 G4RunManagerKernel::GetRunManagerKernel()->DumpRegion();
289 G4cout <<
"*********** List of registered regions *************" << G4endl;
290 auto store = G4RegionStore::GetInstance();
291 auto itr = store->begin();
292 for(;itr!=store->end();itr++)
294 G4cout << (*itr)->GetName();
295 if((*itr)->GetWorldPhysical())
297 G4cout <<
"\t in the world volume <" << (*itr)->GetWorldPhysical()->GetName() <<
"> ";
298 if((*itr)->IsInMassGeometry()) G4cout <<
"-- mass world";
299 if((*itr)->IsInParallelGeometry()) G4cout <<
"-- parallel world";
302 { G4cout <<
" -- is not associated to any world."; }
305 G4cout <<
"\t\t Root logical volume(s) : ";
306 size_t nRootLV = (*itr)->GetNumberOfRootVolumes();
307 std::vector<G4LogicalVolume*>::iterator lvItr = (*itr)->GetRootLogicalVolumeIterator();
308 for(
size_t j=0;j<nRootLV;j++)
309 { G4cout << (*lvItr)->GetName() <<
" "; lvItr++; }
311 G4cout <<
"\t\t Pointers : G4VUserRegionInformation[" << (*itr)->GetUserInformation()
312 <<
"], G4UserLimits[" << (*itr)->GetUserLimits()
313 <<
"], G4FastSimulationManager[" << (*itr)->GetFastSimulationManager()
314 <<
"], G4UserSteppingAction[" << (*itr)->GetRegionalSteppingAction() <<
"]" << G4endl;
318 #include "G4MaterialTable.hh"
321 auto materialTable = G4Material::GetMaterialTable();
322 auto matItr = materialTable->begin();
323 G4cout <<
"*********** List of instantiated materials **************" << G4endl;
325 for(;matItr!=materialTable->end();matItr++)
327 G4cout << (*matItr)->GetName() <<
"\t";
328 if(++i%5==0) G4cout << G4endl;
335 auto materialTable = G4Material::GetMaterialTable();
336 auto matItr = materialTable->begin();
337 for(;matItr!=materialTable->end();matItr++)
339 if((*matItr)->GetName()==matName)
341 G4cout << *matItr << G4endl;
348 #include "G4NistManager.hh"
351 auto nameVec = G4NistManager::Instance()->GetNistMaterialNames();
352 auto itr = nameVec.begin();
354 for(;itr!=nameVec.end();itr++)
356 G4cout << std::setw(26) << *itr;
357 if(++i%3==0) G4cout << G4endl;
364 auto mat = G4NistManager::Instance()->FindOrBuildMaterial(matName);
365 return (mat!=
nullptr);
371 std::vector<G4LogicalVolume*>::iterator itr = store->begin();
372 for(;itr!=store->end();itr++)
374 if((*itr)->GetName()==logVol)
376 G4cout <<
"Logical volume <" << (*itr)->GetName() <<
"> is made of <"
377 << (*itr)->GetMaterial()->GetName() <<
">" << G4endl;
386 G4LogicalVolume* logVol =
nullptr;
387 G4Material* mat =
nullptr;
390 auto itr = store->begin();
391 for(;itr!=store->end();itr++)
393 if(((*itr)->GetName()).find(logVolName)!=std::string::npos)
400 auto materialTable = G4Material::GetMaterialTable();
401 auto matItr = materialTable->begin();
402 for(;matItr!=materialTable->end();matItr++)
404 if((*matItr)->GetName()==matName)
419 { logVol->SetMaterial(mat); }