60 goptions.defineSwitch(
"log",
"a switch, this is just an example.");
63 help =
"Example: -runno=12\n";
67 help =
"Maximum number of threads to use.\n";
68 help +=
"If the number of cores available ncores is less then nthreads, use ncores instead.\n";
69 help +=
"If not set, use all available threads. 0: use all threads\n";
70 help +=
"Example: -nthreads=12 : . \n";
71 goptions.defineOption(
GVariable(
"nthreads", 0,
"maximum number of threads to use"), help);
75 {
"multiplicity", 1,
"number of particles per event"},
77 {
"theta",
"0*degrees",
"polar angle"},
78 {
"delta_theta", 0,
"Particle polar angle range, centered on theta. Default: 0"},
81 help =
"Example to add three particles, one electron and two protons, identical except spread in theta : \n \n";
83 "-gparticle=\"[{pname: e-, p: 2300, theta: 23.0}, {pname: proton, multiplicity: 2, p: 1200, delta_theta: 10}]\"\n";
84 goptions.defineOption(
"gparticle",
"define the generator particle(s)",
gparticle, help);
116int main(
int argc,
char* argv[]) {
118 auto gopts = std::make_shared<GOptions>(argc, argv,
defineOptions());
121 cout <<
" > Nthreads: " << gopts->getScalarInt(
"nthreads") << endl;
Parses, stores, and exposes command-line options and YAML configuration values.
GOptions defineOptions()
Builds and returns a set of example options (definitions only).
Public interface for GOptions : the YAML + command-line configuration manager.
const std::string NODFLT
Marker literal indicating "no default value" for a structured option key.
int main(int argc, char *argv[])
Describes a schema entry: key name, default value, and user-facing description.