|
[Rivet-svn] r2555 - trunk/binblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Jul 2 15:12:19 BST 2010
Author: holsch Date: Fri Jul 2 15:12:20 2010 New Revision: 2555 Log: Add switch '--multiply' to be abte to rescale histos by a factor. The factors ae read in from file just like the manually set new areas. Example output can be found her: http://users.hepforge.org/~holsch/Rivet/ATLAS_7000_MINBIAS15_NCH6_d01-x01-y01.pdf Modified: trunk/bin/rivet-rescale Modified: trunk/bin/rivet-rescale ============================================================================== --- trunk/bin/rivet-rescale Thu Jul 1 13:10:53 2010 (r2554) +++ trunk/bin/rivet-rescale Fri Jul 2 15:12:20 2010 (r2555) @@ -33,6 +33,11 @@ * %prog -O observables_and_areas out.aida This will return the Z-boson pT-distribution, scaled to 1.0 + + * Adding the switch --multiply yields in histograms being rescaled by a factor + given in the bin-definitions or observable file + +TODO: * Allow for comments in the observable file """ import sys @@ -154,7 +159,7 @@ path = splitline[0].split(":")[0] low = "" high = "" - logging.warning("No bin definition given for %s" % (line)) + logging.warning("No bin-definition given for %s" % (line)) if low == "": low = None else: @@ -193,6 +198,8 @@ help="Produce AIDA output rather than FLAT") parser.add_option("-f", dest="AIDA", default=True, action="store_false", help="Produce FLAT output rather than AIDA") + parser.add_option("--multiply", default=False, action="store_true", + help="Rescale histos using weight given as factor rather than new area") parser.add_option("-i", "--in-place", dest="IN_PLACE", default=False, action="store_true", help="Overwrite input file rather than making input-rescaled.aida") verbgroup = OptionGroup(parser, "Verbosity control") @@ -283,12 +290,20 @@ # Get old and new histogram areas oldarea = tempold.getArea() if name in obsnorms.keys(): - newarea = obsnorms[name] + + # Check if we want to scale histos by a factor + if opts.multiply: + newarea = oldarea*obsnorms[name] + else: + # Rescale to manually given new area + newarea = obsnorms[name] + + # Rescale this histo ro ref-histo area else: newarea = tempref.getArea() # Renormalise histo - logging.info("Rescaling %s from %e to %e" % (name, oldarea, newarea)) + logging.info("Rescaling %s from %.3e to %.3e" % (name, oldarea, newarea)) renormed = tempold.renormalise(newarea) # Write to file
More information about the Rivet-svn mailing list |