Geant4  10.02
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 // $Id: F05DetectorConstruction.cc 75672 2013-11-05 08:47:41Z gcosmo $
27 //
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
36 
37 #include "G4Material.hh"
38 #include "G4NistManager.hh"
39 
40 #include "G4Box.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4PVPlacement.hh"
43 
44 #include "G4GeometryManager.hh"
45 #include "G4PhysicalVolumeStore.hh"
46 #include "G4LogicalVolumeStore.hh"
47 #include "G4SolidStore.hh"
48 
49 #include "G4VisAttributes.hh"
50 #include "G4Colour.hh"
51 
52 #include "G4UserLimits.hh"
53 #include "G4SystemOfUnits.hh"
54 
55 #include "F05Field.hh"
56 
57 #include "G4FieldManager.hh"
59 
60 //#include "G4RepleteEofM.hh"
61 #include "G4EqEMFieldWithSpin.hh"
62 
63 #include "G4ClassicalRK4.hh"
65 #include "G4ChordFinder.hh"
66 #include "G4PropagatorInField.hh"
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71  : fVacuum(0), fWorldSizeXY(0), fWorldSizeZ(0),
72  fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0)
73 {
74  // materials
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {
82  if (fField) delete fField;
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86 
88 {
90 
91  fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
92 
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
100  //
101  // World
102  //
103 
104  fWorldSizeXY = 20.0*m;
105  fWorldSizeZ = 1.0*mm;
106 
107  fSolidWorld = new G4Box("World", //its name
108  fWorldSizeXY/2,fWorldSizeXY/2,fWorldSizeZ/2); //its size
109 
110  fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
111  fVacuum, //its material
112  "World"); //its name
113 
114  fPhysiWorld = new G4PVPlacement(0, //no rotation
115  G4ThreeVector(), //at (0,0,0)
116  fLogicWorld, //its logical volume
117  "World", //its name
118  0, //its mother volume
119  false, //no boolean operation
120  0); //copy number
121 
122  G4UserLimits* stepLimit;
123  stepLimit = new G4UserLimits(5*mm);
124 
125  fLogicWorld->SetUserLimits(stepLimit);
126 
127  //
128  // Visualization attributes
129  //
130  // fLogicWorld->SetVisAttributes (G4VisAttributes::Invisible);
131 
132  //
133  //always return the physical World
134  //
135  return fPhysiWorld;
136 }
137 
138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
139 
141 
143 
144 {
145  if (!fField) {
146 
147  fField = new F05Field();
148 
149 // G4RepleteEofM* equation = new G4RepleteEofM(fField);
151 // equation->SetBField();
152 // equation->SetEField();
153 // equation->SetSpin();
154 
155  G4FieldManager* fieldManager
157  fieldManager->SetDetectorField(fField);
158 
159  G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12);
160 
161  G4double minStep = 0.01*mm;
162 
163  G4ChordFinder* chordFinder =
164  new G4ChordFinder((G4MagneticField*)fField,minStep,stepper);
165 
166  // Set accuracy parameters
167  G4double deltaChord = 3.0*mm;
168  chordFinder->SetDeltaChord( deltaChord );
169 
170  G4double deltaOneStep = 0.01*mm;
171  fieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep);
172 
173  G4double deltaIntersection = 0.1*mm;
174  fieldManager->SetDeltaIntersection(deltaIntersection);
175 
176  G4TransportationManager* transportManager =
178 
179  G4PropagatorInField* fieldPropagator =
180  transportManager->GetPropagatorInField();
181 
182  G4double epsMin = 2.5e-7*mm;
183  G4double epsMax = 0.05*mm;
184 
185  fieldPropagator->SetMinimumEpsilonStep(epsMin);
186  fieldPropagator->SetMaximumEpsilonStep(epsMax);
187 
188  fieldManager->SetChordFinder(chordFinder);
189  }
190 }
191 
192 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
G4bool SetDetectorField(G4Field *detectorField)
Definition: G4Box.hh:64
void SetUserLimits(G4UserLimits *pULimits)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
#define G4ThreadLocal
Definition: tls.hh:89
void SetChordFinder(G4ChordFinder *aChordFinder)
static G4NistManager * Instance()
Definition of the F05DetectorConstruction class.
void SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
Definition of the F05Field class.
G4GLOB_DLL std::ostream G4cout
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
virtual G4VPhysicalVolume * Construct()
void SetDeltaIntersection(G4double valueDintersection)
void SetMinimumEpsilonStep(G4double newEpsMin)
#define G4endl
Definition: G4ios.hh:61
static const double m
Definition: G4SIunits.hh:128
double G4double
Definition: G4Types.hh:76
void SetMaximumEpsilonStep(G4double newEpsMax)
static G4ThreadLocal F05Field * fField
G4PropagatorInField * GetPropagatorInField() const
static const double mm
Definition: G4SIunits.hh:114
void SetDeltaChord(G4double newval)