Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExUCNDetectorConstruction.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: ExUCNDetectorConstruction.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"
40 
41 #include "G4Box.hh"
42 #include "G4Tubs.hh"
43 #include "G4VPhysicalVolume.hh"
44 #include "G4LogicalVolume.hh"
45 #include "G4PVPlacement.hh"
46 
47 #include "G4GeometryManager.hh"
48 #include "G4PhysicalVolumeStore.hh"
49 #include "G4LogicalVolumeStore.hh"
50 #include "G4SolidStore.hh"
51 
52 #include "G4VisAttributes.hh"
53 #include "G4Colour.hh"
54 
55 #include "G4UserLimits.hh"
56 #include "G4SystemOfUnits.hh"
57 #include "G4PhysicalConstants.hh"
58 
59 #include "G4UniformGravityField.hh"
60 
61 #include "G4FieldManager.hh"
63 
64 #include "G4RepleteEofM.hh"
65 //#include "G4EqGravityField.hh"
66 
67 #include "G4ClassicalRK4.hh"
69 #include "G4ChordFinder.hh"
70 #include "G4PropagatorInField.hh"
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75  : fVacuum(0), fGuideMaterial(0)
76 {
77  // materials
78  DefineMaterials();
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
84 {
85  if (fField) delete fField;
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
90 void ExUCNDetectorConstruction::DefineMaterials()
91 {
93 
94  fVacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
95  fGuideMaterial = nistMan->FindOrBuildMaterial("G4_Ni");
96 
97  // --- Ni diffuse 10%
98 
100 
101  MPT->AddConstProperty("REFLECTIVITY",1.);
102  MPT->AddConstProperty("DIFFUSION",0.1);
103  MPT->AddConstProperty("FERMIPOT",252.0); // Gollub, Table 2.1 in neV
104  MPT->AddConstProperty("SPINFLIP",0.);
105  MPT->AddConstProperty("LOSS", 12.5e-5); // Gollub, Table 2.1
106  MPT->AddConstProperty("LOSSCS",0.);
107  MPT->AddConstProperty("ABSCS",4.49); // 1/v loss cross-section at room temp.
108  MPT->AddConstProperty("SCATCS",18.5); // (incoherent) "elastic" scattering cs
109 
110  G4double neV = 1.e-9*eV;
111 
112  MPT->SetMicroRoughnessParameters(30*nm, 1*nm,
113  180, 1000,
114  0*degree, 90*degree,
115  1*neV, 1000*neV,
116  15, 15,
117  0.01*degree);
118 
119  fGuideMaterial->SetMaterialPropertiesTable(MPT);
120 
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
127 {
128  //
129  // World
130  //
131 
132  G4double worldSizeX = 1.*m;
133  G4double worldSizeY = 1.*m;
134  G4double worldSizeZ = 100.*m;
135 
136  G4Box* solidWorld = new G4Box("World",
137  worldSizeX/2.,worldSizeY/2.,worldSizeZ/2.);
138 
139  G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,
140  fVacuum,
141  "World");
142 
143  G4VPhysicalVolume* physiWorld = new G4PVPlacement(0,
144  G4ThreeVector(),
145  "World",
146  logicWorld,
147  0,
148  false,
149  0);
150 
151 // --------------------------------- Guide -------------------------------------
152 
153  G4double GuideR = 35.*mm;
154  G4double GuideW = 2.*mm;
155  G4double GuideL = 6.*m;
156 
157  G4Tubs* solidGuide = new G4Tubs("SolidGuide",
158  GuideR,GuideR+GuideW,GuideL/2.,0.,twopi);
159 
160  G4LogicalVolume* logicGuide = new G4LogicalVolume(solidGuide,
161  fGuideMaterial,
162  "Guide");
163 
164  new G4PVPlacement(0,G4ThreeVector(),"Guide",logicGuide,physiWorld,false,0);
165 
166 // ------------------------------ End Plate -----------------------------------
167 
168  G4Tubs* solidEndPlate = new G4Tubs("EndPlate",0.,GuideR,GuideW/2.,0.,twopi);
169 
170  G4LogicalVolume* logicEndPlate = new G4LogicalVolume(solidEndPlate,
171  fVacuum,
172  "EndPlate");
173 
174  G4ThreeVector endPlatePos = G4ThreeVector(0.,0.,GuideL/2.+GuideW/2.);
175 
176  new G4PVPlacement(0,endPlatePos,"EndPlate",logicEndPlate,physiWorld,false,0);
177 
178  G4double maxStep = 1.0*mm;
179  G4double maxTime = 100.*s;
180 
181  G4UserLimits* stepLimit = new G4UserLimits(maxStep,DBL_MAX,maxTime);
182 
183  logicWorld->SetUserLimits(stepLimit);
184 
185  //
186  // Visualization attributes
187  //
188 
189  G4VisAttributes* guideColor = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
190  guideColor->SetVisibility(true);
191  guideColor->SetForceWireframe(true);
192 
193  G4VisAttributes* endPlateColor = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
194  endPlateColor->SetVisibility(true);
195  endPlateColor->SetForceSolid(true);
196 
198  logicGuide->SetVisAttributes(guideColor);
199  logicEndPlate->SetVisAttributes(endPlateColor);
200 
201  //
202  //always return the physical World
203  //
204  return physiWorld;
205 }
206 
207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
208 
209 G4ThreadLocal G4UniformGravityField* ExUCNDetectorConstruction::fField = 0;
210 
212 {
213  if (!fField) {
214 
215  fField = new G4UniformGravityField();
216 
217  G4RepleteEofM* equation = new G4RepleteEofM(fField);
218 // G4RepleteEofM* equation = new G4RepleteEofM(fField,12);
219 // G4EqGravityField* equation = new G4EqGravityField(fField);
220 
221  G4FieldManager* fieldManager
223  fieldManager->SetDetectorField(fField);
224 
225  G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,8);
226 // G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12);
227 
228  G4double minStep = 0.01*mm;
229 
230  G4ChordFinder* chordFinder =
231  new G4ChordFinder((G4MagneticField*)fField,minStep,stepper);
232 
233  // Set accuracy parameters
234  G4double deltaChord = 3.0*mm;
235  chordFinder->SetDeltaChord( deltaChord );
236 
237  G4double deltaOneStep = 0.01*mm;
238  fieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep);
239 
240  G4double deltaIntersection = 0.1*mm;
241  fieldManager->SetDeltaIntersection(deltaIntersection);
242 
243  G4TransportationManager* transportManager =
245 
246  G4PropagatorInField* fieldPropagator =
247  transportManager->GetPropagatorInField();
248 
249  G4double epsMin = 2.5e-7*mm;
250  G4double epsMax = 0.05*mm;
251 
252  fieldPropagator->SetMinimumEpsilonStep(epsMin);
253  fieldPropagator->SetMaximumEpsilonStep(epsMax);
254 
255  fieldManager->SetChordFinder(chordFinder);
256  }
257 }
258 
259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double mm
Definition: G4SIunits.hh:115
CLHEP::Hep3Vector G4ThreeVector
G4bool SetDetectorField(G4Field *detectorField)
Definition: G4Box.hh:64
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
Definition: G4Material.hh:249
void SetUserLimits(G4UserLimits *pULimits)
Definition: G4Tubs.hh:85
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
#define G4ThreadLocal
Definition: tls.hh:89
void SetChordFinder(G4ChordFinder *aChordFinder)
static G4NistManager * Instance()
void SetForceSolid(G4bool=true)
static constexpr double twopi
Definition: G4SIunits.hh:76
const XML_Char * s
Definition: expat.h:262
void SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
G4GLOB_DLL std::ostream G4cout
Definition of the ExUCNDetectorConstruction class.
static constexpr double m
Definition: G4SIunits.hh:129
static constexpr double degree
Definition: G4SIunits.hh:144
void SetVisibility(G4bool=true)
virtual G4VPhysicalVolume * Construct()
static constexpr double eV
Definition: G4SIunits.hh:215
void AddConstProperty(const char *key, G4double PropertyValue)
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
static constexpr double nm
Definition: G4SIunits.hh:112
void SetDeltaIntersection(G4double valueDintersection)
void SetMinimumEpsilonStep(G4double newEpsMin)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetMaximumEpsilonStep(G4double newEpsMax)
G4PropagatorInField * GetPropagatorInField() const
void SetMicroRoughnessParameters(G4double, G4double, G4int, G4int, G4double, G4double, G4double, G4double, G4int, G4int, G4double)
#define DBL_MAX
Definition: templates.hh:83
static const G4VisAttributes & GetInvisible()
void SetDeltaChord(G4double newval)
void SetForceWireframe(G4bool=true)
void SetVisAttributes(const G4VisAttributes *pVA)