File indexing completed on 2026-04-17 07:51:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "DetectorConstruction.hh"
0030 #include "DetectorMessenger.hh"
0031
0032 #include "globals.hh"
0033 #include "G4SystemOfUnits.hh"
0034 #include "G4Box.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4VPhysicalVolume.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4Material.hh"
0039 #include "G4NistManager.hh"
0040 #include "G4GeometryManager.hh"
0041 #include "G4PhysicalVolumeStore.hh"
0042 #include "G4LogicalVolumeStore.hh"
0043 #include "G4SolidStore.hh"
0044 #include "G4VisAttributes.hh"
0045 #include "G4Colour.hh"
0046
0047
0048
0049 DetectorConstruction::DetectorConstruction()
0050 {
0051 G4NistManager* man = G4NistManager::Instance();
0052
0053
0054 fMessenger = new DetectorMessenger(this);
0055
0056 fWorldMat = man->FindOrBuildMaterial("G4_Galactic");
0057 fWorldXY = 50.*cm;
0058 fWorldZ = 100.*cm;
0059
0060 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0061 }
0062
0063
0064
0065
0066 DetectorConstruction::~DetectorConstruction()
0067 {
0068 delete fMessenger;
0069 }
0070
0071
0072
0073
0074 G4VPhysicalVolume* DetectorConstruction::Construct()
0075 {
0076 DumpGeometryParameters();
0077
0078 G4GeometryManager::GetInstance()->OpenGeometry();
0079 G4PhysicalVolumeStore::GetInstance()->Clean();
0080 G4LogicalVolumeStore::GetInstance()->Clean();
0081 G4SolidStore::GetInstance()->Clean();
0082
0083
0084
0085
0086 G4Box* sWorld = new G4Box("World",
0087 fWorldXY, fWorldXY, fWorldZ);
0088 G4LogicalVolume* lWorld = new G4LogicalVolume(sWorld,
0089 fWorldMat, "World");
0090 G4VPhysicalVolume* phWorld = new G4PVPlacement(0, G4ThreeVector(),
0091 "World", lWorld,
0092 0, false, 0);
0093
0094
0095
0096
0097 auto visAtt = new G4VisAttributes(G4Colour(0.1,0.5,1.0));
0098 visAtt->SetVisibility(true);
0099 lWorld->SetVisAttributes(visAtt);
0100
0101 return phWorld;
0102 }
0103
0104
0105
0106
0107 void DetectorConstruction::DumpGeometryParameters()
0108 {
0109
0110 G4cout << "\n===================================================" << G4endl;
0111 G4cout << "# IAEAphsp Geometry #" << G4endl;
0112 G4cout << "===================================================" << G4endl;
0113 G4cout << " WorldXY = " << fWorldXY/cm << " cm " << G4endl;
0114 G4cout << " WorldZ = " << fWorldZ/cm << " cm " << G4endl;
0115 G4cout << " WorldMat: " << fWorldMat->GetName() << G4endl;
0116 G4cout << "===================================================\n" << G4endl;
0117 }