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
field06.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file field06.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
//
32
//
33
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35
36
#ifndef WIN32
37
#include <unistd.h>
38
#endif
39
40
#include "
G4Types.hh
"
41
42
#include "
F06PhysicsList.hh
"
43
#include "
G4Transportation.hh
"
44
45
#include "
F06DetectorConstruction.hh
"
46
#include "
F06ActionInitialization.hh
"
47
48
#ifdef G4MULTITHREADED
49
#include "
G4MTRunManager.hh
"
50
#else
51
#include "
G4RunManager.hh
"
52
#endif
53
54
#include "
G4UImanager.hh
"
55
#include "
G4UIcommand.hh
"
56
57
#include "
Randomize.hh
"
58
59
#include "
G4VisExecutive.hh
"
60
#include "
G4UIExecutive.hh
"
61
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
namespace
{
64
void
PrintUsage() {
65
G4cerr
<<
" Usage: "
<<
G4endl
;
66
G4cerr
<<
" field06 [-m macro ] [-u UIsession] [-t nThreads] [-r randomSeed] "
67
<<
G4endl
;
68
G4cerr
<<
" note: -t option is available only for multi-threaded mode."
69
<<
G4endl
;
70
}
71
}
72
73
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74
75
int
main
(
int
argc,
char
** argv)
76
{
77
// Evaluate arguments
78
//
79
if
( argc > 9 ) {
80
PrintUsage();
81
return
1;
82
}
83
84
G4String
macro;
85
G4String
session
;
86
#ifdef G4MULTITHREADED
87
G4int
nThreads = 0;
88
#endif
89
90
G4long
randomSeed = 1234;
91
for
(
G4int
i=1; i<argc; i=i+2 ) {
92
if
(
G4String
(argv[i]) ==
"-m"
) macro = argv[i+1];
93
else
if
(
G4String
(argv[i]) ==
"-u"
) session = argv[i+1];
94
else
if
(
G4String
(argv[i]) ==
"-r"
) randomSeed = atoi(argv[i+1]);
95
#ifdef G4MULTITHREADED
96
else
if
(
G4String
(argv[i]) ==
"-t"
) {
97
nThreads =
G4UIcommand::ConvertToInt
(argv[i+1]);
98
}
99
#endif
100
else
{
101
PrintUsage();
102
return
1;
103
}
104
}
105
106
// Instantiate G4UIExecutive for interactive mode
107
G4UIExecutive
* ui =
nullptr
;
108
if
( macro.size() == 0 ) {
109
ui =
new
G4UIExecutive
(argc, argv, session);
110
}
111
112
// Choose the Random engine
113
//
114
G4Random::setTheEngine(
new
CLHEP::RanecuEngine
);
115
116
// Construct the default run manager
117
//
118
#ifdef G4MULTITHREADED
119
G4MTRunManager
* runManager =
new
G4MTRunManager
;
120
if
( nThreads > 0 ) runManager->
SetNumberOfThreads
(nThreads);
121
#else
122
G4RunManager
* runManager =
new
G4RunManager
;
123
#endif
124
125
// Seed the random number generator manually
126
G4Random::setTheSeed(randomSeed);
127
128
// Set mandatory initialization classes
129
//
130
// Detector construction
131
runManager->
SetUserInitialization
(
new
F06DetectorConstruction
());
132
// Physics list
133
runManager->
SetUserInitialization
(
new
F06PhysicsList
());
134
135
// Ensure that Transportation considers gravity fields.
136
G4Transportation::EnableGravity
(
true
);
137
138
// User action initialization
139
runManager->
SetUserInitialization
(
new
F06ActionInitialization
());
140
141
// Initialize visualization
142
//
143
G4VisManager
* visManager =
new
G4VisExecutive
;
144
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
145
// G4VisManager* visManager = new G4VisExecutive("Quiet");
146
visManager->
Initialize
();
147
148
// Get the pointer to the User Interface manager
149
//
150
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
151
152
if
( !ui ) {
153
// batch mode
154
G4String
command =
"/control/execute "
;
155
UImanager->
ApplyCommand
(command+macro);
156
}
157
else
158
{
159
UImanager->
ApplyCommand
(
"/control/execute init_vis.mac"
);
160
if
(ui->
IsGUI
())
161
UImanager->
ApplyCommand
(
"/control/execute gui.mac"
);
162
ui->
SessionStart
();
163
delete
ui;
164
}
165
166
// Job termination
167
// Free the store: user actions, physics_list and detector_description are
168
// owned and deleted by the run manager, so they should not
169
// be deleted in the main() program !
170
171
delete
visManager;
172
delete
runManager;
173
174
return
0;
175
}
176
177
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
field
field06
field06.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:05
using
1.8.2 with
ECCE GitHub integration