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 // $Id: F03DetectorConstruction.cc 77655 2013-11-27 08:51:59Z gcosmo $ 30 // 31 // 31 // 32 // 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 //....oooOO0OOooo........oooOO0OOooo........oo 34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 34 35 35 #include "F03DetectorConstruction.hh" 36 #include "F03DetectorConstruction.hh" >> 37 #include "F03DetectorMessenger.hh" 36 38 37 #include "F03CalorimeterSD.hh" 39 #include "F03CalorimeterSD.hh" 38 #include "F03DetectorMessenger.hh" << 40 #include "F03FieldSetup.hh" 39 41 40 #include "G4AutoDelete.hh" << 41 #include "G4GeometryManager.hh" 42 #include "G4GeometryManager.hh" 42 #include "G4FieldBuilder.hh" << 43 #include "G4PhysicalVolumeStore.hh" 43 #include "G4LogicalVolume.hh" << 44 #include "G4LogicalVolumeStore.hh" 44 #include "G4LogicalVolumeStore.hh" >> 45 #include "G4SolidStore.hh" >> 46 45 #include "G4Material.hh" 47 #include "G4Material.hh" >> 48 #include "G4Tubs.hh" >> 49 #include "G4LogicalVolume.hh" 46 #include "G4PVPlacement.hh" 50 #include "G4PVPlacement.hh" 47 #include "G4PhysicalConstants.hh" << 48 #include "G4PhysicalVolumeStore.hh" << 49 #include "G4RunManager.hh" 51 #include "G4RunManager.hh" 50 #include "G4SDManager.hh" << 52 #include "G4AutoDelete.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(1) 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 fSolidWorld = new G4Tubs("World", // its name >> 240 0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size 229 241 230 fSolidWorld = new G4Tubs("World", // its na << 242 fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid 231 0., fWorldSizeR, fW << 243 fWorldMaterial, // its material 232 << 244 "World"); // its name 233 fLogicWorld = new G4LogicalVolume(fSolidWorl << 245 234 fWorldMate << 246 fPhysiWorld = new G4PVPlacement(0, // no rotation 235 "World"); << 247 G4ThreeVector(), // at (0,0,0) 236 << 248 "World", // its name 237 fPhysiWorld = new G4PVPlacement(nullptr, // << 249 fLogicWorld, // its logical volume 238 G4ThreeVecto << 250 0, // its mother volume 239 "World", // << 251 false, // no boolean op. 240 fLogicWorld, << 252 0); // copy number 241 nullptr, // << 242 false, // n << 243 0, // copy << 244 checkOverlap << 245 253 246 // TR radiator envelope 254 // TR radiator envelope 247 G4double radThick = fFoilNumber * (fRadThick << 248 G4double zRad = fZAbsorber - 0.5 * (radThick << 249 255 250 G4cout << "zRad = " << zRad / mm << " mm" << << 256 G4double radThick = fFoilNumber*(fRadThickness + fGasGap) + fDetGap; 251 G4cout << "radThick = " << radThick / mm << << 257 >> 258 G4double zRad = fZAbsorber - 20*cm - 0.5*radThick; >> 259 G4cout << "zRad = " << zRad/mm << " mm" << G4endl; >> 260 >> 261 radThick *= 1.02; >> 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; 255 << 266 256 fSolidRadiator = new G4Tubs("Radiator", 0.0, << 267 fSolidRadiator = new G4Tubs("Radiator",0.0, 257 << 268 1.01*fAbsorberRadius, 258 fLogicRadiator = new G4LogicalVolume(fSolidR << 269 0.5*radThick,0.0, twopi); 259 << 270 260 fPhysiRadiator = new G4PVPlacement(nullptr, << 271 fLogicRadiator = new G4LogicalVolume(fSolidRadiator, 261 fPhysiWor << 272 fWorldMaterial, 262 << 273 "Radiator"); 263 fSolidRadSlice = new G4Tubs("RadSlice", 0.0, << 274 264 << 275 fPhysiRadiator = new G4PVPlacement(0, 265 fLogicRadSlice = new G4LogicalVolume(fSolidR << 276 G4ThreeVector(0,0,zRad), 266 << 277 "Radiator", fLogicRadiator, 267 // Radiator slice << 278 fPhysiWorld, false, 0); 268 G4double radSliceThick = fRadThickness + fGa << 279 269 G4double zStart = 0.5 * (-radThick + radSlic << 280 fSolidRadSlice = new G4Tubs("RadSlice",0.0, 270 // start on the board of radiator enevelope << 281 fAbsorberRadius,0.5*fRadThickness,0.0,twopi); 271 << 282 272 for (G4int j = 0; j < fFoilNumber; j++) { << 283 fLogicRadSlice = new G4LogicalVolume(fSolidRadSlice,fRadiatorMat, 273 G4double zSlice = zStart + j * radSliceThi << 284 "RadSlice",0,0,0); 274 G4cout << zSlice / mm << " mm" << 285 275 << "\t"; << 286 G4double zModule, zRadiator; 276 << 287 zModule = zRad + 0.5*radThick/1.02; 277 fPhysiRadSlice = new G4PVPlacement(nullptr << 288 G4cout << "zModule = " << zModule/mm << " mm" << G4endl; 278 fLogicR << 289 279 } << 290 for (G4int j=0;j<fFoilNumber;j++) >> 291 { >> 292 zRadiator = zModule - j*(fRadThickness + fGasGap); >> 293 G4cout << zRadiator/mm << " mm" << "\t"; >> 294 // G4cout << "j = " << j << "\t"; >> 295 >> 296 fPhysiRadSlice = new G4PVPlacement(0,G4ThreeVector(0.,0.,zRadiator-zRad), >> 297 "RadSlice",fLogicRadSlice, >> 298 fPhysiRadiator,false,j); >> 299 } 280 G4cout << G4endl; 300 G4cout << G4endl; 281 301 282 // Absorber 302 // Absorber 283 303 284 fSolidAbsorber = << 304 fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm, 285 new G4Tubs("Absorber", 1.0 * mm, fAbsorber << 305 fAbsorberRadius, 286 << 306 fAbsorberThickness/2., 287 fLogicAbsorber = new G4LogicalVolume(fSolidA << 307 0.0,twopi); 288 << 308 289 fPhysiAbsorber = new G4PVPlacement(nullptr, << 309 fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, 290 fLogicAbs << 310 fAbsorberMaterial, >> 311 "Absorber"); >> 312 >> 313 fPhysiAbsorber = new G4PVPlacement(0, >> 314 G4ThreeVector(0.,0.,fZAbsorber), >> 315 "Absorber", >> 316 fLogicAbsorber, >> 317 fPhysiWorld, >> 318 false, >> 319 0); 291 320 292 return fPhysiWorld; 321 return fPhysiWorld; 293 } 322 } 294 323 295 //....oooOO0OOooo........oooOO0OOooo........oo 324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 296 325 297 void F03DetectorConstruction::PrintCalorParame 326 void F03DetectorConstruction::PrintCalorParameters() 298 { 327 { 299 G4cout << "\n The WORLD is made of " << f << 328 G4cout << "\n The WORLD is made of " 300 << fWorldMaterial->GetName(); << 329 << fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName(); 301 G4cout << ", the transverse size (R) of the << 330 G4cout << ", the transverse size (R) of the world is " 302 G4cout << " The ABSORBER is made of " << fAb << 331 << fWorldSizeR/mm << " mm. " << G4endl; 303 << fAbsorberMaterial->GetName(); << 332 G4cout << " The ABSORBER is made of " 304 G4cout << ", the transverse size (R) is " << << 333 << fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName(); 305 G4cout << " Z position of the (middle of the << 334 G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm >> 335 << " mm. " << G4endl; >> 336 G4cout << " Z position of the (middle of the) absorber " >> 337 << fZAbsorber/mm << " mm." << G4endl; 306 G4cout << G4endl; 338 G4cout << G4endl; 307 } 339 } 308 340 309 //....oooOO0OOooo........oooOO0OOooo........oo 341 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 310 342 311 void F03DetectorConstruction::SetAbsorberMater 343 void F03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) 312 { 344 { 313 // get the pointer to the material table 345 // get the pointer to the material table 314 const G4MaterialTable* theMaterialTable = G4 346 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 315 347 316 // search the material by its name 348 // search the material by its name 317 G4Material* material; 349 G4Material* material; 318 for (size_t j = 0; j < theMaterialTable->siz << 350 for (size_t j=0 ; j<theMaterialTable->size() ; j++) 319 material = (*theMaterialTable)[j]; << 351 { material = (*theMaterialTable)[j]; 320 if (material->GetName() == materialChoice) << 352 if (material->GetName() == materialChoice) 321 fAbsorberMaterial = material; << 353 { 322 fLogicAbsorber->SetMaterial(material); << 354 fAbsorberMaterial = material; 323 G4RunManager::GetRunManager()->PhysicsHa << 355 fLogicAbsorber->SetMaterial(material); 324 } << 356 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 325 } << 357 } >> 358 } 326 } 359 } 327 360 328 //....oooOO0OOooo........oooOO0OOooo........oo 361 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 329 362 330 void F03DetectorConstruction::SetWorldMaterial 363 void F03DetectorConstruction::SetWorldMaterial(G4String materialChoice) 331 { 364 { 332 // get the pointer to the material table 365 // get the pointer to the material table 333 const G4MaterialTable* theMaterialTable = G4 366 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); 334 367 335 // search the material by its name 368 // search the material by its name 336 G4Material* material; 369 G4Material* material; 337 for (size_t j = 0; j < theMaterialTable->siz << 370 for (size_t j=0 ; j<theMaterialTable->size() ; j++) 338 material = (*theMaterialTable)[j]; << 371 { material = (*theMaterialTable)[j]; 339 if (material->GetName() == materialChoice) << 372 if(material->GetName() == materialChoice) 340 fWorldMaterial = material; << 373 { 341 fLogicWorld->SetMaterial(material); << 374 fWorldMaterial = material; 342 G4RunManager::GetRunManager()->PhysicsHa << 375 fLogicWorld->SetMaterial(material); 343 } << 376 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 344 } << 377 } >> 378 } 345 } 379 } 346 380 347 //....oooOO0OOooo........oooOO0OOooo........oo 381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 348 382 349 void F03DetectorConstruction::SetAbsorberThick 383 void F03DetectorConstruction::SetAbsorberThickness(G4double val) 350 { 384 { 351 // change Absorber thickness and recompute t 385 // change Absorber thickness and recompute the calorimeter parameters 352 fAbsorberThickness = val; 386 fAbsorberThickness = val; 353 ComputeCalorParameters(); 387 ComputeCalorParameters(); 354 G4RunManager::GetRunManager()->GeometryHasBe << 388 G4RunManager::GetRunManager()->ReinitializeGeometry(); 355 } 389 } 356 390 357 //....oooOO0OOooo........oooOO0OOooo........oo 391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 358 392 359 void F03DetectorConstruction::SetAbsorberRadiu 393 void F03DetectorConstruction::SetAbsorberRadius(G4double val) 360 { 394 { 361 // change the transverse size and recompute 395 // change the transverse size and recompute the calorimeter parameters 362 fAbsorberRadius = val; 396 fAbsorberRadius = val; 363 ComputeCalorParameters(); 397 ComputeCalorParameters(); 364 G4RunManager::GetRunManager()->GeometryHasBe << 398 G4RunManager::GetRunManager()->ReinitializeGeometry(); 365 } 399 } 366 400 367 //....oooOO0OOooo........oooOO0OOooo........oo 401 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 368 402 369 void F03DetectorConstruction::SetWorldSizeZ(G4 403 void F03DetectorConstruction::SetWorldSizeZ(G4double val) 370 { 404 { 371 fWorldSizeZ = val; 405 fWorldSizeZ = val; 372 ComputeCalorParameters(); 406 ComputeCalorParameters(); 373 G4RunManager::GetRunManager()->GeometryHasBe << 407 G4RunManager::GetRunManager()->ReinitializeGeometry(); 374 } 408 } 375 409 376 //....oooOO0OOooo........oooOO0OOooo........oo 410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 377 411 378 void F03DetectorConstruction::SetWorldSizeR(G4 412 void F03DetectorConstruction::SetWorldSizeR(G4double val) 379 { 413 { 380 fWorldSizeR = val; 414 fWorldSizeR = val; 381 ComputeCalorParameters(); 415 ComputeCalorParameters(); 382 G4RunManager::GetRunManager()->GeometryHasBe << 416 G4RunManager::GetRunManager()->ReinitializeGeometry(); 383 } 417 } 384 418 385 //....oooOO0OOooo........oooOO0OOooo........oo 419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 386 420 387 void F03DetectorConstruction::SetAbsorberZpos( 421 void F03DetectorConstruction::SetAbsorberZpos(G4double val) 388 { 422 { 389 fZAbsorber = val; 423 fZAbsorber = val; 390 ComputeCalorParameters(); 424 ComputeCalorParameters(); 391 G4RunManager::GetRunManager()->GeometryHasBe << 425 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 } 426 } 426 427 427 //....oooOO0OOooo........oooOO0OOooo........oo 428 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 428 429 429 void F03DetectorConstruction::ConstructSDandFi 430 void F03DetectorConstruction::ConstructSDandField() 430 { << 431 { 431 // Sensitive Detectors: Absorber 432 // Sensitive Detectors: Absorber 432 433 433 if (!fCalorimeterSD.Get()) { 434 if (!fCalorimeterSD.Get()) { 434 auto calorimeterSD = new F03CalorimeterSD( << 435 F03CalorimeterSD* calorimeterSD = new F03CalorimeterSD("CalorSD",this); 435 fCalorimeterSD.Put(calorimeterSD); 436 fCalorimeterSD.Put(calorimeterSD); 436 } << 437 } 437 G4SDManager::GetSDMpointer()->AddNewDetector << 438 SetSensitiveDetector(fLogicAbsorber, fCalori 438 SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get()); 439 439 440 // Create detector fields << 440 // Construct the field creator - this will register the field it creates 441 SetFieldValue(fFieldVector); << 441 442 SetLocalFieldValue(fLocalFieldVector); << 442 if (!fEmFieldSetup.Get()) { 443 << 443 F03FieldSetup* emFieldSetup = new F03FieldSetup(); 444 // Construct all Geant4 field objects << 444 445 auto fieldBuilder = G4FieldBuilder::Instance << 445 fEmFieldSetup.Put(emFieldSetup); 446 fieldBuilder->ConstructFieldSetup(); << 446 G4AutoDelete::Register(emFieldSetup); //Kernel will delete the messenger >> 447 } >> 448 // Set local field manager and local field in radiator and its daughters: >> 449 G4bool allLocal = true; >> 450 fLogicRadiator->SetFieldManager(fEmFieldSetup.Get()->GetLocalFieldManager(), >> 451 allLocal ); 447 } 452 } 448 453 449 //....oooOO0OOooo........oooOO0OOooo........oo 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 450 455