[Rivet-svn] rivet: Fix uninitialised counters leading to segfault

Rivet Mercurial rivet at projects.hepforge.org
Tue Jun 13 00:15:01 BST 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/811d2c31e0fa
branches:  release-2-5-x
changeset: 5816:811d2c31e0fa
user:      Holger Schulz <holger.schulz at durham.ac.uk>
date:      Mon Jun 12 23:58:23 2017 +0100
description:
Fix uninitialised counters leading to segfault

diffs (30 lines):

--- a/src/Analyses/ATLAS_2017_I1509919.cc	Mon Jun 12 14:01:53 2017 +0100
+++ b/src/Analyses/ATLAS_2017_I1509919.cc	Mon Jun 12 23:58:23 2017 +0100
@@ -38,6 +38,8 @@
         _hist_pT_vs_dPhi[iC] = bookProfile1D(7, 1 + iC, 1);
         //ptLead histos only for 1 and 5 GeV cuts
         if ( (iC == 0) || (iC == 1) )  _hist_ptLead[iC] = bookHisto1D(8, 1 + iC, 1);
+        // 
+        _counters[iC] = bookCounter("Ctr_cut_" + toString(iC));
       }
 
     }
@@ -58,8 +60,7 @@
       // Require at least one track in the event for pTlead histograms
       if (particles.empty()) vetoEvent;
       const double weight = event.weight();
-      for (size_t iC = 0; iC < NCUTS; ++iC) {
-        if (iC != 0 && iC != 1) continue;
+      for (size_t iC = 0; iC < 2; ++iC) {
         if (particles[0].pT() < PTCUTS[iC]*GeV) continue;
         _counters[iC]->fill(weight);
         _hist_ptLead[iC]->fill( particles[0].pT()/GeV, weight);
@@ -87,7 +88,7 @@
       int    tmpnch[2]   = {0,0};
       double tmpptsum[2] = {0,0};
       for (const Particle& p : particles) {
-        const double pT   = p.pT();
+        const double pT   = p.pT()/GeV;
         const double dPhi = deltaPhi(philead, p.phi()); // in range (0,pi)
         const int    ir   = region_index(dPhi); // gives just toward/away/trans
 


More information about the Rivet-svn mailing list