Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:51

0001 #ifndef ATOOLS_Org_Command_Line_Options_H
0002 #define ATOOLS_Org_Command_Line_Options_H
0003 
0004 #include "ATOOLS/Org/Option_Parser.H"
0005 
0006 // NOTE: to add an option, declare it in the `optionIndex' enum, define it in
0007 // the `usage' array below, and define its mapping to a Sherpa parameter in the
0008 // `create_parameter_index_map' function below
0009 
0010 /// declaration of command line options
0011 enum optionIndex {
0012   // special options
0013   UNKNOWN,
0014   HELP,
0015   VERSION,
0016   CMDLINE_DEBUG,
0017 
0018   // options that will be mapped to SHERPA parameters
0019   RUNDATA,
0020   PATH,
0021   EVENTS,
0022   EVENT_TYPE,
0023   RESULT_DIRECTORY,
0024   SHERPA_CPP_PATH,
0025   RANDOM_SEED,
0026   ME_GENERATORS,
0027   MI_HANDLER,
0028   EVENT_GENERATION_MODE,
0029   SHOWER_GENERATOR,
0030   FRAGMENTATION,
0031   ANALYSIS,
0032   ANALYSIS_OUTPUT,
0033   OUTPUT,
0034   EVT_OUTPUT,
0035   MSG_LIMIT,
0036   LOG_FILE,
0037 
0038   // options used to enable/disable features
0039   BATCH_MODE,
0040   INIT_ONLY,
0041   GENERATE_RESULT_DIRECTORY,
0042   PRINT_VERSION_INFO
0043 };
0044 
0045 /// declaration of command line option types
0046 enum optionType  {REGULAR, DISABLE, ENABLE};
0047 
0048 /// actual definition of command line arguments and usage output
0049 const ATOOLS::Option_Parser::Descriptor usage[] = {
0050   {
0051     UNKNOWN,
0052     REGULAR,
0053     "",
0054     "",
0055     ATOOLS::Option_Parser::Arg::None,
0056     "USAGE: Sherpa [options] ['<parameter>: <value>'] ['TAGS: {<tag>: <value>}'] [Sherpa.yaml]\n\nOptions:"
0057   },
0058   {
0059     HELP,
0060     REGULAR,
0061     "h",
0062     "help",
0063     ATOOLS::Option_Parser::Arg::None,
0064     "  --help, -h  \tPrint usage and exit."
0065   },
0066   {
0067     VERSION,
0068     REGULAR,
0069     "v",
0070     "version",
0071     ATOOLS::Option_Parser::Arg::None,
0072     "  --version, -v  \tPrint version and exit."
0073   },
0074   {
0075     CMDLINE_DEBUG,
0076     REGULAR,
0077     "c",
0078     "cmdline-debug",
0079     ATOOLS::Option_Parser::Arg::None,
0080     "  --cmdline-debug, -c  \tPrint command line after parsing to YAML and exit."
0081   },
0082   {
0083     RUNDATA,
0084     REGULAR,
0085     "f",
0086     "run-data",
0087     ATOOLS::Option_Parser::Arg::Required,
0088     "  --run-data, -f <file>  \tRead run data from <file>. [DEPRECATED, use positional arguments instead]"
0089   },
0090   {
0091     PATH,
0092     REGULAR,
0093     "p",
0094     "path",
0095     ATOOLS::Option_Parser::Arg::Required,
0096     "  --path, -p <path>  \tRead run data in <path>."
0097   },
0098   {
0099     EVENTS,
0100     REGULAR,
0101     "e",
0102     "events",
0103     ATOOLS::Option_Parser::Arg::Required,
0104     "  --events, -e <N_events>  \tSet number of events <N_events>."
0105   },
0106   {
0107     EVENT_TYPE,
0108     REGULAR,
0109     "e",
0110     "event-type",
0111     ATOOLS::Option_Parser::Arg::Required,
0112     "  --event-type, -t <event_type>  \tSet event type <event_type>."
0113   },
0114   {
0115     RESULT_DIRECTORY,
0116     REGULAR,
0117     "r",
0118     "result-directory",
0119     ATOOLS::Option_Parser::Arg::Required,
0120     "  --result-directory, -r <path>  \tSet result directory <path>."
0121   },
0122   {
0123     SHERPA_CPP_PATH,
0124     REGULAR,
0125     "L",
0126     "sherpa-lib-path",
0127     ATOOLS::Option_Parser::Arg::Required,
0128     "  --sherpa-lib-path, -L <path>  \tSet <path> for dynamically created C++ libs."
0129   },
0130   {
0131     RANDOM_SEED,
0132     REGULAR,
0133     "R",
0134     "random-seed",
0135     ATOOLS::Option_Parser::Arg::Required,
0136     "  --random-seed, -R <seed(s)>  \tSet random <seed(s)>."
0137   },
0138   {
0139     ME_GENERATORS,
0140     REGULAR,
0141     "m",
0142     "me-generators",
0143     ATOOLS::Option_Parser::Arg::Required,
0144     "  --me-generators, -m <generator>  \tSet matrix element <generator>."
0145   },
0146   {
0147     MI_HANDLER,
0148     REGULAR,
0149     "M",
0150     "mi-handler",
0151     ATOOLS::Option_Parser::Arg::Required,
0152     "  --mi-handler, -M <handler>  \tSet multiple interaction <handler>."
0153   },
0154   {
0155     EVENT_GENERATION_MODE,
0156     REGULAR,
0157     "w",
0158     "event-generation-mode",
0159     ATOOLS::Option_Parser::Arg::Required,
0160     "  --event-generation-mode, -w <mode>  \tSet event generation <mode>."
0161   },
0162   {
0163     SHOWER_GENERATOR,
0164     REGULAR,
0165     "s",
0166     "shower-generator",
0167     ATOOLS::Option_Parser::Arg::Required,
0168     "  --shower-generator, -s <generator>  \tSet parton-shower <generator>."
0169   },
0170   {
0171     FRAGMENTATION,
0172     REGULAR,
0173     "F",
0174     "fragmentation",
0175     ATOOLS::Option_Parser::Arg::Required,
0176     "  --fragmentation, -F <module>  \tSet fragmentation <module>."
0177   },
0178   {
0179     ANALYSIS,
0180     REGULAR,
0181     "a",
0182     "analyis",
0183     ATOOLS::Option_Parser::Arg::Required,
0184     "  --analyis, -a <handler>  \tSet the analysis <handler>."
0185   },
0186   {
0187     ANALYSIS_OUTPUT,
0188     REGULAR,
0189     "A",
0190     "analyis-output",
0191     ATOOLS::Option_Parser::Arg::Required,
0192     "  --analyis-output, -A <path>  \tSet the analysis output <path>."
0193   },
0194   {
0195     OUTPUT,
0196     REGULAR,
0197     "O",
0198     "output",
0199     ATOOLS::Option_Parser::Arg::Required,
0200     "  --output, -O <level>  \tSet the output <level>."
0201   },
0202   {
0203     EVT_OUTPUT,
0204     REGULAR,
0205     "o",
0206     "event-output",
0207     ATOOLS::Option_Parser::Arg::Required,
0208     "  --event-output, -o <level>  \tSet the event output <level>."
0209   },
0210   {
0211     MSG_LIMIT,
0212     REGULAR,
0213     "W",
0214     "msg-limit",
0215     ATOOLS::Option_Parser::Arg::Required,
0216     "  --msg-limit, -W <n>  \tSet number of warnings emitted before silencing them."
0217   },
0218   {
0219     LOG_FILE,
0220     REGULAR,
0221     "l",
0222     "log-file",
0223     ATOOLS::Option_Parser::Arg::Required,
0224     "  --log-file, -l <file>  \tSet the log <file>."
0225   },
0226   {
0227     BATCH_MODE,
0228     DISABLE,
0229     "b",
0230     "disable-batch-mode",
0231     ATOOLS::Option_Parser::Arg::None,
0232     "  --disable-batch-mode, -b  \tDisable batch mode."
0233   },
0234   {
0235     INIT_ONLY,
0236     ENABLE,
0237     "I",
0238     "enable-init-only",
0239     ATOOLS::Option_Parser::Arg::None,
0240     "  --enable-init-only, -I  \tExit after completing initialisation."
0241   },
0242   {
0243     GENERATE_RESULT_DIRECTORY,
0244     DISABLE,
0245     "g",
0246     "disable-result-directory-generation",
0247     ATOOLS::Option_Parser::Arg::None,
0248     "  --disable-result-directory-generation, -g  \tDisable result directory generation."
0249   },
0250   {
0251     PRINT_VERSION_INFO,
0252     ENABLE,
0253     "V",
0254     "print-version-info",
0255     ATOOLS::Option_Parser::Arg::None,
0256     "  --print-version-info, -V  \tPrint version info during runtime."
0257   },
0258   {
0259     UNKNOWN,
0260     REGULAR,
0261     "",
0262     "",
0263     ATOOLS::Option_Parser::Arg::None,
0264     "\nExamples:\n"
0265     "  Sherpa -e 1k\n"
0266     "  Sherpa -w Unweighted MySherpaConfig.yaml\n"
0267   },
0268   {0, 0, 0, 0, 0, 0}
0269 };
0270 
0271 // mapping from parameter names to option indizes
0272 typedef std::map<std::string, optionIndex> String_Option_Map;
0273 String_Option_Map create_parameter_index_map() {
0274   static String_Option_Map map;
0275   if (map.size() == 0) {
0276     map["RUNDATA"]                   = RUNDATA;
0277     map["PATH"]                      = PATH;
0278     map["EVENTS"]                    = EVENTS;
0279     map["EVENT_TYPE"]                = EVENT_TYPE;
0280     map["RESULT_DIRECTORY"]          = RESULT_DIRECTORY;
0281     map["SHERPA_CPP_PATH"]           = SHERPA_CPP_PATH;
0282     map["RANDOM_SEED"]               = RANDOM_SEED;
0283     map["ME_GENERATORS"]             = ME_GENERATORS;
0284     map["MI_HANDLER"]                = MI_HANDLER;
0285     map["EVENT_GENERATION_MODE"]     = EVENT_GENERATION_MODE;
0286     map["SHOWER_GENERATOR"]          = SHOWER_GENERATOR;
0287     map["FRAGMENTATION"]             = FRAGMENTATION;
0288     map["ANALYSIS"]                  = ANALYSIS;
0289     map["ANALYSIS_OUTPUT"]           = ANALYSIS_OUTPUT;
0290     map["OUTPUT"]                    = OUTPUT;
0291     map["EVT_OUTPUT"]                = EVT_OUTPUT;
0292     map["MSG_LIMIT"]                 = MSG_LIMIT;
0293     map["LOG_FILE"]                  = LOG_FILE;
0294     map["BATCH_MODE"]                = BATCH_MODE;
0295     map["INIT_ONLY"]                 = INIT_ONLY;
0296     map["PRINT_VERSION_INFO"]        = PRINT_VERSION_INFO;
0297     map["GENERATE_RESULT_DIRECTORY"] = GENERATE_RESULT_DIRECTORY;
0298   }
0299   return map;
0300 }
0301 const String_Option_Map parameter_index_map =
0302 create_parameter_index_map();
0303 
0304 #endif