[Rivet-svn] rivet: correct seg fault in finalize

Rivet Mercurial rivet at projects.hepforge.org
Fri Oct 27 09:45:02 BST 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/54d01297335b
branches:  multiweight
changeset: 6112:54d01297335b
user:      Chris Pollard <cspollard at gmail.com>
date:      Fri Oct 27 10:44:29 2017 +0200
description:
correct seg fault in finalize

diffs (truncated from 71 to 50 lines):

--- a/src/Core/AnalysisHandler.cc	Thu Oct 26 16:52:32 2017 +0200
+++ b/src/Core/AnalysisHandler.cc	Fri Oct 27 10:44:29 2017 +0200
@@ -83,6 +83,7 @@
     // set the cross section based on what is reported by this event.
     // if no cross section
     if (ge.cross_section()) {
+      MSG_TRACE("getting cross section.");
       double xs = ge.cross_section()->cross_section();
       double xserr = ge.cross_section()->cross_section_error();
       setCrossSection(xs, xserr);
@@ -181,6 +182,16 @@
     /// @todo Filter/normalize the event here
     Event event(ge);
 
+    // set the cross section based on what is reported by this event.
+    // if no cross section
+    MSG_TRACE("getting cross section.");
+    if (ge.cross_section()) {
+      MSG_TRACE("getting cross section from GenEvent.");
+      double xs = ge.cross_section()->cross_section();
+      double xserr = ge.cross_section()->cross_section_error();
+      setCrossSection(xs, xserr);
+    }
+
     // won't happen for first event because _eventNumber is set in
     // init()
     if (_eventNumber != ge.event_number()) {
@@ -219,14 +230,6 @@
     _subEventWeights.push_back(event.weights());
     MSG_DEBUG("Analyzing subevent #" << _subEventWeights.size() - 1 << ".");
 
-    // set the cross section based on what is reported by this event.
-    // if no cross section
-    if (ge.cross_section()) {
-      double xs = ge.cross_section()->cross_section();
-      double xserr = ge.cross_section()->cross_section_error();
-      setCrossSection(xs, xserr);
-    }
-
     _eventCounter->fill();
     // Run the analyses
     for (AnaHandle a : _analyses) {
@@ -265,6 +268,7 @@
       for (const AnaHandle& a : _analyses) {
           for (size_t iW = 0; iW < numWeights(); iW++) {
               _eventCounter.get()->setActiveWeightIdx(iW);
+              _xs.get()->setActiveWeightIdx(iW);
               for (auto ao : a->analysisObjects())
                   ao.get()->setActiveWeightIdx(iW);
 


More information about the Rivet-svn mailing list