ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F05DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file F05DetectorConstruction.cc
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 //
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"
58 
59 //#include "G4RepleteEofM.hh"
60 #include "G4EqEMFieldWithSpin.hh"
61 
62 #include "G4ClassicalRK4.hh"
64 #include "G4ChordFinder.hh"
65 #include "G4PropagatorInField.hh"
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70  : fVacuum(0), fWorldSizeXY(0), fWorldSizeZ(0),
71  fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0)
72 {
73  // materials
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  if (fField) delete fField;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
89 
90  fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
91 
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
98 {
99  //
100  // World
101  //
102 
103  fWorldSizeXY = 20.0*m;
104  fWorldSizeZ = 1.0*mm;
105 
106  fSolidWorld = new G4Box("World", //its name
107  fWorldSizeXY/2,fWorldSizeXY/2,fWorldSizeZ/2); //its size
108 
109  fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
110  fVacuum, //its material
111  "World"); //its name
112 
113  fPhysiWorld = new G4PVPlacement(0, //no rotation
114  G4ThreeVector(), //at (0,0,0)
115  fLogicWorld, //its logical volume
116  "World", //its name
117  0, //its mother volume
118  false, //no boolean operation
119  0); //copy number
120 
121  G4UserLimits* stepLimit;
122  stepLimit = new G4UserLimits(5*mm);
123 
124  fLogicWorld->SetUserLimits(stepLimit);
125 
126  //
127  // Visualization attributes
128  //
129  // fLogicWorld->SetVisAttributes (G4VisAttributes::GetInvisible());
130 
131  //
132  //always return the physical World
133  //
134  return fPhysiWorld;
135 }
136 
137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138 
140 
142 
143 {
144  if (!fField) {
145 
146  fField = new F05Field();
147 
148 // G4RepleteEofM* equation = new G4RepleteEofM(fField);
150 // equation->SetBField();
151 // equation->SetEField();
152 // equation->SetSpin();
153 
154  G4FieldManager* fieldManager
156  fieldManager->SetDetectorField(fField);
157 
158  G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12);
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......