Geant4_10
F06DetectorConstruction.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: F06DetectorConstruction.cc 75572 2013-11-04 11:46:08Z 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 "G4UniformGravityField.hh"
56 
57 #include "G4FieldManager.hh"
59 
60 #include "G4RepleteEofM.hh"
61 //#include "G4EqGravityField.hh"
62 
63 #include "G4ClassicalRK4.hh"
65 #include "G4ChordFinder.hh"
66 #include "G4PropagatorInField.hh"
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71  : fVacuum(0), fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0)
72 {
73  // materials
74  DefineMaterials();
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  if (fField) delete fField;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
86 void F06DetectorConstruction::DefineMaterials()
87 {
89 
90  fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
91 
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
98 {
99  //
100  // World
101  //
102 
103  G4double expHall_x = 1.0*m;
104  G4double expHall_y = 1.0*m;
105  G4double expHall_z = 1.0*m;
106 
107  fSolidWorld = new G4Box("World", //its name
108  expHall_x,expHall_y,expHall_z); //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  G4double maxStep = 1.0*mm;
123  G4double maxTime = 41.*s;
124 
125  G4UserLimits* stepLimit = new G4UserLimits(maxStep,DBL_MAX,maxTime);
126 
127  fLogicWorld->SetUserLimits(stepLimit);
128 
129  //
130  // Visualization attributes
131  //
132  // fLogicWorld->SetVisAttributes (G4VisAttributes::Invisible);
133 
134  //
135  //always return the physical World
136  //
137  return fPhysiWorld;
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141 
142 G4ThreadLocal G4UniformGravityField* F06DetectorConstruction::fField = 0;
143 
145 {
146  if (!fField) {
147 
148  fField = new G4UniformGravityField();
149 
150  G4RepleteEofM* equation = new G4RepleteEofM(fField);
151 // G4EqGravityField* equation = new G4EqGravityField(fField);
152 
153  G4FieldManager* fieldManager
155  fieldManager->SetDetectorField(fField);
156 
157 // G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12);
158  G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,8);
159 
160  G4double minStep = 0.01*mm;
161 
162  G4ChordFinder* chordFinder =
163  new G4ChordFinder((G4MagneticField*)fField,minStep,stepper);
164 
165  // Set accuracy parameters
166  G4double deltaChord = 3.0*mm;
167  chordFinder->SetDeltaChord( deltaChord );
168 
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 =
177 
178  G4PropagatorInField* fieldPropagator =
179  transportManager->GetPropagatorInField();
180 
181  G4double epsMin = 2.5e-7*mm;
182  G4double epsMax = 0.05*mm;
183 
184  fieldPropagator->SetMinimumEpsilonStep(epsMin);
185  fieldPropagator->SetMaximumEpsilonStep(epsMax);
186 
187  fieldManager->SetChordFinder(chordFinder);
188  }
189 }
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
G4bool SetDetectorField(G4Field *detectorField)
const XML_Char * s
Definition: expat.h:262
Definition: G4Box.hh:63
void SetUserLimits(G4UserLimits *pULimits)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
G4double expHall_x
#define G4ThreadLocal
Definition: tls.hh:52
void SetChordFinder(G4ChordFinder *aChordFinder)
static G4NistManager * Instance()
Definition of the F06DetectorConstruction class.
void SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
G4double expHall_y
G4GLOB_DLL std::ostream G4cout
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
void SetDeltaIntersection(G4double valueDintersection)
void SetMinimumEpsilonStep(G4double newEpsMin)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetMaximumEpsilonStep(G4double newEpsMax)
virtual G4VPhysicalVolume * Construct()
G4PropagatorInField * GetPropagatorInField() const
#define DBL_MAX
Definition: templates.hh:83
void SetDeltaChord(G4double newval)
G4double expHall_z