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
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
tree
geant4-10.6-release
config
environments
examples
advanced
basic
extended
analysis
biasing
common
electromagnetic
errorpropagation
eventgenerator
exoticphysics
field
g3tog4
geometry
hadronic
medical
DICOM
DICOM2
dna
chem1
chem2
chem3
chem4
chem5
clustering
dnadamage1
dnaphysics
icsd
mfp
microdosimetry
microprox
microyz
neuron
pdb4dna
range
slowing
splitting
include
src
ActionInitialization.cc
DetectorConstruction.cc
DetectorMessenger.cc
EventAction.cc
G4ElectronCapture.cc
HistoManager.cc
PhysicsList.cc
PrimaryGeneratorAction.cc
RunAction.cc
RunInitObserver.cc
SplitProcess.cc
SteppingAction.cc
TrackingAction.cc
UserTrackInformation.cc
plot.C
splitting.cc
spower
svalue
wholeNuclearDNA
wvalue
electronScattering
electronScattering2
fanoCavity
fanoCavity2
GammaTherapy
optical
parallel
parameterisations
persistency
physicslists
polarisation
radioactivedecay
runAndEvent
visualization
source
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
DetectorConstruction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DetectorConstruction.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
//
28
29
#include "DetectorConstruction.hh"
30
31
#include "DetectorMessenger.hh"
32
33
#include "
G4Box.hh
"
34
#include "
G4Colour.hh
"
35
#include "
G4LogicalVolume.hh
"
36
#include "
G4Material.hh
"
37
#include "
G4NistManager.hh
"
38
#include "
G4PVPlacement.hh
"
39
#include "
G4SystemOfUnits.hh
"
40
#include "
G4Tubs.hh
"
41
#include "
G4VisAttributes.hh
"
42
#include "
G4Region.hh
"
43
#include "
G4RegionStore.hh
"
44
#include "
G4PhysicalVolumeStore.hh
"
45
#include "
G4LogicalVolumeStore.hh
"
46
#include "
G4GeometryManager.hh
"
47
#include "
G4SolidStore.hh
"
48
49
#include "
G4RunManager.hh
"
50
51
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52
53
DetectorConstruction::DetectorConstruction
()
54
:
G4VUserDetectorConstruction
(), fDiameter(6*
nm
), fLength(10*
nm
)
55
{
56
fDetectorMessenger
=
new
DetectorMessenger
(
this
);
57
}
58
59
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
61
DetectorConstruction::~DetectorConstruction
()
62
{
63
delete
fDetectorMessenger
;
64
}
65
66
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
G4VPhysicalVolume
*
DetectorConstruction::Construct
() {
68
return
ConstructVolumes
();
69
}
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72
73
G4VPhysicalVolume
*
DetectorConstruction::ConstructVolumes
()
74
{
75
// Cleanup old geometry
76
//
77
G4GeometryManager::GetInstance
()->
OpenGeometry
();
78
G4PhysicalVolumeStore::GetInstance
()->
Clean
();
79
G4LogicalVolumeStore::GetInstance
()->
Clean
();
80
G4SolidStore::GetInstance
()->
Clean
();
81
82
//
83
G4Material
* water =
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_WATER"
);
84
85
// Geometry parameters
86
G4double
worldSize = 150 *
nanometer
;
87
88
G4VSolid
*
world
=
new
G4Box
(
"world"
,
// its name
89
worldSize/2, worldSize/2, worldSize/2);
// its size
90
91
G4LogicalVolume
* worldLog =
new
G4LogicalVolume
(
92
world,
// its solid
93
water,
// its material
94
"world"
);
// its name
95
96
G4VisAttributes
*vis =
new
G4VisAttributes
(
G4Colour
(
G4Colour::Blue
()));
97
worldLog->
SetVisAttributes
(vis);
98
99
G4VPhysicalVolume
* worldPhys =
new
G4PVPlacement
(
100
0,
// no rotation
101
G4ThreeVector
(),
// at (0,0,0)
102
worldLog,
// its logical volume
103
"world"
,
// its name
104
0,
// its mother volume
105
false
,
// no boolean operation
106
0,
// copy number
107
true
);
// checking overlaps forced to YES
108
109
G4VSolid
*
target
=
new
G4Tubs
(
"target"
,
110
0,
fDiameter
/2,
fLength
/2, 0, 360*
deg
);
//its size
111
112
G4LogicalVolume
* targetLog =
new
G4LogicalVolume
(
113
target,
114
water,
115
"target"
);
116
117
new
G4PVPlacement
(0,
// no rotation
118
G4ThreeVector
(),
// at (0,0,0)
119
targetLog,
// its logical volume
120
"target"
,
// its name
121
worldLog,
// its mother volume
122
false
,
// no boolean operation
123
0,
// copy number
124
true
);
// checking overlaps force to YES
125
126
// A region is needed as splitting is performed in regions
127
G4Region
* aRegion =
G4RegionStore::GetInstance
()->
FindOrCreateRegion
(
"Target"
);
128
targetLog->
SetRegion
(aRegion);
129
aRegion->
AddRootLogicalVolume
(targetLog);
130
131
G4VisAttributes
*visTarget =
new
G4VisAttributes
(
G4Colour
(
G4Colour::Blue
()));
132
visTarget->
SetForceSolid
(
true
);
133
visTarget->
SetVisibility
(
true
);
134
targetLog->
SetVisAttributes
(visTarget);
135
136
return
worldPhys;
137
}
138
139
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140
141
void
DetectorConstruction::SetDiameter
(
G4double
diameter) {
142
fDiameter
= diameter;
143
G4RunManager::GetRunManager
()->
GeometryHasBeenModified
();
144
}
145
146
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147
148
void
DetectorConstruction::SetLength
(
G4double
length
) {
149
fLength
=
length
;
150
G4RunManager::GetRunManager
()->
GeometryHasBeenModified
();
151
}
152
153
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
154
155
#include "
G4RunManager.hh
"
156
157
void
DetectorConstruction::UpdateGeometry
()
158
{
159
G4RunManager::GetRunManager
()->
DefineWorldVolume
(
ConstructVolumes
());
160
}
161
162
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
splitting
src
DetectorConstruction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:49
using
1.8.2 with
ECCE GitHub integration