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
pdb4dna.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file pdb4dna.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
// Delage et al. PDB4DNA: implementation of DNA geometry from the Protein Data
31
// Bank (PDB) description for Geant4-DNA Monte-Carlo
32
// simulations (submitted to Comput. Phys. Commun.)
33
// The Geant4-DNA web site is available at http://geant4-dna.org
34
//
35
//
38
39
#include "DetectorConstruction.hh"
40
#include "PhysicsList.hh"
41
#include "ActionInitialization.hh"
42
43
#ifdef G4MULTITHREADED
44
#include "
G4MTRunManager.hh
"
45
#else
46
#include "
G4RunManager.hh
"
47
#endif
48
49
#include "
G4UImanager.hh
"
50
#include "
Randomize.hh
"
51
#include "
G4VisExecutive.hh
"
52
#include "
G4UIExecutive.hh
"
53
#ifdef G4UI_USE_QT
54
#include "
G4UIQt.hh
"
55
#endif
56
#include "CommandLineParser.hh"
57
58
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
60
using namespace
G4DNAPARSER;
61
CommandLineParser
*
parser
(0);
62
63
void
Parse
(
int
& argc,
char
** argv);
64
65
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66
67
int
main
(
int
argc,
char
** argv)
68
{
70
// Parse options given in commandLine
71
//
72
Parse
(argc, argv);
73
75
// Construct the run manager according to whether MT is activated or not
76
//
77
Command
* commandLine(0);
78
79
#ifdef G4MULTITHREADED
80
G4MTRunManager
* runManager=
new
G4MTRunManager
;
81
if
((commandLine =
parser
->
GetCommandIfActive
(
"-mt"
)))
82
{
83
int
nThreads = 2;
84
if
(commandLine->
GetOption
() ==
"NMAX"
)
85
{
86
nThreads =
G4Threading::G4GetNumberOfCores
();
87
}
88
else
89
{
90
nThreads =
G4UIcommand::ConvertToInt
(commandLine->
GetOption
());
91
}
92
G4cout
<<
"===== PDB4DNA is started with "
93
<< runManager->
GetNumberOfThreads
()
94
<<
" threads ====="
<<
G4endl
;
95
96
runManager->
SetNumberOfThreads
(nThreads);
97
}
98
#else
99
G4RunManager
* runManager =
new
G4RunManager
();
100
#endif
101
102
// Set user classes
103
//
104
runManager->
SetUserInitialization
(
new
DetectorConstruction
());
105
runManager->
SetUserInitialization
(
new
PhysicsList
);
106
runManager->
SetUserInitialization
(
new
ActionInitialization
());
107
108
// Initialize G4 keRnel
109
//
110
// runManager->Initialize();
111
112
// Initialize visualization
113
G4VisManager
* visManager =
new
G4VisExecutive
;
114
visManager->
Initialize
();
115
116
// Get the pointer to the User Interface manager
117
G4UImanager
* UImanager =
G4UImanager::GetUIpointer
();
118
G4UIExecutive
* ui(0);
119
120
// interactive mode : define UI session
121
if
((commandLine =
parser
->
GetCommandIfActive
(
"-gui"
)))
122
{
123
ui =
new
G4UIExecutive
(argc, argv,
124
commandLine->
GetOption
());
125
126
if
(
parser
->
GetCommandIfActive
(
"-novis"
) == 0)
127
// visualization is used by default
128
{
129
if
((commandLine =
parser
->
GetCommandIfActive
(
"-vis"
)))
130
// select a visualization driver if needed (e.g. HepFile)
131
{
132
UImanager->
ApplyCommand
(
G4String
(
"/vis/open "
)+
133
commandLine->
GetOption
());
134
}
135
else
136
// by default OGL is used
137
{
138
UImanager->
ApplyCommand
(
"/vis/open OGL 600x600-0+0"
);
139
}
140
UImanager->
ApplyCommand
(
"/control/execute vis.mac"
);
141
}
142
if
(ui->
IsGUI
())
143
UImanager->
ApplyCommand
(
"/control/execute gui.mac"
);
144
}
145
else
146
// to be use visualization file (= store the visualization into
147
// an external file:
148
// ASCIITree ; DAWNFILE ; HepRepFile ; VRML(1,2)FILE ; gMocrenFile ...
149
{
150
if
((commandLine =
parser
->
GetCommandIfActive
(
"-vis"
)))
151
{
152
UImanager->
ApplyCommand
(
G4String
(
"/vis/open "
)+
153
commandLine->
GetOption
());
154
UImanager->
ApplyCommand
(
"/control/execute vis.mac"
);
155
}
156
}
157
158
if
((commandLine =
parser
->
GetCommandIfActive
(
"-mac"
)))
159
{
160
G4String
command =
"/control/execute "
;
161
UImanager->
ApplyCommand
(command + commandLine->
GetOption
());
162
}
163
else
164
{
165
UImanager->
ApplyCommand
(
"/control/execute init.mac"
);
166
}
167
168
if
((commandLine =
parser
->
GetCommandIfActive
(
"-gui"
)))
169
{
170
#ifdef G4UI_USE_QT
171
G4UIQt* UIQt =
static_cast<
G4UIQt*
>
(UImanager->
GetG4UIWindow
());
172
if
( UIQt) {
173
UIQt->AddViewerTabFromFile(
"README"
,
"README from "
+
G4String
(argv[0]));
174
}
175
#endif
176
ui->
SessionStart
();
177
delete
ui;
178
}
179
180
// Job termination
181
delete
visManager;
182
delete
runManager;
183
184
return
0;
185
}
186
187
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
188
189
void
Parse
(
int
& argc,
char
** argv)
190
{
192
// Parse options given in commandLine
193
//
194
parser
=
CommandLineParser::GetParser
();
195
196
parser
->
AddCommand
(
"-gui"
,
197
Command::OptionNotCompulsory
,
198
"Select geant4 UI or just launch a geant4 terminal session"
,
199
"qt"
);
200
201
parser
->
AddCommand
(
"-mac"
,
202
Command::WithOption
,
203
"Give a mac file to execute"
,
204
"pdb4dna.in"
);
205
206
// You cann your own command, as for instance:
207
// parser->AddCommand("-seed",
208
// Command::WithOption,
209
// "Give a seed value in argument to be tested", "seed");
210
// it is then up to you to manage this option
211
212
#ifdef G4MULTITHREADED
213
parser
->
AddCommand
(
"-mt"
,
Command::WithOption
,
214
"Launch in MT mode (events computed in parallel)"
,
215
"2"
);
216
#endif
217
218
parser
->
AddCommand
(
"-vis"
,
219
Command::WithOption
,
220
"Select a visualization driver"
,
221
"OGL 600x600-0+0"
);
222
223
parser
->
AddCommand
(
"-novis"
,
224
Command::WithoutOption
,
225
"Deactivate visualization when using GUI"
);
226
228
// If -h or --help is given in option : print help and exit
229
//
230
if
(
parser
->
Parse
(argc, argv) != 0)
// help is being printed
231
{
232
// if you are using ROOT, create a TApplication in this condition in order
233
// to print the help from ROOT as well
234
CommandLineParser::DeleteInstance
();
235
std::exit
(0);
236
}
237
239
// Kill application if wrong argument in command line
240
//
241
if
(
parser
->
CheckIfNotHandledOptionsExists
(argc, argv))
242
{
243
// if you are using ROOT, you should initialise your TApplication
244
// before this condition
245
abort();
246
}
247
}
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
pdb4dna
pdb4dna.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:08
using
1.8.2 with
ECCE GitHub integration