File indexing completed on 2025-02-23 09:20:49
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
0030
0031
0032
0033 #include "DetectorConstruction.hh"
0034
0035 #include "DetectorALICE06.hh"
0036 #include "DetectorBari05.hh"
0037 #include "DetectorBarr90.hh"
0038 #include "DetectorHarris73.hh"
0039 #include "DetectorMessenger.hh"
0040 #include "DetectorSimpleALICE.hh"
0041 #include "DetectorWatase86.hh"
0042 #include "Materials.hh"
0043
0044 #include "G4LogicalVolume.hh"
0045 #include "G4LogicalVolumeStore.hh"
0046 #include "G4ProductionCuts.hh"
0047 #include "G4Region.hh"
0048 #include "G4RegionStore.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4ios.hh"
0051
0052
0053
0054 DetectorConstruction::DetectorConstruction()
0055 : G4VUserDetectorConstruction(), fRadiatorDescription(0), fSetUp("simpleALICE")
0056 {
0057 fDetectorMessenger = new DetectorMessenger(this);
0058 }
0059
0060
0061
0062 DetectorConstruction::~DetectorConstruction()
0063 {
0064 delete fRadiatorDescription;
0065 delete fDetectorMessenger;
0066 delete Materials::GetInstance();
0067 }
0068
0069
0070
0071 G4VPhysicalVolume* DetectorConstruction::Construct()
0072 {
0073 G4VPhysicalVolume* world = nullptr;
0074 if (fSetUp == "simpleALICE") {
0075 DetectorSimpleALICE simpleALICE;
0076 world = simpleALICE.Construct();
0077 fRadiatorDescription = simpleALICE.GetRadiatorDescription();
0078 }
0079 else if (fSetUp == "alice06") {
0080 DetectorALICE06 alice06;
0081 world = alice06.Construct();
0082 fRadiatorDescription = alice06.GetRadiatorDescription();
0083 }
0084 else if (fSetUp == "bari05") {
0085 DetectorBari05 bari05;
0086 world = bari05.Construct();
0087 fRadiatorDescription = bari05.GetRadiatorDescription();
0088 }
0089 else if (fSetUp == "harris73") {
0090 DetectorHarris73 harris73;
0091 world = harris73.Construct();
0092 fRadiatorDescription = harris73.GetRadiatorDescription();
0093 }
0094 else if (fSetUp == "watase86") {
0095 DetectorWatase86 watase86;
0096 world = watase86.Construct();
0097 fRadiatorDescription = watase86.GetRadiatorDescription();
0098 }
0099 else if (fSetUp == "barr90") {
0100 DetectorBarr90 barr90;
0101 world = barr90.Construct();
0102 fRadiatorDescription = barr90.GetRadiatorDescription();
0103 }
0104 else {
0105 G4cout << "Experimental setup is unsupported. Check /XTRdetector/setup " << G4endl;
0106 G4cout << "Run default: simpleALICE" << G4endl;
0107
0108 DetectorSimpleALICE simpleALICE;
0109 world = simpleALICE.Construct();
0110 fRadiatorDescription = simpleALICE.GetRadiatorDescription();
0111 }
0112 G4RegionStore* regionStore = G4RegionStore::GetInstance();
0113 size_t nRegions = regionStore->size();
0114 G4double cut = 1. * CLHEP::mm;
0115 for (size_t i = 0; i < nRegions; ++i) {
0116 G4Region* reg = (*regionStore)[i];
0117 if (!reg->GetProductionCuts()) {
0118 G4ProductionCuts* cuts = new G4ProductionCuts();
0119 cuts->SetProductionCut(cut, "gamma");
0120 cuts->SetProductionCut(cut, "e-");
0121 cuts->SetProductionCut(cut, "e+");
0122 cuts->SetProductionCut(cut, "proton");
0123 reg->SetProductionCuts(cuts);
0124 }
0125 }
0126 return world;
0127 }
0128
0129
0130
0131 RadiatorDescription* DetectorConstruction::GetRadiatorDescription() const
0132 {
0133 if (!fRadiatorDescription) {
0134 G4cout << "RadiatorDescription is not defined" << G4endl;
0135 }
0136 return fRadiatorDescription;
0137 }
0138
0139
0140
0141 G4Material* DetectorConstruction::GetAbsorberMaterial() const
0142 {
0143 G4LogicalVolume* lv = G4LogicalVolumeStore::GetInstance()->GetVolume("Absorber");
0144
0145 if (!lv) {
0146 G4cerr << "Absorber logical volume is not defined." << G4endl;
0147 return 0;
0148 }
0149
0150 return lv->GetMaterial();
0151 }
0152
0153