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