VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
tests
listPLOptions.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 2025 Ivana Hrivnacova
4
// All rights reserved.
5
//
6
// For the licensing terms see geant4_vmc/LICENSE.
7
// Contact: root-vmc@cern.ch
8
//-------------------------------------------------
9
10
/// \file listPLOptions.cxx
11
/// \brief Print available base physics lists and EM options
12
///
13
/// Usage:
14
/// <pre>
15
/// ./listPLOptions [-b base lists ] [-em em options ] [-v verbose]
16
/// -b list available base physics lists
17
/// -em list available EM options
18
// -v precede lists with a title
19
/// </pre>
20
///
21
/// \date 20/01/2025
22
/// \author I. Hrivnacova; IJCLab, Orsay
23
24
#include "G4PhysListFactory.hh"
25
#include "G4String.hh"
26
#include "G4ios.hh"
27
28
#include <vector>
29
30
namespace
31
{
32
33
void
PrintUsage()
34
{
35
G4cerr <<
" Usage: "
<< G4endl
36
<<
" listPLOptions [-b] [-em] [-v]"
<< G4endl
37
<<
" -b list available base physics lists"
<< G4endl
38
<<
" -em list available EM options"
<< G4endl
39
<<
" -v precede lists with a title"
<< G4endl;
40
}
41
42
void
PrintNameList(
const
std::vector<G4String>& nameList)
43
{
44
for
(
auto
name : nameList) {
45
G4cout << name <<
" "
;
46
}
47
G4cout << G4endl;
48
}
49
50
}
// namespace
51
52
int
main
(
int
argc,
char
** argv)
53
{
54
// Evaluate arguments
55
//
56
if
(argc > 5) {
57
PrintUsage();
58
return
1;
59
}
60
61
G4bool baseLists =
false
;;
62
G4bool emOptions =
false
;
63
G4bool
verbose
=
false
;
64
for
(G4int i = 1; i < argc; ++i) {
65
if
(G4String(argv[i]) ==
"-b"
)
66
baseLists =
true
;
67
else
if
(G4String(argv[i]) ==
"-em"
)
68
emOptions =
true
;
69
else
if
(G4String(argv[i]) ==
"-v"
)
70
verbose
=
true
;
71
else
{
72
PrintUsage();
73
return
1;
74
}
75
}
76
77
if
( (! baseLists) && (! emOptions) ) {
78
PrintUsage();
79
return
1;
80
}
81
82
// Physics list factory
83
G4PhysListFactory factory;
84
85
if
(baseLists) {
86
if
(
verbose
) {
87
G4cout <<
"Base physics lists: "
;
88
}
89
PrintNameList(factory.AvailablePhysLists());
90
}
91
92
if
(emOptions) {
93
if
(
verbose
) {
94
G4cout <<
"EM Options: "
;
95
}
96
PrintNameList(factory.AvailablePhysListsEM());
97
}
98
}
main
int main(int argc, char **argv)
Definition
listPLOptions.cxx:52
verbose
std::string verbose
Definition
testE03c.cxx:75
Generated on
for VMC Examples by
1.17.0