1#ifndef DOXYGEN_SHOULD_SKIP_THIS
18 goptions.defineSwitch(
"log",
"a switch, this is just an example.");
21 help =
"Example: -runno=12\n";
25 help =
"Maximum number of threads to use.\n";
26 help +=
"If the number of cores available ncores is less then nthreads, use ncores instead.\n";
27 help +=
"If not set, use all available threads. 0: use all threads\n";
28 help +=
"Example: -nthreads=12 : . \n";
29 goptions.defineOption(
GVariable(
"nthreads", 0,
"maximum number of threads to use"), help);
31 vector <GVariable> gparticle = {
33 {
"multiplicity", 1,
"number of particles per event"},
35 {
"theta",
"0*degrees",
"polar angle"},
36 {
"delta_theta", 0,
"Particle polar angle range, centered on theta. Default: 0"},
40 help =
"Example to add three particles, one electron and two protons, identical except spread in theta: \n \n";
41 help +=
"-gparticle=\"[{pname: e-, multiplicity: 1, p: 2300, theta: 23.0}, {pname: proton, multiplicity: 2, p: 1200, theta: 14.0, delta_theta: 10}]\"\n";
42 goptions.defineOption(
"gparticle",
"define the generator particle(s)", gparticle, help);
48int main(
int argc,
char *argv[]) {
50 auto gopts = std::make_shared<GOptions>(argc, argv, defineOptions());
52 cout <<
" > Nthreads: " << gopts->getScalarInt(
"nthreads") << endl;
The GOptions class manages command-line options and switches.
Encapsulates a variable with a name, value, and description.