ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ExUCNDetectorConstruction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ExUCNDetectorConstruction.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
34
#include "
ExUCNDetectorConstruction.hh
"
35
36
#include "
G4Material.hh
"
37
#include "
G4NistManager.hh
"
38
#include "
G4UCNMaterialPropertiesTable.hh
"
39
40
#include "
G4Box.hh
"
41
#include "
G4Tubs.hh
"
42
#include "
G4VPhysicalVolume.hh
"
43
#include "
G4LogicalVolume.hh
"
44
#include "
G4PVPlacement.hh
"
45
46
#include "
G4GeometryManager.hh
"
47
#include "
G4PhysicalVolumeStore.hh
"
48
#include "
G4LogicalVolumeStore.hh
"
49
#include "
G4SolidStore.hh
"
50
51
#include "
G4VisAttributes.hh
"
52
#include "
G4Colour.hh
"
53
54
#include "
G4UserLimits.hh
"
55
#include "
G4SystemOfUnits.hh
"
56
#include "
G4PhysicalConstants.hh
"
57
58
#include "
G4UniformGravityField.hh
"
59
60
#include "
G4FieldManager.hh
"
61
#include "
G4TransportationManager.hh
"
62
63
#include "
G4RepleteEofM.hh
"
64
//#include "G4EqGravityField.hh"
65
66
#include "
G4ClassicalRK4.hh
"
67
#include "
G4MagIntegratorStepper.hh
"
68
#include "
G4ChordFinder.hh
"
69
#include "
G4PropagatorInField.hh
"
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72
73
ExUCNDetectorConstruction::ExUCNDetectorConstruction
()
74
: fVacuum(0), fGuideMaterial(0)
75
{
76
// materials
77
DefineMaterials
();
78
}
79
80
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81
82
ExUCNDetectorConstruction::~ExUCNDetectorConstruction
()
83
{
84
if
(
fField
)
delete
fField
;
85
}
86
87
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88
89
void
ExUCNDetectorConstruction::DefineMaterials
()
90
{
91
G4NistManager
* nistMan =
G4NistManager::Instance
();
92
93
fVacuum
= nistMan->
FindOrBuildMaterial
(
"G4_Galactic"
);
94
fGuideMaterial
= nistMan->
FindOrBuildMaterial
(
"G4_Ni"
);
95
96
// --- Ni diffuse 10%
97
98
G4UCNMaterialPropertiesTable
* MPT =
new
G4UCNMaterialPropertiesTable
();
99
100
// MPT->AddConstProperty("REFLECTIVITY",1.);
101
// Commented out above line as REFLECTIVITY=1 by default in
102
// G4OpBoundaryProcess. Also use AddProperty to set REFLECTIVITY if needed
103
MPT->
AddConstProperty
(
"DIFFUSION"
,0.1);
104
MPT->
AddConstProperty
(
"FERMIPOT"
,252.0);
// Gollub, Table 2.1 in neV
105
MPT->
AddConstProperty
(
"SPINFLIP"
,0.);
106
MPT->
AddConstProperty
(
"LOSS"
, 12.5
e
-5);
// Gollub, Table 2.1
107
MPT->
AddConstProperty
(
"LOSSCS"
,0.);
108
MPT->
AddConstProperty
(
"ABSCS"
,4.49);
// 1/v loss cross-section at room temp.
109
MPT->
AddConstProperty
(
"SCATCS"
,18.5);
// (incoherent) "elastic" scattering cs
110
111
G4double
neV = 1.e-9*
eV
;
112
113
MPT->
SetMicroRoughnessParameters
(30*
nm
, 1*
nm
,
114
180, 1000,
115
0*
degree
, 90*
degree
,
116
1*neV, 1000*neV,
117
15, 15,
118
0.01*
degree
);
119
120
fGuideMaterial
->
SetMaterialPropertiesTable
(MPT);
121
122
G4cout
<< *(
G4Material::GetMaterialTable
()) <<
G4endl
;
123
}
124
125
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126
127
G4VPhysicalVolume
*
ExUCNDetectorConstruction::Construct
()
128
{
129
//
130
// World
131
//
132
133
G4double
worldSizeX = 1.*
m
;
134
G4double
worldSizeY = 1.*
m
;
135
G4double
worldSizeZ = 100.*
m
;
136
137
G4Box
* solidWorld =
new
G4Box
(
"World"
,
138
worldSizeX/2.,worldSizeY/2.,worldSizeZ/2.);
139
140
G4LogicalVolume
* logicWorld =
new
G4LogicalVolume
(solidWorld,
141
fVacuum
,
142
"World"
);
143
144
G4VPhysicalVolume
* physiWorld =
new
G4PVPlacement
(0,
145
G4ThreeVector
(),
146
"World"
,
147
logicWorld,
148
0,
149
false
,
150
0);
151
152
// --------------------------------- Guide -------------------------------------
153
154
G4double
GuideR = 35.*
mm
;
155
G4double
GuideW = 2.*
mm
;
156
G4double
GuideL = 6.*
m
;
157
158
G4Tubs
* solidGuide =
new
G4Tubs
(
"SolidGuide"
,
159
GuideR,GuideR+GuideW,GuideL/2.,0.,
twopi
);
160
161
G4LogicalVolume
* logicGuide =
new
G4LogicalVolume
(solidGuide,
162
fGuideMaterial
,
163
"Guide"
);
164
165
new
G4PVPlacement
(0,
G4ThreeVector
(),
"Guide"
,logicGuide,physiWorld,
false
,0);
166
167
// ------------------------------ End Plate -----------------------------------
168
169
G4Tubs
* solidEndPlate =
new
G4Tubs
(
"EndPlate"
,0.,GuideR,GuideW/2.,0.,
twopi
);
170
171
G4LogicalVolume
* logicEndPlate =
new
G4LogicalVolume
(solidEndPlate,
172
fVacuum
,
173
"EndPlate"
);
174
175
G4ThreeVector
endPlatePos =
G4ThreeVector
(0.,0.,GuideL/2.+GuideW/2.);
176
177
new
G4PVPlacement
(0,endPlatePos,
"EndPlate"
,logicEndPlate,physiWorld,
false
,0);
178
179
G4double
maxStep = 1.0*
mm
;
180
G4double
maxTime = 100.*
s
;
181
182
G4UserLimits
* stepLimit =
new
G4UserLimits
(maxStep,
DBL_MAX
,maxTime);
183
184
logicWorld->
SetUserLimits
(stepLimit);
185
186
//
187
// Visualization attributes
188
//
189
190
G4VisAttributes
* guideColor =
new
G4VisAttributes
(
G4Colour
(0.0,0.0,1.0));
191
guideColor->
SetVisibility
(
true
);
192
guideColor->
SetForceWireframe
(
true
);
193
194
G4VisAttributes
* endPlateColor =
new
G4VisAttributes
(
G4Colour
(1.0,0.0,0.0));
195
endPlateColor->
SetVisibility
(
true
);
196
endPlateColor->
SetForceSolid
(
true
);
197
198
logicWorld->
SetVisAttributes
(
G4VisAttributes::GetInvisible
());
199
logicGuide->
SetVisAttributes
(guideColor);
200
logicEndPlate->
SetVisAttributes
(endPlateColor);
201
202
//
203
//always return the physical World
204
//
205
return
physiWorld;
206
}
207
208
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
209
210
G4ThreadLocal
G4UniformGravityField
*
ExUCNDetectorConstruction::fField
= 0;
211
212
void
ExUCNDetectorConstruction::ConstructSDandField
()
213
{
214
if
(!
fField
) {
215
216
fField
=
new
G4UniformGravityField
();
217
218
G4RepleteEofM
* equation =
new
G4RepleteEofM
(
fField
);
219
// G4RepleteEofM* equation = new G4RepleteEofM(fField,12);
220
// G4EqGravityField* equation = new G4EqGravityField(fField);
221
222
G4FieldManager
* fieldManager
223
=
G4TransportationManager::GetTransportationManager
()->
GetFieldManager
();
224
fieldManager->
SetDetectorField
(
fField
);
225
226
G4MagIntegratorStepper
*
stepper
=
new
G4ClassicalRK4
(equation,8);
227
// G4MagIntegratorStepper* stepper = new G4ClassicalRK4(equation,12);
228
229
G4double
minStep = 0.01*
mm
;
230
231
G4ChordFinder
* chordFinder =
232
new
G4ChordFinder
((
G4MagneticField
*)
fField
,minStep,stepper);
233
234
// Set accuracy parameters
235
G4double
deltaChord = 3.0*
mm
;
236
chordFinder->
SetDeltaChord
( deltaChord );
237
238
G4double
deltaOneStep = 0.01*
mm
;
239
fieldManager->
SetAccuraciesWithDeltaOneStep
(deltaOneStep);
240
241
G4double
deltaIntersection = 0.1*
mm
;
242
fieldManager->
SetDeltaIntersection
(deltaIntersection);
243
244
G4TransportationManager
* transportManager =
245
G4TransportationManager::GetTransportationManager
();
246
247
G4PropagatorInField
* fieldPropagator =
248
transportManager->
GetPropagatorInField
();
249
250
G4double
epsMin = 2.5e-7*
mm
;
251
G4double
epsMax = 0.05*
mm
;
252
253
fieldPropagator->
SetMinimumEpsilonStep
(epsMin);
254
fieldPropagator->
SetMaximumEpsilonStep
(epsMax);
255
256
fieldManager->
SetChordFinder
(chordFinder);
257
}
258
}
259
260
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
exoticphysics
ucn
src
ExUCNDetectorConstruction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:04
using
1.8.2 with
ECCE GitHub integration