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
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
//
26
// This example is provided by the Geant4-DNA collaboration
27
// Any report or published results obtained using the Geant4-DNA software
28
// shall cite the following Geant4-DNA collaboration publication:
29
// Med. Phys. 37 (2010) 4692-4708
30
// The Geant4-DNA web site is available at http://geant4-dna.org
31
//
34
35
#include "DetectorConstruction.hh"
36
37
#include "
G4SystemOfUnits.hh
"
38
#include "
G4Region.hh
"
39
#include "
G4ProductionCuts.hh
"
40
41
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42
43
DetectorConstruction::DetectorConstruction
()
44
:
G4VUserDetectorConstruction
(),
45
fpWaterMaterial(0),fpRegion(0)
46
{}
47
48
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49
50
DetectorConstruction::~DetectorConstruction
()
51
{}
52
53
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55
G4VPhysicalVolume
*
DetectorConstruction::Construct
()
56
57
{
58
DefineMaterials
();
59
return
ConstructDetector
();
60
}
61
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
64
void
DetectorConstruction::DefineMaterials
()
65
{
66
67
// Water is defined from NIST material database
68
G4NistManager
* man =
G4NistManager::Instance
();
69
G4Material
* H2O = man->
FindOrBuildMaterial
(
"G4_WATER"
);
70
71
// Default materials in setup.
72
fpWaterMaterial
= H2O;
73
74
}
75
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78
G4VPhysicalVolume
*
DetectorConstruction::ConstructDetector
()
79
{
80
// WORLD VOLUME
81
82
G4double
worldSizeX
= 1*
mm
;
83
G4double
worldSizeY = 1*
mm
;
84
G4double
worldSizeZ = 1*
mm
;
85
86
G4VSolid
* solidWorld =
new
G4Box
(
"World"
,
//its name
87
worldSizeX/2,
88
worldSizeY/2,
89
worldSizeZ/2);
//its size
90
91
G4LogicalVolume
* logicWorld =
new
G4LogicalVolume
(solidWorld,
//its solid
92
fpWaterMaterial
,
//its material
93
"World"
);
//its name
94
95
G4VPhysicalVolume
* physiWorld =
new
G4PVPlacement
(0,
//no rotation
96
G4ThreeVector
(),
//at (0,0,0)
97
"World"
,
//its name
98
logicWorld,
//its logical volume
99
0,
//its mother volume
100
false
,
//no boolean operation
101
0);
//copy number
102
103
G4double
TargetSizeZ = worldSizeZ*0.05;
104
105
G4Box
* targetSolid =
new
G4Box
(
"Target"
,
//its name
106
worldSizeX/2,
107
worldSizeY/2,
108
TargetSizeZ/2);
//its size
109
110
G4LogicalVolume
* logicTarget =
111
new
G4LogicalVolume
(targetSolid,
//its solid
112
fpWaterMaterial
,
//its material
113
"Target"
);
//its name
114
115
new
G4PVPlacement
(0,
//no rotation
116
G4ThreeVector
(),
//at (0,0,0)
117
"Target"
,
//its name
118
logicTarget,
//its logical volume
119
physiWorld,
//its mother volume
120
false
,
//no boolean operation
121
0);
//copy number
122
123
// Visualization attributes
124
125
G4VisAttributes
* worldVisAtt =
126
new
G4VisAttributes
(
G4Colour
(1.0,1.0,1.0));
//White
127
worldVisAtt->
SetVisibility
(
true
);
128
logicWorld->
SetVisAttributes
(worldVisAtt);
129
130
G4VisAttributes
* worldVisAtt1 =
new
G4VisAttributes
(
G4Colour
(1.0,0.0,0.0));
131
worldVisAtt1->
SetVisibility
(
true
);
132
logicTarget->
SetVisAttributes
(worldVisAtt1);
133
134
// Create Target G4Region and add logical volume
135
136
fpRegion
=
new
G4Region
(
"Target"
);
137
138
G4ProductionCuts
* cuts =
new
G4ProductionCuts
();
139
140
G4double
defCut = 1*
nanometer
;
141
cuts->
SetProductionCut
(defCut,
"gamma"
);
142
cuts->
SetProductionCut
(defCut,
"e-"
);
143
cuts->
SetProductionCut
(defCut,
"e+"
);
144
cuts->
SetProductionCut
(defCut,
"proton"
);
145
146
fpRegion
->
SetProductionCuts
(cuts);
147
fpRegion
->
AddRootLogicalVolume
(logicTarget);
148
149
return
physiWorld;
150
}
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
microdosimetry
src
DetectorConstruction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:49
using
1.8.2 with
ECCE GitHub integration