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 field/field03/src/F03DetectorConstru 26 /// \file field/field03/src/F03DetectorConstruction.cc 27 /// \brief Implementation of the F03DetectorCo 27 /// \brief Implementation of the F03DetectorConstruction class 28 // 28 // 29 // 29 // 30 // 30 // 31 // 31 // 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 //....oooOO0OOooo........oooOO0OOooo........oo 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 34 34 35 #include "F03DetectorConstruction.hh" 35 #include "F03DetectorConstruction.hh" >> 36 #include "F03DetectorMessenger.hh" 36 37 37 #include "F03CalorimeterSD.hh" 38 #include "F03CalorimeterSD.hh" 38 #include "F03DetectorMessenger.hh" << 39 #include "F03FieldSetup.hh" 39 40 40 #include "G4AutoDelete.hh" << 41 #include "G4GeometryManager.hh" 41 #include "G4GeometryManager.hh" 42 #include "G4FieldBuilder.hh" << 42 #include "G4PhysicalVolumeStore.hh" 43 #include "G4LogicalVolume.hh" << 44 #include "G4LogicalVolumeStore.hh" 43 #include "G4LogicalVolumeStore.hh" >> 44 #include "G4SolidStore.hh" >> 45 45 #include "G4Material.hh" 46 #include "G4Material.hh" >> 47 #include "G4Tubs.hh" >> 48 #include "G4LogicalVolume.hh" 46 #include "G4PVPlacement.hh" 49 #include "G4PVPlacement.hh" 47 #include "G4PhysicalConstants.hh" << 48 #include "G4PhysicalVolumeStore.hh" << 49 #include "G4RunManager.hh" 50 #include "G4RunManager.hh" >> 51 #include "G4AutoDelete.hh" 50 #include "G4SDManager.hh" 52 #include "G4SDManager.hh" 51 #include "G4SolidStore.hh" << 53 >> 54 #include "G4PhysicalConstants.hh" 52 #include "G4SystemOfUnits.hh" 55 #include "G4SystemOfUnits.hh" 53 #include "G4Tubs.hh" << 54 #include "G4UniformMagField.hh" << 55 56 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 58 58 F03DetectorConstruction::F03DetectorConstructi 59 F03DetectorConstruction::F03DetectorConstruction() 59 { 60 { 60 fDetectorMessenger = new F03DetectorMessenge 61 fDetectorMessenger = new F03DetectorMessenger(this); 61 62 62 // create field builder << 63 // this will create commands for field param << 64 G4FieldBuilder* fieldBuilder = G4FieldBuilde << 65 // fieldBuilder->SetVerboseLevel(2); << 66 << 67 auto globalFieldParameters = fieldBuilder->G << 68 auto localFieldParameters = fieldBuilder->Cr << 69 << 70 // set default min step 0.25 mm << 71 globalFieldParameters->SetMinimumStep(0.25 * << 72 localFieldParameters->SetMinimumStep(0.25 * << 73 << 74 // create materials 63 // create materials >> 64 75 DefineMaterials(); 65 DefineMaterials(); 76 } 66 } 77 67 78 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 69 80 F03DetectorConstruction::~F03DetectorConstruct 70 F03DetectorConstruction::~F03DetectorConstruction() 81 { 71 { 82 delete fDetectorMessenger; 72 delete fDetectorMessenger; 83 } 73 } 84 74 85 //....oooOO0OOooo........oooOO0OOooo........oo 75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 86 76 87 G4VPhysicalVolume* F03DetectorConstruction::Co 77 G4VPhysicalVolume* F03DetectorConstruction::Construct() 88 { 78 { 89 return ConstructCalorimeter(); 79 return ConstructCalorimeter(); 90 } 80 } 91 81 92 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 83 94 void F03DetectorConstruction::DefineMaterials( 84 void F03DetectorConstruction::DefineMaterials() 95 { 85 { 96 // This function illustrates the possible wa << 86 //This function illustrates the possible ways to define materials 97 87 98 G4String name, symbol; // a=mass of a mole; << 88 G4String name, symbol; // a=mass of a mole; 99 G4double a, z, density; // z=mean number of << 89 G4double a, z, density; // z=mean number of protons; 100 G4int nel; 90 G4int nel; 101 G4int ncomponents; 91 G4int ncomponents; 102 G4double fractionmass, pressure, temperature 92 G4double fractionmass, pressure, temperature; 103 93 104 // 94 // 105 // define Elements 95 // define Elements 106 // 96 // 107 97 108 a = 1.01 * g / mole; << 98 a = 1.01*g/mole; 109 auto elH = new G4Element(name = "Hydrogen", << 99 auto elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); 110 100 111 a = 12.01 * g / mole; << 101 a = 12.01*g/mole; 112 auto elC = new G4Element(name = "Carbon", sy << 102 auto elC = new G4Element(name="Carbon", symbol="C", z=6., a); 113 103 114 a = 14.01 * g / mole; << 104 a = 14.01*g/mole; 115 auto elN = new G4Element(name = "Nitrogen", << 105 auto elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); 116 106 117 a = 16.00 * g / mole; << 107 a = 16.00*g/mole; 118 auto elO = new G4Element(name = "Oxygen", sy << 108 auto elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); 119 109 120 a = 39.948 * g / mole; << 110 a = 39.948*g/mole; 121 auto elAr = new G4Element(name = "Argon", sy << 111 auto elAr = new G4Element(name="Argon", symbol="Ar", z=18., a); 122 112 123 // 113 // 124 // define simple materials 114 // define simple materials 125 // 115 // 126 116 127 // Mylar 117 // Mylar 128 118 129 density = 1.39 * g / cm3; << 119 density = 1.39*g/cm3; 130 auto mylar = new G4Material(name = "Mylar", << 120 auto mylar = new G4Material(name="Mylar", density, nel=3); 131 mylar->AddElement(elO, 2); << 121 mylar->AddElement(elO,2); 132 mylar->AddElement(elC, 5); << 122 mylar->AddElement(elC,5); 133 mylar->AddElement(elH, 4); << 123 mylar->AddElement(elH,4); 134 124 135 // Polypropelene 125 // Polypropelene 136 126 137 auto CH2 = new G4Material("Polypropelene", 0 << 127 auto CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2); 138 CH2->AddElement(elH, 2); << 128 CH2->AddElement(elH,2); 139 CH2->AddElement(elC, 1); << 129 CH2->AddElement(elC,1); 140 130 141 // Krypton as detector gas, STP 131 // Krypton as detector gas, STP 142 132 143 density = 3.700 * mg / cm3; << 133 density = 3.700*mg/cm3; 144 a = 83.80 * g / mole; << 134 a = 83.80*g/mole; 145 auto Kr = new G4Material(name = "Kr", z = 36 << 135 auto Kr = new G4Material(name="Kr",z=36., a, density ); 146 136 147 // Dry air (average composition) 137 // Dry air (average composition) 148 138 149 density = 1.7836 * mg / cm3; // STP << 139 density = 1.7836*mg/cm3; // STP 150 auto argon = new G4Material(name = "Argon", << 140 auto argon = new G4Material(name="Argon" , density, ncomponents=1); 151 argon->AddElement(elAr, 1); 141 argon->AddElement(elAr, 1); 152 142 153 density = 1.25053 * mg / cm3; // STP << 143 density = 1.25053*mg/cm3; // STP 154 auto nitrogen = new G4Material(name = "N2", << 144 auto nitrogen = new G4Material(name="N2" , density, ncomponents=1); 155 nitrogen->AddElement(elN, 2); 145 nitrogen->AddElement(elN, 2); 156 146 157 density = 1.4289 * mg / cm3; // STP << 147 density = 1.4289*mg/cm3; // STP 158 auto oxygen = new G4Material(name = "O2", de << 148 auto oxygen = new G4Material(name="O2" , density, ncomponents=1); 159 oxygen->AddElement(elO, 2); 149 oxygen->AddElement(elO, 2); 160 150 161 density = 1.2928 * mg / cm3; // STP << 151 density = 1.2928*mg/cm3; // STP 162 density *= 1.0e-8; // pumped vacuum << 152 density *= 1.0e-8; // pumped vacuum 163 temperature = STP_Temperature; 153 temperature = STP_Temperature; 164 pressure = 1.0e-8 * STP_Pressure; << 154 pressure = 1.0e-8*STP_Pressure; 165 155 166 auto air = << 156 auto air = new G4Material(name="Air" , density, ncomponents=3, 167 new G4Material(name = "Air", density, ncom << 157 kStateGas,temperature,pressure); 168 air->AddMaterial(nitrogen, fractionmass = 0. << 158 air->AddMaterial( nitrogen, fractionmass = 0.7557 ); 169 air->AddMaterial(oxygen, fractionmass = 0.23 << 159 air->AddMaterial( oxygen, fractionmass = 0.2315 ); 170 air->AddMaterial(argon, fractionmass = 0.012 << 160 air->AddMaterial( argon, fractionmass = 0.0128 ); 171 161 172 // Xenon as detector gas, STP 162 // Xenon as detector gas, STP 173 163 174 density = 5.858 * mg / cm3; << 164 density = 5.858*mg/cm3; 175 a = 131.29 * g / mole; << 165 a = 131.29*g/mole; 176 auto Xe = new G4Material(name = "Xenon", z = << 166 auto Xe = new G4Material(name="Xenon",z=54., a, density ); 177 167 178 // Carbon dioxide, STP 168 // Carbon dioxide, STP 179 169 180 density = 1.842 * mg / cm3; << 170 density = 1.842*mg/cm3; 181 auto CarbonDioxide = new G4Material(name = " << 171 auto CarbonDioxide = new G4Material(name="CO2", density, nel=2); 182 CarbonDioxide->AddElement(elC, 1); << 172 CarbonDioxide->AddElement(elC,1); 183 CarbonDioxide->AddElement(elO, 2); << 173 CarbonDioxide->AddElement(elO,2); 184 174 185 // 80% Xe + 20% CO2, STP 175 // 80% Xe + 20% CO2, STP 186 176 187 density = 5.0818 * mg / cm3; << 177 density = 5.0818*mg/cm3; 188 auto Xe20CO2 = new G4Material(name = "Xe20CO << 178 auto Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2); 189 Xe20CO2->AddMaterial(Xe, fractionmass = 0.92 << 179 Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 ); 190 Xe20CO2->AddMaterial(CarbonDioxide, fraction << 180 Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ); 191 181 192 // 80% Kr + 20% CO2, STP 182 // 80% Kr + 20% CO2, STP 193 183 194 density = 3.601 * mg / cm3; << 184 density = 3.601*mg/cm3; 195 auto Kr20CO2 = new G4Material(name = "Kr20CO << 185 auto Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2); 196 Kr20CO2->AddMaterial(Kr, fractionmass = 0.89 << 186 Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 ); 197 Kr20CO2->AddMaterial(CarbonDioxide, fraction << 187 Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ); 198 188 199 G4cout << *(G4Material::GetMaterialTable()) 189 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 200 190 201 // default materials of the calorimeter and << 191 //default materials of the calorimeter and TR radiator 202 192 203 fRadiatorMat = air; // CH2 ; // mylar; << 193 fRadiatorMat = air; // CH2 ; // mylar; 204 194 205 fAbsorberMaterial = air; // Kr20CO2; // << 195 fAbsorberMaterial = air; // Kr20CO2; // XeCO2CF4; 206 196 207 fWorldMaterial = air; << 197 fWorldMaterial = air; 208 } 198 } 209 199 210 //....oooOO0OOooo........oooOO0OOooo........oo 200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 211 201 212 G4VPhysicalVolume* F03DetectorConstruction::Co 202 G4VPhysicalVolume* F03DetectorConstruction::ConstructCalorimeter() 213 { 203 { 214 // Cleanup old geometry 204 // Cleanup old geometry 215 205 216 if (fPhysiWorld) { << 206 if (fPhysiWorld) >> 207 { 217 G4GeometryManager::GetInstance()->OpenGeom 208 G4GeometryManager::GetInstance()->OpenGeometry(); 218 G4PhysicalVolumeStore::GetInstance()->Clea 209 G4PhysicalVolumeStore::GetInstance()->Clean(); 219 G4LogicalVolumeStore::GetInstance()->Clean 210 G4LogicalVolumeStore::GetInstance()->Clean(); 220 G4SolidStore::GetInstance()->Clean(); 211 G4SolidStore::GetInstance()->Clean(); 221 } 212 } 222 213 223 // complete the Calor parameters definition 214 // complete the Calor parameters definition and Print 224 215 225 ComputeCalorParameters(); 216 ComputeCalorParameters(); 226 PrintCalorParameters(); 217 PrintCalorParameters(); 227 218 228 G4bool checkOverlaps = true; 219 G4bool checkOverlaps = true; 229 220 230 fSolidWorld = new G4Tubs("World", // its na << 221 fSolidWorld = new G4Tubs("World", // its name 231 0., fWorldSizeR, fW << 222 0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size 232 223 233 fLogicWorld = new G4LogicalVolume(fSolidWorl << 224 fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid 234 fWorldMate << 225 fWorldMaterial, // its material 235 "World"); << 226 "World"); // its name 236 << 227 237 fPhysiWorld = new G4PVPlacement(nullptr, // << 228 fPhysiWorld = new G4PVPlacement(nullptr, // no rotation 238 G4ThreeVecto << 229 G4ThreeVector(), // at (0,0,0) 239 "World", // << 230 "World", // its name 240 fLogicWorld, << 231 fLogicWorld, // its logical volume 241 nullptr, // << 232 nullptr, // its mother volume 242 false, // n << 233 false, // no boolean op. 243 0, // copy << 234 0, // copy number 244 checkOverlap << 235 checkOverlaps); // checkOverlaps 245 236 246 // TR radiator envelope 237 // TR radiator envelope 247 G4double radThick = fFoilNumber * (fRadThick << 238 G4double radThick = fFoilNumber*(fRadThickness + fGasGap) + fDetGap; 248 G4double zRad = fZAbsorber - 0.5 * (radThick << 239 G4double zRad = fZAbsorber - 0.5*(radThick + fAbsorberThickness); 249 240 250 G4cout << "zRad = " << zRad / mm << " mm" << << 241 G4cout << "zRad = " << zRad/mm << " mm" << G4endl; 251 G4cout << "radThick = " << radThick / mm << << 242 G4cout << "radThick = " << radThick/mm << " mm" << G4endl; 252 G4cout << "fFoilNumber = " << fFoilNumber << 243 G4cout << "fFoilNumber = " << fFoilNumber << G4endl; 253 G4cout << "fRadiatorMat = " << fRadiatorMat- 244 G4cout << "fRadiatorMat = " << fRadiatorMat->GetName() << G4endl; 254 G4cout << "WorldMaterial = " << fWorldMateri 245 G4cout << "WorldMaterial = " << fWorldMaterial->GetName() << G4endl; 255 246 256 fSolidRadiator = new G4Tubs("Radiator", 0.0, << 247 fSolidRadiator = new G4Tubs("Radiator", 0.0, fAbsorberRadius, 0.5*radThick, >> 248 0.0, twopi); 257 249 258 fLogicRadiator = new G4LogicalVolume(fSolidR << 250 fLogicRadiator = new G4LogicalVolume(fSolidRadiator, fWorldMaterial, >> 251 "Radiator"); 259 252 260 fPhysiRadiator = new G4PVPlacement(nullptr, << 253 fPhysiRadiator = new G4PVPlacement(nullptr, G4ThreeVector(0,0,zRad), 261 fPhysiWor << 254 "Radiator", fLogicRadiator, fPhysiWorld, false, 0, >> 255 checkOverlaps); 262 256 263 fSolidRadSlice = new G4Tubs("RadSlice", 0.0, << 264 257 265 fLogicRadSlice = new G4LogicalVolume(fSolidR << 258 fSolidRadSlice = new G4Tubs("RadSlice",0.0, fAbsorberRadius, 0.5*fRadThickness, >> 259 0.0, twopi); 266 260 267 // Radiator slice << 261 fLogicRadSlice = new G4LogicalVolume(fSolidRadSlice,fRadiatorMat, "RadSlice"); 268 G4double radSliceThick = fRadThickness + fGa << 269 G4double zStart = 0.5 * (-radThick + radSlic << 270 // start on the board of radiator enevelope << 271 << 272 for (G4int j = 0; j < fFoilNumber; j++) { << 273 G4double zSlice = zStart + j * radSliceThi << 274 G4cout << zSlice / mm << " mm" << 275 << "\t"; << 276 262 277 fPhysiRadSlice = new G4PVPlacement(nullptr << 263 // Radiator slice 278 fLogicR << 264 G4double radSliceThick = fRadThickness +fGasGap; 279 } << 265 G4double zStart = 0.5*(-radThick + radSliceThick) + fDetGap; >> 266 // start on the board of radiator enevelope + det gap >> 267 >> 268 for (G4int j=0;j<fFoilNumber;j++) >> 269 { >> 270 G4double zSlice = zStart + j*radSliceThick; >> 271 G4cout << zSlice/mm << " mm" << "\t"; >> 272 >> 273 fPhysiRadSlice = new G4PVPlacement(nullptr,G4ThreeVector(0.,0., zSlice), >> 274 "RadSlice",fLogicRadSlice, >> 275 fPhysiRadiator,false,j, checkOverlaps); >> 276 } 280 G4cout << G4endl; 277 G4cout << G4endl; 281 278 282 // Absorber 279 // Absorber 283 280 284 fSolidAbsorber = << 281 fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm, 285 new G4Tubs("Absorber", 1.0 * mm, fAbsorber << 282 fAbsorberRadius, 286 << 283 fAbsorberThickness/2., 287 fLogicAbsorber = new G4LogicalVolume(fSolidA << 284 0.0,twopi); 288 << 285 289 fPhysiAbsorber = new G4PVPlacement(nullptr, << 286 fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, 290 fLogicAbs << 287 fAbsorberMaterial, >> 288 "Absorber"); >> 289 >> 290 fPhysiAbsorber = new G4PVPlacement(nullptr, >> 291 G4ThreeVector(0.,0.,fZAbsorber), >> 292 "Absorber", >> 293 fLogicAbsorber, >> 294 fPhysiWorld, >> 295 false, >> 296 0, >> 297 checkOverlaps); 291 298 292 return fPhysiWorld; 299 return fPhysiWorld; 293 } 300 } 294 301 295 //....oooOO0OOooo........oooOO0OOooo........oo 302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 296 303 297 void F03DetectorConstruction::PrintCalorParame 304 void F03DetectorConstruction::PrintCalorParameters() 298 { 305 { 299 G4cout << "\n The WORLD is made of " << f << 306 G4cout << "\n The WORLD is made of " 300 << fWorldMaterial->GetName(); << 307 << fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName(); 301 G4cout << ", the transverse size (R) of the << 308 G4cout << ", the transverse size (R) of the world is " 302 G4cout << " The ABSORBER is made of " << fAb << 309 << fWorldSizeR/mm << " mm. " << G4endl; 303 << fAbsorberMaterial->GetName(); << 310 G4cout << " The ABSORBER is made of " 304 G4cout << ", the transverse size (R) is " << << 311 << fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName(); 305 G4cout << " Z position of the (middle of the << 312 G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm >> 313 << " mm. " << G4endl; >> 314 G4cout << " Z position of the (middle of the) absorber " >> 315 << fZAbsorber/mm << " mm." << G4endl; 306 G4cout << G4endl; 316 G4cout << G4endl; 307 } 317 } 308 318 309 //....oooOO0OOooo........oooOO0OOooo........oo 319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 310 320 311 void F03DetectorConstruction::SetAbsorberMater 321 void F03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) 312 { 322 { 313 // get the pointer to the material table 323 // get the pointer to the material table 314 const G4MaterialTable* theMaterialTable = G4 324 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 315 325 316 // search the material by its name 326 // search the material by its name 317 G4Material* material; 327 G4Material* material; 318 for (size_t j = 0; j < theMaterialTable->siz << 328 for (size_t j=0 ; j<theMaterialTable->size() ; j++) 319 material = (*theMaterialTable)[j]; << 329 { material = (*theMaterialTable)[j]; 320 if (material->GetName() == materialChoice) << 330 if (material->GetName() == materialChoice) 321 fAbsorberMaterial = material; << 331 { 322 fLogicAbsorber->SetMaterial(material); << 332 fAbsorberMaterial = material; 323 G4RunManager::GetRunManager()->PhysicsHa << 333 fLogicAbsorber->SetMaterial(material); 324 } << 334 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 325 } << 335 } >> 336 } 326 } 337 } 327 338 328 //....oooOO0OOooo........oooOO0OOooo........oo 339 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 329 340 330 void F03DetectorConstruction::SetWorldMaterial 341 void F03DetectorConstruction::SetWorldMaterial(G4String materialChoice) 331 { 342 { 332 // get the pointer to the material table 343 // get the pointer to the material table 333 const G4MaterialTable* theMaterialTable = G4 344 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 334 345 335 // search the material by its name 346 // search the material by its name 336 G4Material* material; 347 G4Material* material; 337 for (size_t j = 0; j < theMaterialTable->siz << 348 for (size_t j=0 ; j<theMaterialTable->size() ; j++) 338 material = (*theMaterialTable)[j]; << 349 { material = (*theMaterialTable)[j]; 339 if (material->GetName() == materialChoice) << 350 if(material->GetName() == materialChoice) 340 fWorldMaterial = material; << 351 { 341 fLogicWorld->SetMaterial(material); << 352 fWorldMaterial = material; 342 G4RunManager::GetRunManager()->PhysicsHa << 353 fLogicWorld->SetMaterial(material); 343 } << 354 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 344 } << 355 } >> 356 } 345 } 357 } 346 358 347 //....oooOO0OOooo........oooOO0OOooo........oo 359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 348 360 349 void F03DetectorConstruction::SetAbsorberThick 361 void F03DetectorConstruction::SetAbsorberThickness(G4double val) 350 { 362 { 351 // change Absorber thickness and recompute t 363 // change Absorber thickness and recompute the calorimeter parameters 352 fAbsorberThickness = val; 364 fAbsorberThickness = val; 353 ComputeCalorParameters(); 365 ComputeCalorParameters(); 354 G4RunManager::GetRunManager()->GeometryHasBe << 366 G4RunManager::GetRunManager()->ReinitializeGeometry(); 355 } 367 } 356 368 357 //....oooOO0OOooo........oooOO0OOooo........oo 369 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 358 370 359 void F03DetectorConstruction::SetAbsorberRadiu 371 void F03DetectorConstruction::SetAbsorberRadius(G4double val) 360 { 372 { 361 // change the transverse size and recompute 373 // change the transverse size and recompute the calorimeter parameters 362 fAbsorberRadius = val; 374 fAbsorberRadius = val; 363 ComputeCalorParameters(); 375 ComputeCalorParameters(); 364 G4RunManager::GetRunManager()->GeometryHasBe << 376 G4RunManager::GetRunManager()->ReinitializeGeometry(); 365 } 377 } 366 378 367 //....oooOO0OOooo........oooOO0OOooo........oo 379 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 368 380 369 void F03DetectorConstruction::SetWorldSizeZ(G4 381 void F03DetectorConstruction::SetWorldSizeZ(G4double val) 370 { 382 { 371 fWorldSizeZ = val; 383 fWorldSizeZ = val; 372 ComputeCalorParameters(); 384 ComputeCalorParameters(); 373 G4RunManager::GetRunManager()->GeometryHasBe << 385 G4RunManager::GetRunManager()->ReinitializeGeometry(); 374 } 386 } 375 387 376 //....oooOO0OOooo........oooOO0OOooo........oo 388 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 377 389 378 void F03DetectorConstruction::SetWorldSizeR(G4 390 void F03DetectorConstruction::SetWorldSizeR(G4double val) 379 { 391 { 380 fWorldSizeR = val; 392 fWorldSizeR = val; 381 ComputeCalorParameters(); 393 ComputeCalorParameters(); 382 G4RunManager::GetRunManager()->GeometryHasBe << 394 G4RunManager::GetRunManager()->ReinitializeGeometry(); 383 } 395 } 384 396 385 //....oooOO0OOooo........oooOO0OOooo........oo 397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 386 398 387 void F03DetectorConstruction::SetAbsorberZpos( 399 void F03DetectorConstruction::SetAbsorberZpos(G4double val) 388 { 400 { 389 fZAbsorber = val; 401 fZAbsorber = val; 390 ComputeCalorParameters(); 402 ComputeCalorParameters(); 391 G4RunManager::GetRunManager()->GeometryHasBe << 403 G4RunManager::GetRunManager()->ReinitializeGeometry(); 392 } << 393 << 394 //....oooOO0OOooo........oooOO0OOooo........oo << 395 << 396 void F03DetectorConstruction::SetFieldValue(G4 << 397 { << 398 fFieldVector = value; << 399 << 400 G4UniformMagField* magField = nullptr; << 401 if (fFieldVector != G4ThreeVector(0.,0.,0.)) << 402 magField = new G4UniformMagField(fFieldVec << 403 } << 404 << 405 // Set field to the field builder << 406 auto fieldBuilder = G4FieldBuilder::Instance << 407 fieldBuilder->SetGlobalField(magField); << 408 } << 409 << 410 //....oooOO0OOooo........oooOO0OOooo........oo << 411 << 412 << 413 void F03DetectorConstruction::SetLocalFieldVal << 414 { << 415 fLocalFieldVector = value; << 416 << 417 G4UniformMagField* magField = nullptr; << 418 if (fLocalFieldVector != G4ThreeVector(0.,0. << 419 magField = new G4UniformMagField(fLocalFie << 420 } << 421 << 422 // Set field to the field builder << 423 auto fieldBuilder = G4FieldBuilder::Instance << 424 fieldBuilder->SetLocalField(magField, fLogic << 425 } 404 } 426 405 427 //....oooOO0OOooo........oooOO0OOooo........oo 406 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 428 407 429 void F03DetectorConstruction::ConstructSDandFi 408 void F03DetectorConstruction::ConstructSDandField() 430 { 409 { 431 // Sensitive Detectors: Absorber 410 // Sensitive Detectors: Absorber 432 411 433 if (!fCalorimeterSD.Get()) { 412 if (!fCalorimeterSD.Get()) { 434 auto calorimeterSD = new F03CalorimeterSD( << 413 auto calorimeterSD = new F03CalorimeterSD("CalorSD",this); 435 fCalorimeterSD.Put(calorimeterSD); 414 fCalorimeterSD.Put(calorimeterSD); 436 } 415 } 437 G4SDManager::GetSDMpointer()->AddNewDetector 416 G4SDManager::GetSDMpointer()->AddNewDetector(fCalorimeterSD.Get()); 438 SetSensitiveDetector(fLogicAbsorber, fCalori 417 SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get()); 439 418 440 // Create detector fields << 419 // Construct the field creator - this will register the field it creates 441 SetFieldValue(fFieldVector); << 420 442 SetLocalFieldValue(fLocalFieldVector); << 421 if (!fEmFieldSetup.Get()) { 443 << 422 auto emFieldSetup = new F03FieldSetup(); 444 // Construct all Geant4 field objects << 423 445 auto fieldBuilder = G4FieldBuilder::Instance << 424 fEmFieldSetup.Put(emFieldSetup); 446 fieldBuilder->ConstructFieldSetup(); << 425 G4AutoDelete::Register(emFieldSetup); //Kernel will delete the messenger >> 426 } >> 427 // Set local field manager and local field in radiator and its daughters: >> 428 G4bool allLocal = true; >> 429 fLogicRadiator->SetFieldManager(fEmFieldSetup.Get()->GetLocalFieldManager(), >> 430 allLocal ); 447 } 431 } 448 432 449 //....oooOO0OOooo........oooOO0OOooo........oo 433 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 450 434