[Rivet-svn] rivet: Clean up example analysis codes to be examples of current...

Rivet Mercurial rivet at projects.hepforge.org
Mon Jan 9 15:45:01 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/94ddf9f577b5
branches:  release-2-5-x
changeset: 5661:94ddf9f577b5
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Jan 09 15:38:35 2017 +0000
description:
Clean up example analysis codes to be examples of current best-practice

diffs (truncated from 293 to 50 lines):

--- a/src/Analyses/EXAMPLE.cc	Fri Dec 16 15:30:16 2016 +0000
+++ b/src/Analyses/EXAMPLE.cc	Mon Jan 09 15:38:35 2017 +0000
@@ -59,7 +59,8 @@
       MSG_DEBUG("Total multiplicity = " << cnparticles.size());
       _histTot->fill(cnparticles.size(), weight);
       int cnhadronmult = 0;
-      foreach (const Particle& p, cnparticles) if (isHadron(p)) cnhadronmult += 1;
+      for (const Particle& p : cnparticles)
+        if (isHadron(p)) cnhadronmult += 1;
       MSG_DEBUG("Hadron multiplicity = " << cnhadronmult);
       _histHadrTot->fill(cnhadronmult, weight);
 
@@ -67,7 +68,8 @@
       MSG_DEBUG("Total charged multiplicity = " << cparticles.size());
       _histChTot->fill(cparticles.size(), weight);
       int chadronmult = 0;
-      foreach (const Particle& p, cparticles) if (isHadron(p)) chadronmult += 1;
+      for (const Particle& p : cparticles)
+        if (isHadron(p)) chadronmult += 1;
       MSG_DEBUG("Hadron charged multiplicity = " << chadronmult);
       _histHadrChTot->fill(chadronmult, weight);
 
@@ -90,37 +92,20 @@
 
     /// Finalize
     void finalize() {
-      normalize(_histTot);
-      normalize(_histChTot);
-      normalize(_histHadrTot);
-      normalize(_histHadrChTot);
-      normalize(_histThrust);
-      normalize(_histMajor);
-      normalize(_histSphericity);
-      normalize(_histAplanarity);
+      normalize({_histTot, _histChTot, _histHadrTot, _histHadrChTot, _histThrust, _histMajor, _histSphericity, _histAplanarity});
     }
 
     //@}
 
 
-  private:
-
     //@{
     /// Histograms
-    Histo1DPtr _histTot;
-    Histo1DPtr _histChTot;
-    Histo1DPtr _histHadrTot;
-    Histo1DPtr _histHadrChTot;
-    Histo1DPtr _histThrust;
-    Histo1DPtr _histMajor;


More information about the Rivet-svn mailing list