Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm10/src/Detecto 26 /// \file electromagnetic/TestEm10/src/DetectorConstruction.cc 27 /// \brief Implementation of the DetectorConst 27 /// \brief Implementation of the DetectorConstruction class 28 // 28 // 29 // 29 // 30 // 30 // 31 // 31 // 32 32 33 #include "DetectorConstruction.hh" 33 #include "DetectorConstruction.hh" 34 << 34 #include "DetectorSimpleALICE.hh" 35 #include "DetectorALICE06.hh" 35 #include "DetectorALICE06.hh" 36 #include "DetectorBari05.hh" 36 #include "DetectorBari05.hh" 37 #include "DetectorBarr90.hh" << 38 #include "DetectorHarris73.hh" 37 #include "DetectorHarris73.hh" 39 #include "DetectorMessenger.hh" << 40 #include "DetectorSimpleALICE.hh" << 41 #include "DetectorWatase86.hh" 38 #include "DetectorWatase86.hh" >> 39 #include "DetectorBarr90.hh" >> 40 #include "DetectorMessenger.hh" 42 #include "Materials.hh" 41 #include "Materials.hh" 43 << 44 #include "G4LogicalVolume.hh" << 45 #include "G4LogicalVolumeStore.hh" << 46 #include "G4ProductionCuts.hh" << 47 #include "G4Region.hh" 42 #include "G4Region.hh" 48 #include "G4RegionStore.hh" 43 #include "G4RegionStore.hh" 49 #include "G4SystemOfUnits.hh" << 44 #include "G4ProductionCuts.hh" >> 45 >> 46 #include "G4LogicalVolumeStore.hh" >> 47 #include "G4LogicalVolume.hh" 50 #include "G4ios.hh" 48 #include "G4ios.hh" 51 49 >> 50 #include "G4SystemOfUnits.hh" >> 51 52 //....oooOO0OOooo........oooOO0OOooo........oo 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 53 54 DetectorConstruction::DetectorConstruction() 54 DetectorConstruction::DetectorConstruction() 55 : G4VUserDetectorConstruction(), fRadiatorDe << 55 :G4VUserDetectorConstruction(), >> 56 fRadiatorDescription(0), >> 57 fSetUp("simpleALICE") 56 { 58 { 57 fDetectorMessenger = new DetectorMessenger(t 59 fDetectorMessenger = new DetectorMessenger(this); 58 } 60 } 59 61 60 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 63 62 DetectorConstruction::~DetectorConstruction() 64 DetectorConstruction::~DetectorConstruction() 63 { 65 { 64 delete fRadiatorDescription; 66 delete fRadiatorDescription; 65 delete fDetectorMessenger; 67 delete fDetectorMessenger; 66 delete Materials::GetInstance(); 68 delete Materials::GetInstance(); 67 } 69 } 68 70 69 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 72 71 G4VPhysicalVolume* DetectorConstruction::Const 73 G4VPhysicalVolume* DetectorConstruction::Construct() 72 { 74 { 73 G4VPhysicalVolume* world = nullptr; 75 G4VPhysicalVolume* world = nullptr; 74 if (fSetUp == "simpleALICE") { << 76 if( fSetUp == "simpleALICE" ) 75 DetectorSimpleALICE simpleALICE; << 77 { >> 78 DetectorSimpleALICE simpleALICE; 76 world = simpleALICE.Construct(); 79 world = simpleALICE.Construct(); 77 fRadiatorDescription = simpleALICE.GetRadi 80 fRadiatorDescription = simpleALICE.GetRadiatorDescription(); 78 } 81 } 79 else if (fSetUp == "alice06") { << 82 else if( fSetUp == "alice06" ) 80 DetectorALICE06 alice06; << 83 { >> 84 DetectorALICE06 alice06; 81 world = alice06.Construct(); 85 world = alice06.Construct(); 82 fRadiatorDescription = alice06.GetRadiator 86 fRadiatorDescription = alice06.GetRadiatorDescription(); 83 } 87 } 84 else if (fSetUp == "bari05") { << 88 else if( fSetUp == "bari05" ) 85 DetectorBari05 bari05; << 89 { >> 90 DetectorBari05 bari05; 86 world = bari05.Construct(); 91 world = bari05.Construct(); 87 fRadiatorDescription = bari05.GetRadiatorD 92 fRadiatorDescription = bari05.GetRadiatorDescription(); 88 } 93 } 89 else if (fSetUp == "harris73") { << 94 else if( fSetUp == "harris73" ) 90 DetectorHarris73 harris73; << 95 { >> 96 DetectorHarris73 harris73; 91 world = harris73.Construct(); 97 world = harris73.Construct(); 92 fRadiatorDescription = harris73.GetRadiato 98 fRadiatorDescription = harris73.GetRadiatorDescription(); 93 } 99 } 94 else if (fSetUp == "watase86") { << 100 else if( fSetUp == "watase86" ) 95 DetectorWatase86 watase86; << 101 { >> 102 DetectorWatase86 watase86; 96 world = watase86.Construct(); 103 world = watase86.Construct(); 97 fRadiatorDescription = watase86.GetRadiato 104 fRadiatorDescription = watase86.GetRadiatorDescription(); 98 } 105 } 99 else if (fSetUp == "barr90") { << 106 else if( fSetUp == "barr90" ) 100 DetectorBarr90 barr90; << 107 { >> 108 DetectorBarr90 barr90; 101 world = barr90.Construct(); 109 world = barr90.Construct(); 102 fRadiatorDescription = barr90.GetRadiatorD 110 fRadiatorDescription = barr90.GetRadiatorDescription(); 103 } 111 } 104 else { << 112 else 105 G4cout << "Experimental setup is unsupport << 113 { 106 G4cout << "Run default: simpleALICE" << G4 << 114 G4cout << "Experimental setup is unsupported. Check /XTRdetector/setup " >> 115 <<G4endl; >> 116 G4cout << "Run default: simpleALICE"<<G4endl; 107 117 108 DetectorSimpleALICE simpleALICE; << 118 DetectorSimpleALICE simpleALICE; 109 world = simpleALICE.Construct(); 119 world = simpleALICE.Construct(); 110 fRadiatorDescription = simpleALICE.GetRadi 120 fRadiatorDescription = simpleALICE.GetRadiatorDescription(); 111 } 121 } 112 G4RegionStore* regionStore = G4RegionStore:: 122 G4RegionStore* regionStore = G4RegionStore::GetInstance(); 113 size_t nRegions = regionStore->size(); 123 size_t nRegions = regionStore->size(); 114 G4double cut = 1. * CLHEP::mm; << 124 G4double cut = 1.*CLHEP::mm; 115 for (size_t i = 0; i < nRegions; ++i) { << 125 for(size_t i=0; i<nRegions; ++i) { 116 G4Region* reg = (*regionStore)[i]; 126 G4Region* reg = (*regionStore)[i]; 117 if (!reg->GetProductionCuts()) { << 127 if(!reg->GetProductionCuts()) { 118 G4ProductionCuts* cuts = new G4Productio 128 G4ProductionCuts* cuts = new G4ProductionCuts(); 119 cuts->SetProductionCut(cut, "gamma"); << 129 cuts->SetProductionCut(cut,"gamma"); 120 cuts->SetProductionCut(cut, "e-"); << 130 cuts->SetProductionCut(cut,"e-"); 121 cuts->SetProductionCut(cut, "e+"); << 131 cuts->SetProductionCut(cut,"e+"); 122 cuts->SetProductionCut(cut, "proton"); << 132 cuts->SetProductionCut(cut,"proton"); 123 reg->SetProductionCuts(cuts); 133 reg->SetProductionCuts(cuts); 124 } 134 } 125 } 135 } 126 return world; 136 return world; 127 } 137 } 128 138 129 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 130 140 131 RadiatorDescription* DetectorConstruction::Get 141 RadiatorDescription* DetectorConstruction::GetRadiatorDescription() const 132 { 142 { 133 if (!fRadiatorDescription) { << 143 if ( ! fRadiatorDescription ) { 134 G4cout << "RadiatorDescription is not defi 144 G4cout << "RadiatorDescription is not defined" << G4endl; 135 } 145 } 136 return fRadiatorDescription; 146 return fRadiatorDescription; 137 } 147 } 138 148 139 //....oooOO0OOooo........oooOO0OOooo........oo 149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 140 150 141 G4Material* DetectorConstruction::GetAbsorberM 151 G4Material* DetectorConstruction::GetAbsorberMaterial() const 142 { 152 { 143 G4LogicalVolume* lv = G4LogicalVolumeStore:: << 153 G4LogicalVolume* lv >> 154 = G4LogicalVolumeStore::GetInstance()->GetVolume("Absorber"); 144 155 145 if (!lv) { << 156 if ( ! lv ) { 146 G4cerr << "Absorber logical volume is not 157 G4cerr << "Absorber logical volume is not defined." << G4endl; 147 return 0; 158 return 0; 148 } 159 } 149 160 150 return lv->GetMaterial(); 161 return lv->GetMaterial(); 151 } 162 } 152 163 153 //....oooOO0OOooo........oooOO0OOooo........oo 164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 165 154 166