[Rivet-svn] rivet: Fixes to ensure existing analyses match release for the s...

Rivet Mercurial rivet at projects.hepforge.org
Thu Feb 8 14:30:01 GMT 2018


details:   https://rivet.hepforge.org/hg/rivet/rev/3e6301b76af3
branches:  multiweight
changeset: 6241:3e6301b76af3
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Thu Feb 08 14:21:57 2018 +0000
description:
Fixes to ensure existing analyses match release for the simple case of single, positive weight.

diffs (truncated from 1264 to 50 lines):

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/analyses/pluginATLAS/ATLAS_2012_I1094061.cc.cross-event-correlns	Thu Feb 08 14:21:57 2018 +0000
@@ -0,0 +1,275 @@
+// -*- C++ -*-
+#include "Rivet/Analysis.hh"
+#include "Rivet/Projections/ChargedFinalState.hh"
+
+namespace Rivet {
+
+
+  /// Two-particle correlation functions in pp collisions at 900 GeV and 7 TeV
+  class ATLAS_2012_I1094061 : public Analysis {
+
+
+    /// Container for a pair of foreground and background histos, divided at the end of the analysis
+    struct HistoPair{
+      enum HistoType { FOREGROUND, BACKGROUND };
+
+      HistoPair() : _ana(nullptr)
+      {  }
+
+      void init(int ds, int xaxis, int yaxis, ATLAS_2012_I1094061* ana) {
+        _ana = ana;
+        const string hcode = ana->makeAxisCode(ds, xaxis, yaxis);
+        ana->book(_h_foreground, "tmpForeground_" + hcode, ana->refData(ds, xaxis, yaxis));
+        ana->book(_h_background, "tmpBackground_" + hcode, ana->refData(ds, xaxis, yaxis));
+        ana->book(_s_final, ds, xaxis, yaxis, true);
+      }
+
+      void fillForeground(double value, double weight) {
+        _h_foreground->fill(value, weight);
+        _h_foreground->fill(-value, weight);
+      }
+
+      void fillBackground(double value, double weight) {
+        _h_background->fill(value, weight);
+        _h_background->fill(-value, weight);
+      }
+
+      void fill(double value, double weight, HistoType type) {
+        if (type == FOREGROUND) {
+          fillForeground(value, weight);
+        } else { // type == BACKGROUND
+          fillBackground(value, weight);
+        }
+      }
+
+      void finalize(double wgtSum, double bgWeight, double avNTracks) {
+        _h_foreground->scaleW(1/wgtSum);
+        _h_background->scaleW(1/bgWeight);


More information about the Rivet-svn mailing list