[Rivet-svn] rivet: Add a 'proper' event counter. Need to make sure it's hand...

Rivet Mercurial rivet at projects.hepforge.org
Sat Dec 9 00:30:02 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/3a56fe112c03
branches:  
changeset: 6166:3a56fe112c03
user:      Andy Buckley <andy at insectnation.org>
date:      Sat Dec 09 00:29:06 2017 +0000
description:
Add a 'proper' event counter. Need to make sure it's handling weights properly, then will remove manual count & weight tracking

diffs (truncated from 51 to 50 lines):

--- a/include/Rivet/AnalysisHandler.hh	Fri Dec 08 14:29:21 2017 +0000
+++ b/include/Rivet/AnalysisHandler.hh	Sat Dec 09 00:29:06 2017 +0000
@@ -222,6 +222,8 @@
     /// Run name
     std::string _runname;
 
+    /// Event counter
+    Counter _eventcounter;
     /// Number of events seen.
     /// @todo Replace by a counter
     unsigned int _numEvents;
--- a/src/Core/AnalysisHandler.cc	Fri Dec 08 14:29:21 2017 +0000
+++ b/src/Core/AnalysisHandler.cc	Sat Dec 09 00:29:06 2017 +0000
@@ -12,8 +12,9 @@
 
 
   AnalysisHandler::AnalysisHandler(const string& runname)
-    : _runname(runname), _numEvents(0),
-      _sumOfWeights(0.0), _xs(NAN),
+    : _runname(runname),
+      _eventcounter("/_EVTCOUNT2"),
+      _numEvents(0), _sumOfWeights(0.0), _sumOfWeightsSq(0.0), _xs(NAN),
       _initialised(false), _ignoreBeams(false)
   {  }
 
@@ -33,6 +34,8 @@
 
     setRunBeams(Rivet::beams(ge));
     MSG_DEBUG("Initialising the analysis handler");
+    // _eventcounter.clear();
+    /// @todo Remove
     _numEvents = 0;
     _sumOfWeights = 0.0;
     _sumOfWeightsSq = 0.0;
@@ -111,6 +114,8 @@
 
     // Weights
     /// @todo Drop this / just report first weight when we support multiweight events
+    _eventcounter.fill(event.weight());
+    /// @todo Remove
     _numEvents += 1;
     _sumOfWeights += event.weight();
     _sumOfWeightsSq += sqr(event.weight());
@@ -251,6 +256,7 @@
     vector<AnalysisObjectPtr> rtn;
     // Event counter
     rtn.push_back( make_shared<Counter>(YODA::Dbn0D(_numEvents, _sumOfWeights, _sumOfWeightsSq), "/_EVTCOUNT") );
+    rtn.push_back( make_shared<Counter>(_eventcounter) );
     // Cross-section + err as scatter
     YODA::Scatter1D::Points pts; pts.insert(YODA::Point1D(_xs, _xserr));


More information about the Rivet-svn mailing list