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
exampleGB06.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file exampleGB06.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
//
30
31
#include "
G4Types.hh
"
32
33
#ifdef G4MULTITHREADED
34
#include "
G4MTRunManager.hh
"
35
#else
36
#include "
G4RunManager.hh
"
37
#endif
38
#include "
GB06ActionInitialization.hh
"
39
40
#include "
G4UImanager.hh
"
41
42
#include "
GB06DetectorConstruction.hh
"
43
#include "
GB06ParallelWorldForSlices.hh
"
44
#include "
GB06PrimaryGeneratorAction.hh
"
45
46
#include "
FTFP_BERT.hh
"
47
#include "
G4GenericBiasingPhysics.hh
"
48
49
#include "
G4VisExecutive.hh
"
50
#include "
G4UIExecutive.hh
"
51
52
53
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55
namespace
{
56
void
PrintUsage() {
57
G4cerr
<<
" Usage: "
<<
G4endl
;
58
G4cerr
<<
" ./exampleGB06 [-m macro ] "
59
<<
" [-b biasing {'on','off'}]"
60
<<
"\n or\n ./exampleGB06 [macro.mac]"
61
<<
G4endl
;
62
}
63
}
64
65
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66
67
68
int
main
(
int
argc,
char
** argv)
69
{
70
// Evaluate arguments
71
//
72
if
( argc > 5 ) {
73
PrintUsage();
74
return
1;
75
}
76
77
G4String
macro(
""
);
78
G4String
onOffBiasing(
""
);
79
if
( argc == 2 ) macro = argv[1];
80
else
81
{
82
for
(
G4int
i=1; i<argc; i=i+2 )
83
{
84
if
(
G4String
(argv[i]) ==
"-m"
) macro = argv[i+1];
85
else
if
(
G4String
(argv[i]) ==
"-b"
) onOffBiasing = argv[i+1];
86
else
87
{
88
PrintUsage();
89
return
1;
90
}
91
}
92
}
93
94
if
( onOffBiasing ==
""
) onOffBiasing =
"on"
;
95
96
// Instantiate G4UIExecutive if interactive mode
97
G4UIExecutive
* ui =
nullptr
;
98
if
( macro ==
""
) {
99
ui =
new
G4UIExecutive
(argc, argv);
100
}
101
102
// -- Construct the run manager : MT or sequential one
103
#ifdef G4MULTITHREADED
104
G4MTRunManager
* runManager =
new
G4MTRunManager
;
105
G4cout
<<
" ********** Run Manager constructed in MT mode ************ "
106
<<
G4endl
;
107
// -- Choose 4 threads:
108
runManager->
SetNumberOfThreads
(4);
109
#else
110
G4RunManager
* runManager =
new
G4RunManager
;
111
G4cout
<<
" ********** Run Manager constructed in sequential mode ************ "
112
<<
G4endl
;
113
#endif
114
115
116
// -- Set mandatory initialization classes
117
118
// -- Create geometry:
119
GB06DetectorConstruction
* detector =
new
GB06DetectorConstruction
();
120
// -- Create parallel world:
121
GB06ParallelWorldForSlices
* parallelWorld =
122
new
GB06ParallelWorldForSlices
(
"parallelWorldForSlices"
);
123
// -- and "augment" detector geometry with the parallelWorld one:
124
detector->
RegisterParallelWorld
( parallelWorld );
125
runManager->
SetUserInitialization
(detector);
126
127
// -- Select a physics list:
128
FTFP_BERT
* physicsList =
new
FTFP_BERT
;
129
// -- and augment it with biasing facilities:
130
G4GenericBiasingPhysics
* biasingPhysics =
new
G4GenericBiasingPhysics
();
131
biasingPhysics->
BeVerbose
();
132
if
( onOffBiasing ==
"on"
)
133
{
134
// -- We use only the "non physics biasing" functionnality (ie, the ones which don't
135
// -- alter physics processes behavior), and hence we equipe the physics list
136
// -- accordingly:
137
biasingPhysics->
NonPhysicsBias
(
"neutron"
);
138
// -- we activate and configure the parallel geometry facility:
139
biasingPhysics->
AddParallelGeometry
(
"neutron"
,
"parallelWorldForSlices"
);
140
physicsList->
RegisterPhysics
(biasingPhysics);
141
G4cout
<<
" ********************************************************* "
142
<<
G4endl
;
143
G4cout
<<
" ********** processes are wrapped for biasing ************ "
144
<<
G4endl
;
145
G4cout
<<
" ********************************************************* "
146
<<
G4endl
;
147
}
148
else
149
{
150
G4cout
<<
" ************************************************* "
<<
G4endl
;
151
G4cout
<<
" ********** processes are not wrapped ************ "
<<
G4endl
;
152
G4cout
<<
" ************************************************* "
<<
G4endl
;
153
}
154
runManager->
SetUserInitialization
(physicsList);
155
156
// -- Action initialization:
157
runManager->
SetUserInitialization
(
new
GB06ActionInitialization
);
158
159
// Initialize G4 kernel
160
runManager->
Initialize
();
161
162
// Initialize visualization
163
G4VisManager
* visManager =
new
G4VisExecutive
;
164
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
165
visManager->
Initialize
();
166
167
// Get the pointer to the User Interface manager
168
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
169
170
if
( macro !=
""
)
// batch mode
171
{
172
G4String
command =
"/control/execute "
;
173
UImanager->
ApplyCommand
(command+macro);
174
}
175
else
176
{
// interactive mode : define UI session
177
UImanager->
ApplyCommand
(
"/control/execute vis.mac"
);
178
// if (ui->IsGUI())
179
// UImanager->ApplyCommand("/control/execute gui.mac");
180
ui->
SessionStart
();
181
delete
ui;
182
}
183
184
delete
visManager;
185
delete
runManager;
186
187
return
0;
188
}
189
190
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
geant4
tree
geant4-10.6-release
examples
extended
biasing
GB06
exampleGB06.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:02
using
1.8.2 with
ECCE GitHub integration