Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 /// \file field/field06/src/F06DetectorConstru 28 /// \brief Implementation of the F06DetectorCo 29 // 30 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 #include "F06DetectorConstruction.hh" 35 36 #include "G4Box.hh" 37 #include "G4Colour.hh" 38 #include "G4FieldManager.hh" 39 #include "G4GeometryManager.hh" 40 #include "G4LogicalVolume.hh" 41 #include "G4LogicalVolumeStore.hh" 42 #include "G4Material.hh" 43 #include "G4NistManager.hh" 44 #include "G4PVPlacement.hh" 45 #include "G4PhysicalVolumeStore.hh" 46 #include "G4RepleteEofM.hh" 47 #include "G4SolidStore.hh" 48 #include "G4SystemOfUnits.hh" 49 #include "G4TransportationManager.hh" 50 #include "G4UniformGravityField.hh" 51 #include "G4UserLimits.hh" 52 #include "G4VisAttributes.hh" 53 // #include "G4EqGravityField.hh" 54 55 #include "G4ChordFinder.hh" 56 #include "G4ClassicalRK4.hh" 57 #include "G4IntegrationDriver.hh" 58 #include "G4MagIntegratorStepper.hh" 59 #include "G4PropagatorInField.hh" 60 61 //....oooOO0OOooo........oooOO0OOooo........oo 62 63 F06DetectorConstruction::F06DetectorConstructi 64 { 65 // materials 66 DefineMaterials(); 67 } 68 69 //....oooOO0OOooo........oooOO0OOooo........oo 70 71 F06DetectorConstruction::~F06DetectorConstruct 72 { 73 delete fField; 74 } 75 76 //....oooOO0OOooo........oooOO0OOooo........oo 77 78 void F06DetectorConstruction::DefineMaterials( 79 { 80 G4NistManager* nistMan = G4NistManager::Inst 81 82 fVacuum = nistMan->FindOrBuildMaterial("G4_G 83 84 G4cout << *(G4Material::GetMaterialTable()) 85 } 86 87 //....oooOO0OOooo........oooOO0OOooo........oo 88 89 G4VPhysicalVolume* F06DetectorConstruction::Co 90 { 91 // 92 // World 93 // 94 95 G4double expHall_x = 1.0 * m; 96 G4double expHall_y = 1.0 * m; 97 G4double expHall_z = 1.0 * m; 98 99 auto solidWorld = new G4Box("World", // its 100 expHall_x, expHa 101 102 auto logicWorld = new G4LogicalVolume(solidW 103 fVacuu 104 "World 105 106 auto physiWorld = new G4PVPlacement(nullptr, 107 G4ThreeV 108 logicWor 109 "World", 110 nullptr, 111 false, 112 0); // 113 114 G4double maxStep = 1.0 * mm; 115 G4double maxTime = 41. * s; 116 117 auto stepLimit = new G4UserLimits(maxStep, D 118 119 logicWorld->SetUserLimits(stepLimit); 120 121 // 122 // Visualization attributes 123 // 124 // logicWorld->SetVisAttributes (G4VisAttrib 125 126 // 127 // always return the physical World 128 // 129 return physiWorld; 130 } 131 132 //....oooOO0OOooo........oooOO0OOooo........oo 133 134 G4ThreadLocal G4UniformGravityField* F06Detect 135 136 void F06DetectorConstruction::ConstructSDandFi 137 { 138 using StepperType = G4ClassicalRK4; 139 140 if (!fField) { 141 fField = new G4UniformGravityField(); 142 143 auto equation = new G4RepleteEofM(fField); 144 // G4EqGravityField* equation = new G4 145 146 G4TransportationManager* transportMgr = G4 147 148 G4FieldManager* fieldManager = transportMg 149 fieldManager->SetDetectorField(fField); 150 151 const int nVar = 8; // 12 for RepleteEofM 152 auto stepper = new StepperType(equation, n 153 154 G4double minStep = 0.01 * mm; 155 G4ChordFinder* chordFinder = nullptr; 156 if (stepper) { 157 auto intgrDriver = 158 new G4IntegrationDriver<StepperType>(m 159 if (intgrDriver) { 160 chordFinder = new G4ChordFinder(intgrD 161 } 162 } 163 164 // OLD -- and wrong 165 // new G4ChordFinder((G4MagneticField*)fFi 166 167 // Set accuracy parameters 168 G4double deltaChord = 3.0 * mm; 169 chordFinder->SetDeltaChord(deltaChord); 170 171 G4double deltaIntersection = 0.1 * mm; 172 fieldManager->SetDeltaIntersection(deltaIn 173 174 // Control accuracy of integration 175 // 176 G4double deltaOneStep = 0.01 * mm; 177 fieldManager->SetAccuraciesWithDeltaOneSte 178 // 179 G4double epsMax = 1.0e-4; // Pure number 180 G4double epsMin = 2.5e-7; // 181 fieldManager->SetMinimumEpsilonStep(epsMin 182 fieldManager->SetMaximumEpsilonStep(epsMax 183 // The acceptable relative accuracy is cal 184 // but bounded to the interval between 185 186 fieldManager->SetChordFinder(chordFinder); 187 } 188 } 189 190 //....oooOO0OOooo........oooOO0OOooo........oo 191