|
[Rivet-svn] rivet: Adding missing scale and normalize method bodies for 2D h...Rivet Mercurial rivet at projects.hepforge.orgWed Oct 14 15:15:02 BST 2015
details: https://rivet.hepforge.org/hg/rivet/rev/7adb5c0e3e55 branches: changeset: 4901:7adb5c0e3e55 user: Andy Buckley <andy at insectnation.org> date: Wed Oct 14 15:06:21 2015 +0100 description: Adding missing scale and normalize method bodies for 2D histograms. diffs (truncated from 68 to 50 lines): --- a/ChangeLog Tue Oct 06 19:13:55 2015 +0100 +++ b/ChangeLog Wed Oct 14 15:06:21 2015 +0100 @@ -1,3 +1,7 @@ +2015-10-14 Andy Buckley <andy.buckley at cern.ch> + + * Adding missing scale and normalize method bodies for 2D histograms. + 2015-10-06 Holger Schulz <holger.schulz at durham.ac.uk> * Adding CMS_2015_I1327224 dijet analysis (Mjj>2 TeV) --- a/bin/rivet-cmphistos Tue Oct 06 19:13:55 2015 +0100 +++ b/bin/rivet-cmphistos Wed Oct 14 15:06:21 2015 +0100 @@ -81,11 +81,11 @@ # # default=None, help="specify a file containing a list of histograms to plot, in the format " # # "/ANALYSIS_ID/histoname, one per line, e.g. '/DELPHI_1996_S3430090/d01-x01-y01'.") selgroup.add_option("-m", "--match", action="append", - help="Only write out histograms whose $path/$name string matches these regexes. The argument " + help="only write out histograms whose $path/$name string matches these regexes. The argument " "may also be a text file.", dest="PATHPATTERNS") selgroup.add_option("-M", "--unmatch", action="append", - help="Exclude histograms whose $path/$name string matches these regexes", + help="exclude histograms whose $path/$name string matches these regexes", dest="PATHUNPATTERNS") parser.add_option_group(selgroup) --- a/src/Core/Analysis.cc Tue Oct 06 19:13:55 2015 +0100 +++ b/src/Core/Analysis.cc Wed Oct 14 15:06:21 2015 +0100 @@ -694,7 +694,38 @@ } - /// @todo 2D versions of scale and normalize... + void Analysis::normalize(Histo2DPtr histo, double norm, bool includeoverflows) { + if (!histo) { + MSG_ERROR("Failed to normalize histo=NULL in analysis " << name() << " (norm=" << norm << ")"); + return; + } + MSG_TRACE("Normalizing histo " << histo->path() << " to " << norm); + try { + histo->normalize(norm, includeoverflows); + } catch (YODA::Exception& we) { + MSG_WARNING("Could not normalize histo " << histo->path()); + return; + } + } + + + void Analysis::scale(Histo2DPtr histo, double scale) { + if (!histo) {
More information about the Rivet-svn mailing list |