Loading...
Searching...
No Matches
F05DetectorConstruction.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27/// \file field/field05/src/F05DetectorConstruction.cc
28/// \brief Implementation of the F05DetectorConstruction class
29//
30
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
35
36#include "G4Material.hh"
37#include "G4NistManager.hh"
38
39#include "G4Box.hh"
40#include "G4LogicalVolume.hh"
41#include "G4PVPlacement.hh"
42
43#include "G4GeometryManager.hh"
44#include "G4PhysicalVolumeStore.hh"
45#include "G4LogicalVolumeStore.hh"
46#include "G4SolidStore.hh"
47
48#include "G4VisAttributes.hh"
49#include "G4Colour.hh"
50
51#include "G4UserLimits.hh"
52#include "G4SystemOfUnits.hh"
53
54#include "F05Field.hh"
55
56#include "G4FieldManager.hh"
57#include "G4TransportationManager.hh"
58
59//#include "G4RepleteEofM.hh"
60#include "G4EqEMFieldWithSpin.hh"
61
62#include "G4ClassicalRK4.hh"
63#include "G4MagIntegratorStepper.hh"
64#include "G4ChordFinder.hh"
65#include "G4PropagatorInField.hh"
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
70 : fVacuum(nullptr)
71{
72 // materials
74}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84
86{
87 G4NistManager* nistMan = G4NistManager::Instance();
88
89 fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
90
91 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
97{
98 //
99 // World
100 //
101
102 G4double worldSizeXY = 20.0*m;
103 G4double worldSizeZ = 1.0*mm;
104
105 auto solidWorld = new G4Box("World", //its name
106 worldSizeXY/2,worldSizeXY/2,worldSizeZ/2); //its size
107
108 auto logicWorld = new G4LogicalVolume(solidWorld, //its solid
109 fVacuum, //its material
110 "World"); //its name
111
112 auto physiWorld = new G4PVPlacement(nullptr, //no rotation
113 G4ThreeVector(), //at (0,0,0)
114 logicWorld, //its logical volume
115 "World", //its name
116 nullptr, //its mother volume
117 false, //no boolean operation
118 0); //copy number
119
120 G4UserLimits* stepLimit;
121 stepLimit = new G4UserLimits(5*mm);
122
123 logicWorld->SetUserLimits(stepLimit);
124
125 //
126 // Visualization attributes
127 //
128 // fLogicWorld->SetVisAttributes (G4VisAttributes::GetInvisible());
129
130 //
131 //always return the physical World
132 //
133 return physiWorld;
134}
135
136//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137
138G4ThreadLocal F05Field* F05DetectorConstruction::fField = nullptr;
139
141
142{
143 if (!fField) {
144
145 fField = new F05Field();
146
147// G4RepleteEofM* equation = new G4RepleteEofM(fField);
148 auto equation = new G4EqEMFieldWithSpin(fField);
149// equation->SetBField();
150// equation->SetEField();
151// equation->SetSpin();
152
153 G4FieldManager* fieldManager
154 = G4TransportationManager::GetTransportationManager()->GetFieldManager();
155 fieldManager->SetDetectorField(fField);
156
157 G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12);
158
159 G4double minStep = 0.01*mm;
160
161 auto chordFinder =
162 new G4ChordFinder((G4MagneticField*)fField,minStep,stepper);
163
164 // Set accuracy parameters
165 G4double deltaChord = 3.0*mm;
166 chordFinder->SetDeltaChord( deltaChord );
167
168 // Maximum allowed integration error in one integration sub-step
169 G4double deltaOneStep = 0.01*mm;
170 fieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep);
171
172 G4double deltaIntersection = 0.1*mm;
173 fieldManager->SetDeltaIntersection(deltaIntersection);
174
175 G4TransportationManager* transportManager =
176 G4TransportationManager::GetTransportationManager();
177
178 G4PropagatorInField* fieldPropagator =
179 transportManager->GetPropagatorInField();
180
181 // Limits for relative accuracy of integration
182 G4double epsMin = 2.5e-7;
183 G4double epsMax = 0.001;
184
185 fieldPropagator->SetMinimumEpsilonStep(epsMin);
186 fieldPropagator->SetMaximumEpsilonStep(epsMax);
187
188 fieldManager->SetChordFinder(chordFinder);
189 }
190}
191
192//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the F05DetectorConstruction class.
Definition of the F05Field class.
static G4ThreadLocal F05Field * fField
G4VPhysicalVolume * Construct() override

Applications | User Support | Publications | Collaboration