|
[Rivet-svn] rivet: Allow comma and space-separated analysis name lists to be...Rivet Mercurial rivet at projects.hepforge.orgThu Nov 5 12:45:02 GMT 2015
details: https://rivet.hepforge.org/hg/rivet/rev/9ba022901c9a branches: release-2-4-x changeset: 4914:9ba022901c9a user: Andy Buckley <andy at insectnation.org> date: Thu Nov 05 12:30:02 2015 +0000 description: Allow comma and space-separated analysis name lists to be passed to a single -a/--analysis/--analyses option. diffs (truncated from 82 to 50 lines): --- a/ChangeLog Thu Nov 05 11:31:36 2015 +0000 +++ b/ChangeLog Thu Nov 05 12:30:02 2015 +0000 @@ -1,5 +1,7 @@ 2015-11-05 Andy Buckley <andy.buckley at cern.ch> + * Allow comma and space-separated analysis name lists to be passed to a single -a/--analysis/--analyses option. + * Convert namespace-global const variables to be static, to suppress compiler warnings. * Use standard MAX_DBL and MAX_INT macros as a source for MAXDOUBLE and MAXINT, to suppress GCC5 warnings. --- a/bin/rivet Thu Nov 05 11:31:36 2015 +0000 +++ b/bin/rivet Thu Nov 05 12:30:02 2015 +0000 @@ -47,9 +47,9 @@ parser = OptionParser(usage=__doc__, version="rivet v%s" % rivet.version()) anagroup = OptionGroup(parser, "Analysis handling") -anagroup.add_option("-a", "--analysis", dest="ANALYSES", action="append", +anagroup.add_option("-a", "--analysis", , "--analyses", dest="ANALYSES", action="append", default=[], metavar="ANA", - help="add an analysis to the processing list.") + help="add an analysis (or comma- or space-separated list of analyses) to the processing list.") anagroup.add_option("--list-analyses", "--list", dest="LIST_ANALYSES", action="store_true", default=False, help="show the list of available analyses' names. With -v, it shows the descriptions, too") anagroup.add_option("--list-used-analyses", action="store_true", dest="LIST_USED_ANALYSES", @@ -114,7 +114,6 @@ ## Configure logging logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s") - ## Control native Rivet library logger for l in opts.NATIVE_LOG_STRS: name, level = None, None @@ -134,6 +133,19 @@ except: logging.warning("Couldn't process logging string '%s'" % l) + +## We allow comma-separated and space-separated lists of analysis names -- normalise the list here +newanas = [] +for a in opts.ANALYSES: + if "," in a: + newanas += a.split(",") + elif " " in a: + newanas += a.split() #< default split is on any whitespace + else: + newanas.append(a) +opts.ANALYSES = newanas + + ## Parse supplied cross-section
More information about the Rivet-svn mailing list |