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 // $Id$ 26 // 27 // 27 /// \file GB03DetectorConstruction.cc 28 /// \file GB03DetectorConstruction.cc 28 /// \brief Implementation of the GB03DetectorC 29 /// \brief Implementation of the GB03DetectorConstruction class 29 30 30 #include "GB03DetectorConstruction.hh" 31 #include "GB03DetectorConstruction.hh" 31 32 32 #include "GB03BOptrGeometryBasedBiasing.hh" << 33 #include "G4RunManager.hh" 33 #include "GB03DetectorMessenger.hh" << 34 34 >> 35 #include "G4Material.hh" 35 #include "G4Box.hh" 36 #include "G4Box.hh" 36 #include "G4Colour.hh" << 37 #include "G4LogicalVolume.hh" 37 #include "G4LogicalVolume.hh" 38 #include "G4Material.hh" << 39 #include "G4MultiFunctionalDetector.hh" << 40 #include "G4PSEnergyDeposit.hh" << 41 #include "G4PSFlatSurfaceFlux.hh" << 42 #include "G4PVPlacement.hh" 38 #include "G4PVPlacement.hh" 43 #include "G4PVReplica.hh" 39 #include "G4PVReplica.hh" 44 #include "G4PhysicalConstants.hh" << 40 45 #include "G4RunManager.hh" << 41 #include "G4VisAttributes.hh" 46 #include "G4SDChargedFilter.hh" << 42 #include "G4Colour.hh" >> 43 47 #include "G4SDManager.hh" 44 #include "G4SDManager.hh" >> 45 #include "G4MultiFunctionalDetector.hh" >> 46 #include "G4PSEnergyDeposit.hh" >> 47 #include "G4PSFlatSurfaceFlux.hh" 48 #include "G4SDNeutralFilter.hh" 48 #include "G4SDNeutralFilter.hh" 49 #include "G4SystemOfUnits.hh" << 49 #include "G4SDChargedFilter.hh" 50 #include "G4VisAttributes.hh" << 51 #include "G4ios.hh" 50 #include "G4ios.hh" 52 51 >> 52 #include "GB03DetectorMessenger.hh" >> 53 >> 54 #include "GB03BOptrGeometryBasedBiasing.hh" >> 55 >> 56 #include "G4PhysicalConstants.hh" >> 57 #include "G4SystemOfUnits.hh" >> 58 53 G4int GB03DetectorConstruction::fNumberOfLayer 59 G4int GB03DetectorConstruction::fNumberOfLayers = 40; 54 G4ThreadLocal G4bool GB03DetectorConstruction: 60 G4ThreadLocal G4bool GB03DetectorConstruction::fConstructedSDandField = false; 55 61 56 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 63 58 GB03DetectorConstruction::GB03DetectorConstruc 64 GB03DetectorConstruction::GB03DetectorConstruction() 59 : G4VUserDetectorConstruction(), << 65 : G4VUserDetectorConstruction(), 60 fTotalThickness(2.0 * m), << 66 fTotalThickness (2.0*m), fLayerThickness(0.), 61 fLayerThickness(0.), << 67 fConstructed(false), 62 fConstructed(false), << 68 fWorldMaterial(0), fAbsorberMaterial(0), fGapMaterial(0), 63 fWorldMaterial(0), << 69 fLayerSolid(0), fGapSolid(0), 64 fAbsorberMaterial(0), << 70 fWorldLogical(0), fCalorLogical(0), fLayerLogical(0), fGapLogical(0), 65 fGapMaterial(0), << 71 fWorldPhysical(0), fCalorPhysical(0), fLayerPhysical(0), fGapPhysical(0), 66 fLayerSolid(0), << 72 fDetectorMessenger(0), fVerboseLevel(1) 67 fGapSolid(0), << 68 fWorldLogical(0), << 69 fCalorLogical(0), << 70 fLayerLogical(0), << 71 fGapLogical(0), << 72 fWorldPhysical(0), << 73 fCalorPhysical(0), << 74 fLayerPhysical(0), << 75 fGapPhysical(0), << 76 fDetectorMessenger(0), << 77 fVerboseLevel(1) << 78 { 73 { 79 fLayerThickness = fTotalThickness / fNumberO 74 fLayerThickness = fTotalThickness / fNumberOfLayers; 80 fCalName = "Calor"; 75 fCalName = "Calor"; 81 fDetectorMessenger = new GB03DetectorMesseng 76 fDetectorMessenger = new GB03DetectorMessenger(this); 82 } 77 } 83 78 84 //....oooOO0OOooo........oooOO0OOooo........oo 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 80 86 GB03DetectorConstruction::~GB03DetectorConstru 81 GB03DetectorConstruction::~GB03DetectorConstruction() 87 { << 82 { delete fDetectorMessenger;} 88 delete fDetectorMessenger; << 89 } << 90 83 91 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 85 93 G4VPhysicalVolume* GB03DetectorConstruction::C 86 G4VPhysicalVolume* GB03DetectorConstruction::Construct() 94 { 87 { 95 if (!fConstructed) { << 88 if(!fConstructed) >> 89 { 96 fConstructed = true; 90 fConstructed = true; 97 DefineMaterials(); 91 DefineMaterials(); 98 SetupGeometry(); 92 SetupGeometry(); 99 } 93 } 100 if (GetVerboseLevel() > 0) { << 94 if (GetVerboseLevel()>0) 101 PrintCalorParameters(); << 95 { PrintCalorParameters(); } 102 } << 103 96 104 return fWorldPhysical; 97 return fWorldPhysical; 105 } 98 } 106 99 107 //....oooOO0OOooo........oooOO0OOooo........oo 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 108 101 109 void GB03DetectorConstruction::ConstructSDandF 102 void GB03DetectorConstruction::ConstructSDandField() 110 { 103 { 111 if (!fConstructedSDandField) { << 104 if(!fConstructedSDandField) >> 105 { 112 fConstructedSDandField = true; 106 fConstructedSDandField = true; 113 SetupDetectors(); 107 SetupDetectors(); 114 SetupBiasing(); 108 SetupBiasing(); 115 } 109 } 116 } 110 } 117 111 118 //....oooOO0OOooo........oooOO0OOooo........oo 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 119 113 120 void GB03DetectorConstruction::DefineMaterials 114 void GB03DetectorConstruction::DefineMaterials() 121 { << 115 { 122 G4String name, symbol; // a=mass of a mole; << 116 G4String name, symbol; //a=mass of a mole; 123 G4double a, z, density; // z=mean number of << 117 G4double a, z, density; //z=mean number of protons; 124 G4int iz; // iz=number of protons in an is << 118 G4int iz; //iz=number of protons in an isotope; 125 G4int n; // n=number of nucleons in an isot << 119 G4int n; // n=number of nucleons in an isotope; 126 120 127 G4int ncomponents, natoms; 121 G4int ncomponents, natoms; 128 G4double abundance, fractionmass; 122 G4double abundance, fractionmass; 129 G4double temperature, pressure; 123 G4double temperature, pressure; 130 124 131 // 125 // 132 // define Elements 126 // define Elements 133 // 127 // 134 128 135 a = 1.01 * g / mole; << 129 a = 1.01*g/mole; 136 G4Element* H = new G4Element(name = "Hydroge << 130 G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); 137 131 138 a = 12.01 * g / mole; << 132 a = 12.01*g/mole; 139 G4Element* C = new G4Element(name = "Carbon" << 133 G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a); 140 134 141 a = 14.01 * g / mole; << 135 a = 14.01*g/mole; 142 G4Element* N = new G4Element(name = "Nitroge << 136 G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); 143 137 144 a = 16.00 * g / mole; << 138 a = 16.00*g/mole; 145 G4Element* O = new G4Element(name = "Oxygen" << 139 G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); 146 140 147 // 141 // 148 // define an Element from isotopes, by relat << 142 // define an Element from isotopes, by relative abundance 149 // 143 // 150 144 151 G4Isotope* U5 = new G4Isotope(name = "U235", << 145 G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole); 152 G4Isotope* U8 = new G4Isotope(name = "U238", << 146 G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole); 153 147 154 G4Element* U = new G4Element(name = "enriche << 148 G4Element* U = new G4Element(name="enriched Uranium",symbol="U",ncomponents=2); 155 U->AddIsotope(U5, abundance = 90. * perCent) << 149 U->AddIsotope(U5, abundance= 90.*perCent); 156 U->AddIsotope(U8, abundance = 10. * perCent) << 150 U->AddIsotope(U8, abundance= 10.*perCent); 157 151 158 // 152 // 159 // define simple materials 153 // define simple materials 160 // 154 // 161 155 162 new G4Material(name = "Aluminium", z = 13., << 156 new G4Material(name="Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3); 163 new G4Material(name = "Silicon", z = 14., a << 157 new G4Material(name="Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3); 164 new G4Material(name = "Iron", z = 26., a = 5 << 158 new G4Material(name="Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3); 165 new G4Material(name = "ArgonGas", z = 18., a << 159 new G4Material(name="ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3); 166 new G4Material(name = "He", z = 2., a = 4.0 << 160 new G4Material(name="He", z=2., a=4.0*g/mole, density=0.1786e-03*g/cm3); 167 << 161 168 density = 1.390 * g / cm3; << 162 density = 1.390*g/cm3; 169 a = 39.95 * g / mole; << 163 a = 39.95*g/mole; 170 new G4Material(name = "liquidArgon", z = 18. << 164 new G4Material(name="liquidArgon", z=18., a, density); 171 << 165 172 density = 11.35 * g / cm3; << 166 density = 11.35*g/cm3; 173 a = 207.19 * g / mole; << 167 a = 207.19*g/mole; 174 G4Material* Pb = new G4Material(name = "Lead << 168 G4Material* Pb = new G4Material(name="Lead" , z=82., a, density); 175 169 176 // 170 // 177 // define a material from elements. case 1 171 // define a material from elements. case 1: chemical molecule 178 // 172 // 179 << 173 180 density = 1.000 * g / cm3; << 174 density = 1.000*g/cm3; 181 G4Material* H2O = new G4Material(name = "Wat << 175 G4Material* H2O = new G4Material(name="Water", density, ncomponents=2); 182 H2O->AddElement(H, natoms = 2); << 176 H2O->AddElement(H, natoms=2); 183 H2O->AddElement(O, natoms = 1); << 177 H2O->AddElement(O, natoms=1); 184 << 178 185 density = 1.032 * g / cm3; << 179 density = 1.032*g/cm3; 186 G4Material* Sci = new G4Material(name = "Sci << 180 G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2); 187 Sci->AddElement(C, natoms = 9); << 181 Sci->AddElement(C, natoms=9); 188 Sci->AddElement(H, natoms = 10); << 182 Sci->AddElement(H, natoms=10); 189 183 190 // 184 // 191 // define a material from elements. case 2 185 // define a material from elements. case 2: mixture by fractional mass 192 // 186 // 193 187 194 density = 1.290 * mg / cm3; << 188 density = 1.290*mg/cm3; 195 G4Material* Air = new G4Material(name = "Air << 189 G4Material* Air = new G4Material(name="Air" , density, ncomponents=2); 196 Air->AddElement(N, fractionmass = 0.7); << 190 Air->AddElement(N, fractionmass=0.7); 197 Air->AddElement(O, fractionmass = 0.3); << 191 Air->AddElement(O, fractionmass=0.3); 198 192 199 // 193 // 200 // examples of vacuum 194 // examples of vacuum 201 // 195 // 202 196 203 density = universe_mean_density; << 197 density = universe_mean_density; 204 pressure = 3.e-18 * pascal; << 198 pressure = 3.e-18*pascal; 205 temperature = 2.73 * kelvin; << 199 temperature = 2.73*kelvin; 206 G4Material* Vacuum = new G4Material(name = " << 200 G4Material* Vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, 207 kStateGa << 201 density,kStateGas,temperature,pressure); 208 202 209 if (GetVerboseLevel() > 1) { << 203 if (GetVerboseLevel()>1) { 210 G4cout << *(G4Material::GetMaterialTable() 204 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 211 } 205 } 212 206 213 // default materials of the calorimeter << 207 //default materials of the calorimeter 214 fWorldMaterial = Vacuum; << 208 fWorldMaterial = Vacuum; 215 fAbsorberMaterial = Pb; 209 fAbsorberMaterial = Pb; 216 fGapMaterial = Sci; << 210 fGapMaterial = Sci; 217 } 211 } 218 212 219 //....oooOO0OOooo........oooOO0OOooo........oo 213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 220 214 221 void GB03DetectorConstruction::SetupGeometry() 215 void GB03DetectorConstruction::SetupGeometry() 222 { 216 { 223 // << 217 // 224 // World 218 // World 225 // 219 // 226 G4VSolid* worldSolid = new G4Box("World", 2. << 220 G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,fTotalThickness*2.); 227 fWorldLogical = new G4LogicalVolume(worldSol << 221 fWorldLogical = new G4LogicalVolume(worldSolid,fWorldMaterial,"World"); 228 fWorldPhysical = new G4PVPlacement(0, G4Thre << 222 fWorldPhysical = new G4PVPlacement(0,G4ThreeVector(),fWorldLogical,"World", 229 << 223 0,false,0); 230 // << 224 >> 225 // 231 // Calorimeter 226 // Calorimeter 232 // << 227 // 233 G4VSolid* calorSolid = new G4Box("Calor", 0. << 228 G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,fTotalThickness/2.); 234 fCalorLogical = new G4LogicalVolume(calorSol << 229 fCalorLogical = new G4LogicalVolume(calorSolid,fAbsorberMaterial,fCalName); 235 fCalorPhysical = new G4PVPlacement(0, G4Thre << 230 fCalorPhysical = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), 236 fWorldLog << 231 fCalorLogical,fCalName,fWorldLogical,false,0); 237 << 232 238 // << 233 // 239 // Layers --- as absorbers 234 // Layers --- as absorbers 240 // 235 // 241 fLayerSolid = new G4Box("Layer", 0.5 * m, 0. << 236 fLayerSolid = new G4Box("Layer",0.5*m,0.5*m,fLayerThickness/2.); 242 fLayerLogical = new G4LogicalVolume(fLayerSo << 237 fLayerLogical 243 fLayerPhysical = new G4PVReplica(fCalName + << 238 = new G4LogicalVolume(fLayerSolid,fAbsorberMaterial,fCalName+"_LayerLog"); 244 fNumberOfLa << 239 fLayerPhysical 245 << 240 = new G4PVReplica(fCalName+"_Layer",fLayerLogical,fCalorLogical, >> 241 kZAxis,fNumberOfLayers,fLayerThickness); >> 242 246 // 243 // 247 // Gap 244 // Gap 248 // 245 // 249 fGapSolid = new G4Box("Gap", 0.5 * m, 0.5 * << 246 fGapSolid = new G4Box("Gap",0.5*m,0.5*m,fLayerThickness/4.); 250 fGapLogical = new G4LogicalVolume(fGapSolid, << 247 fGapLogical = new G4LogicalVolume(fGapSolid,fGapMaterial,fCalName+"_Gap"); 251 fGapPhysical = new G4PVPlacement(0, G4ThreeV << 248 fGapPhysical = new G4PVPlacement(0,G4ThreeVector(0.,0.,fLayerThickness/4.), 252 fCalName + << 249 fGapLogical,fCalName+"_gap",fLayerLogical,false,0); 253 250 254 // << 251 // 255 // Visualization attributes 252 // Visualization attributes 256 // 253 // 257 fWorldLogical->SetVisAttributes(G4VisAttribu 254 fWorldLogical->SetVisAttributes(G4VisAttributes::GetInvisible()); 258 G4VisAttributes* simpleBoxVisAtt = new G4Vis << 255 G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); 259 simpleBoxVisAtt->SetVisibility(true); 256 simpleBoxVisAtt->SetVisibility(true); 260 fCalorLogical->SetVisAttributes(simpleBoxVis 257 fCalorLogical->SetVisAttributes(simpleBoxVisAtt); 261 fLayerLogical->SetVisAttributes(simpleBoxVis 258 fLayerLogical->SetVisAttributes(simpleBoxVisAtt); 262 fGapLogical->SetVisAttributes(simpleBoxVisAt 259 fGapLogical->SetVisAttributes(simpleBoxVisAtt); >> 260 263 } 261 } 264 262 265 //....oooOO0OOooo........oooOO0OOooo........oo 263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 266 264 267 void GB03DetectorConstruction::SetupDetectors( 265 void GB03DetectorConstruction::SetupDetectors() 268 { 266 { 269 G4SDManager::GetSDMpointer()->SetVerboseLeve 267 G4SDManager::GetSDMpointer()->SetVerboseLevel(1); 270 G4String filterName; 268 G4String filterName; 271 269 272 G4SDNeutralFilter* neutralFilter = new G4SDN << 270 G4SDNeutralFilter* neutralFilter 273 G4SDChargedFilter* chargedFilter = new G4SDC << 271 = new G4SDNeutralFilter(filterName="neutralFilter"); >> 272 G4SDChargedFilter* chargedFilter >> 273 = new G4SDChargedFilter(filterName="chargedFilter"); 274 274 275 for (G4int j = 0; j < 2; j++) { << 275 for(G4int j=0;j<2;j++) >> 276 { 276 // Loop counter j = 0 : absorber 277 // Loop counter j = 0 : absorber 277 // = 1 : gap 278 // = 1 : gap 278 G4String detName = fCalName; 279 G4String detName = fCalName; 279 if (j == 0) { << 280 if(j==0) 280 detName += "_abs"; << 281 { detName += "_abs"; } 281 } << 282 else 282 else { << 283 { detName += "_gap"; } 283 detName += "_gap"; << 284 } << 285 G4MultiFunctionalDetector* det = new G4Mul 284 G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName); 286 G4SDManager::GetSDMpointer()->AddNewDetect 285 G4SDManager::GetSDMpointer()->AddNewDetector(det); 287 // The second argument in each primitive m << 286 // The second argument in each primitive means the "level" of geometrical 288 // hierarchy, the copy number of that leve << 287 // hierarchy, the copy number of that level is used as the key of the 289 // G4THitsMap. 288 // G4THitsMap. 290 // For absorber (j = 0), the copy number o 289 // For absorber (j = 0), the copy number of its own physical volume is used. 291 // For gap (j = 1), the copy number of its << 290 // For gap (j = 1), the copy number of its mother physical volume is used, 292 // since there is only one physical volume << 291 // since there is only one physical volume of gap is placed with respect 293 // to its mother. 292 // to its mother. 294 G4VPrimitiveScorer* primitive; 293 G4VPrimitiveScorer* primitive; 295 primitive = new G4PSEnergyDeposit("eDep", << 294 primitive = new G4PSEnergyDeposit("eDep",j); 296 det->RegisterPrimitive(primitive); 295 det->RegisterPrimitive(primitive); 297 primitive = new G4PSFlatSurfaceFlux("nNeut << 296 primitive = new G4PSFlatSurfaceFlux("nNeutral",1,j); 298 primitive->SetFilter(neutralFilter); 297 primitive->SetFilter(neutralFilter); 299 det->RegisterPrimitive(primitive); 298 det->RegisterPrimitive(primitive); 300 primitive = new G4PSFlatSurfaceFlux("nChar << 299 primitive = new G4PSFlatSurfaceFlux("nCharged",1,j); 301 primitive->SetFilter(chargedFilter); 300 primitive->SetFilter(chargedFilter); 302 det->RegisterPrimitive(primitive); 301 det->RegisterPrimitive(primitive); 303 302 304 if (j == 0) { << 303 if(j==0) 305 SetSensitiveDetector(fLayerLogical, det) << 304 { SetSensitiveDetector(fLayerLogical, det); } 306 } << 305 else 307 else { << 306 { SetSensitiveDetector(fGapLogical, det);} 308 SetSensitiveDetector(fGapLogical, det); << 307 309 } << 310 } 308 } 311 G4SDManager::GetSDMpointer()->SetVerboseLeve 309 G4SDManager::GetSDMpointer()->SetVerboseLevel(0); 312 } 310 } 313 311 314 //....oooOO0OOooo........oooOO0OOooo........oo 312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 315 313 316 void GB03DetectorConstruction::SetupBiasing() 314 void GB03DetectorConstruction::SetupBiasing() 317 { 315 { 318 GB03BOptrGeometryBasedBiasing* biasingOperat 316 GB03BOptrGeometryBasedBiasing* biasingOperator = new GB03BOptrGeometryBasedBiasing(); 319 biasingOperator->AttachTo(fLayerLogical); 317 biasingOperator->AttachTo(fLayerLogical); 320 } 318 } 321 319 322 //....oooOO0OOooo........oooOO0OOooo........oo 320 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 323 321 324 void GB03DetectorConstruction::PrintCalorParam 322 void GB03DetectorConstruction::PrintCalorParameters() const 325 { 323 { 326 G4cout << "--------------------------------- << 324 G4cout 327 G4cout << " Absorber is made of " << fAbsorb << 325 << "--------------------------------------------------------" << G4endl; 328 << fGapMaterial->GetName() << G4endl << 326 G4cout 329 << "--------------------------------- << 327 << " Absorber is made of " << fAbsorberMaterial->GetName() << G4endl >> 328 << " Gap is made of " << fGapMaterial->GetName() << G4endl >> 329 << "--------------------------------------------------------" << G4endl; 330 } 330 } 331 331 332 //....oooOO0OOooo........oooOO0OOooo........oo 332 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 333 333 334 void GB03DetectorConstruction::SetAbsorberMate 334 void GB03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) 335 { 335 { 336 // search the material by its name << 336 // search the material by its name 337 G4Material* pttoMaterial = G4Material::GetMa << 337 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); 338 if (pttoMaterial) { << 338 if(pttoMaterial) >> 339 { 339 fAbsorberMaterial = pttoMaterial; 340 fAbsorberMaterial = pttoMaterial; 340 if (fConstructed) { << 341 if(fConstructed) >> 342 { 341 fCalorLogical->SetMaterial(fAbsorberMate 343 fCalorLogical->SetMaterial(fAbsorberMaterial); 342 fLayerLogical->SetMaterial(fAbsorberMate 344 fLayerLogical->SetMaterial(fAbsorberMaterial); 343 } 345 } 344 G4RunManager::GetRunManager()->GeometryHas 346 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 345 if (GetVerboseLevel() > 1) { << 347 if (GetVerboseLevel()>1) { 346 PrintCalorParameters(); 348 PrintCalorParameters(); 347 } 349 } 348 } 350 } 349 else { << 351 else 350 G4cerr << materialChoice << " is not defin << 352 { >> 353 G4cerr >> 354 << materialChoice << " is not defined. - Command is ignored." << G4endl; 351 } 355 } 352 } 356 } 353 357 354 //....oooOO0OOooo........oooOO0OOooo........oo 358 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 355 359 356 G4String GB03DetectorConstruction::GetAbsorber 360 G4String GB03DetectorConstruction::GetAbsorberMaterial() const 357 { << 361 { return fAbsorberMaterial->GetName(); } 358 return fAbsorberMaterial->GetName(); << 359 } << 360 362 361 //....oooOO0OOooo........oooOO0OOooo........oo 363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 362 364 363 void GB03DetectorConstruction::SetGapMaterial( 365 void GB03DetectorConstruction::SetGapMaterial(G4String materialChoice) 364 { 366 { 365 // search the material by its name << 367 // search the material by its name 366 G4Material* pttoMaterial = G4Material::GetMa << 368 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); 367 if (pttoMaterial) { << 369 if(pttoMaterial) >> 370 { 368 fGapMaterial = pttoMaterial; 371 fGapMaterial = pttoMaterial; 369 if (fConstructed) { << 372 if(fConstructed) 370 fGapLogical->SetMaterial(fGapMaterial); << 373 { fGapLogical->SetMaterial(fGapMaterial); } 371 } << 372 G4RunManager::GetRunManager()->GeometryHas 374 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 373 if (GetVerboseLevel() > 1) { << 375 if (GetVerboseLevel()>1) { 374 PrintCalorParameters(); 376 PrintCalorParameters(); 375 } 377 } 376 } 378 } 377 else { << 379 else 378 G4cerr << materialChoice << " is not defin << 380 { >> 381 G4cerr >> 382 << materialChoice << " is not defined. - Command is ignored." << G4endl; 379 } 383 } 380 } 384 } 381 385 382 //....oooOO0OOooo........oooOO0OOooo........oo 386 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 383 387 384 G4String GB03DetectorConstruction::GetGapMater 388 G4String GB03DetectorConstruction::GetGapMaterial() const 385 { << 389 { return fGapMaterial->GetName(); } 386 return fGapMaterial->GetName(); << 387 } << 388 390 389 //....oooOO0OOooo........oooOO0OOooo........oo 391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 390 392 391 void GB03DetectorConstruction::SetNumberOfLaye 393 void GB03DetectorConstruction::SetNumberOfLayers(G4int nl) 392 { 394 { 393 fNumberOfLayers = nl; 395 fNumberOfLayers = nl; 394 fLayerThickness = fTotalThickness / fNumberO << 396 fLayerThickness = fTotalThickness/fNumberOfLayers; 395 if (!fConstructed) return; << 397 if(!fConstructed) return; 396 398 397 fLayerSolid->SetZHalfLength(fLayerThickness << 399 fLayerSolid->SetZHalfLength(fLayerThickness/2.); 398 fGapSolid->SetZHalfLength(fLayerThickness / << 400 fGapSolid->SetZHalfLength(fLayerThickness/4.); 399 401 400 fCalorLogical->RemoveDaughter(fLayerPhysical 402 fCalorLogical->RemoveDaughter(fLayerPhysical); 401 delete fLayerPhysical; 403 delete fLayerPhysical; 402 fLayerPhysical = new G4PVReplica(fCalName + << 404 fLayerPhysical 403 fNumberOfLa << 405 = new G4PVReplica(fCalName+"_Layer",fLayerLogical,fCalorLogical, 404 fGapPhysical->SetTranslation(G4ThreeVector(0 << 406 kZAxis,fNumberOfLayers,fLayerThickness); 405 << 407 fGapPhysical->SetTranslation(G4ThreeVector(0.,0.,fLayerThickness/4.)); >> 408 406 G4RunManager::GetRunManager()->GeometryHasBe 409 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 407 } 410 } 408 411 409 //....oooOO0OOooo........oooOO0OOooo........oo 412 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 410 413