File indexing completed on 2026-04-27 07:33:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "F06DetectorConstruction.hh"
0030
0031 #include "G4Box.hh"
0032 #include "G4Colour.hh"
0033 #include "G4FieldManager.hh"
0034 #include "G4GeometryManager.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4LogicalVolumeStore.hh"
0037 #include "G4Material.hh"
0038 #include "G4NistManager.hh"
0039 #include "G4PVPlacement.hh"
0040 #include "G4PhysicalVolumeStore.hh"
0041 #include "G4RepleteEofM.hh"
0042 #include "G4SolidStore.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4TransportationManager.hh"
0045 #include "G4UniformGravityField.hh"
0046 #include "G4UserLimits.hh"
0047 #include "G4VisAttributes.hh"
0048
0049
0050 #include "G4ChordFinder.hh"
0051 #include "G4ClassicalRK4.hh"
0052 #include "G4IntegrationDriver.hh"
0053 #include "G4MagIntegratorStepper.hh"
0054 #include "G4PropagatorInField.hh"
0055
0056
0057
0058 F06DetectorConstruction::F06DetectorConstruction() : fVacuum(nullptr)
0059 {
0060
0061 DefineMaterials();
0062 }
0063
0064
0065
0066 F06DetectorConstruction::~F06DetectorConstruction()
0067 {
0068 delete fField;
0069 }
0070
0071
0072
0073 void F06DetectorConstruction::DefineMaterials()
0074 {
0075 G4NistManager* nistMan = G4NistManager::Instance();
0076
0077 fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
0078
0079 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0080 }
0081
0082
0083
0084 G4VPhysicalVolume* F06DetectorConstruction::Construct()
0085 {
0086
0087
0088
0089
0090 G4double expHall_x = 1.0 * m;
0091 G4double expHall_y = 1.0 * m;
0092 G4double expHall_z = 1.0 * m;
0093
0094 auto solidWorld = new G4Box("World",
0095 expHall_x, expHall_y, expHall_z);
0096
0097 auto logicWorld = new G4LogicalVolume(solidWorld,
0098 fVacuum,
0099 "World");
0100
0101 auto physiWorld = new G4PVPlacement(nullptr,
0102 G4ThreeVector(),
0103 logicWorld,
0104 "World",
0105 nullptr,
0106 false,
0107 0);
0108
0109 G4double maxStep = 1.0 * mm;
0110 G4double maxTime = 41. * s;
0111
0112 auto stepLimit = new G4UserLimits(maxStep, DBL_MAX, maxTime);
0113
0114 logicWorld->SetUserLimits(stepLimit);
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 return physiWorld;
0125 }
0126
0127
0128
0129 G4ThreadLocal G4UniformGravityField* F06DetectorConstruction::fField = nullptr;
0130
0131 void F06DetectorConstruction::ConstructSDandField()
0132 {
0133 using StepperType = G4ClassicalRK4;
0134
0135 if (!fField) {
0136 fField = new G4UniformGravityField();
0137
0138 auto equation = new G4RepleteEofM(fField);
0139
0140
0141 G4TransportationManager* transportMgr = G4TransportationManager::GetTransportationManager();
0142
0143 G4FieldManager* fieldManager = transportMgr->GetFieldManager();
0144 fieldManager->SetDetectorField(fField);
0145
0146 const int nVar = 8;
0147 auto stepper = new StepperType(equation, nVar);
0148
0149 G4double minStep = 0.01 * mm;
0150 G4ChordFinder* chordFinder = nullptr;
0151 if (stepper) {
0152 auto intgrDriver =
0153 new G4IntegrationDriver<StepperType>(minStep, stepper, stepper->GetNumberOfVariables());
0154 if (intgrDriver) {
0155 chordFinder = new G4ChordFinder(intgrDriver);
0156 }
0157 }
0158
0159
0160
0161
0162
0163 G4double deltaChord = 3.0 * mm;
0164 chordFinder->SetDeltaChord(deltaChord);
0165
0166 G4double deltaIntersection = 0.1 * mm;
0167 fieldManager->SetDeltaIntersection(deltaIntersection);
0168
0169
0170
0171 G4double deltaOneStep = 0.01 * mm;
0172 fieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep);
0173
0174 G4double epsMax = 1.0e-4;
0175 G4double epsMin = 2.5e-7;
0176 fieldManager->SetMinimumEpsilonStep(epsMin);
0177 fieldManager->SetMaximumEpsilonStep(epsMax);
0178
0179
0180
0181 fieldManager->SetChordFinder(chordFinder);
0182 }
0183 }
0184
0185