[Rivet-svn] rivet: 4 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Wed Mar 30 12:45:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/9f9b82be6a9f
branches:  
changeset: 5080:9f9b82be6a9f
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Mar 30 11:23:36 2016 +0100
description:
Bug with copy_if fixed -- back_inserter needs to be used, to ensure resizing of the destination vector in filtering

details:   https://rivet.hepforge.org/hg/rivet/rev/ccd3b87c81de
branches:  
changeset: 5081:ccd3b87c81de
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Mar 30 12:29:07 2016 +0100
description:
Change some thresholds and demonstrate use of std::count_if

details:   https://rivet.hepforge.org/hg/rivet/rev/88a526d7c6f1
branches:  
changeset: 5082:88a526d7c6f1
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Mar 30 12:29:45 2016 +0100
description:
Trace output improvement and foreach clean-up

details:   https://rivet.hepforge.org/hg/rivet/rev/9f6d3940f5a6
branches:  
changeset: 5083:9f6d3940f5a6
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Mar 30 12:30:09 2016 +0100
description:
Cosmetics

diffs (truncated from 146 to 50 lines):

--- a/src/Analyses/EXAMPLE.cc	Tue Mar 29 22:30:18 2016 +0100
+++ b/src/Analyses/EXAMPLE.cc	Wed Mar 30 12:30:09 2016 +0100
@@ -27,7 +27,7 @@
     /// Set up projections and book histograms
     void init() {
       // Projections
-      const FinalState cnfs(Cuts::abseta < 4 && Cuts::pT > 2*GeV);
+      const FinalState cnfs(Cuts::abseta < 4 && Cuts::pT > 500*MeV);
       const ChargedFinalState cfs(cnfs);
       addProjection(cnfs, "FS");
       addProjection(cfs, "CFS");
@@ -83,11 +83,8 @@
       MSG_DEBUG("Aplanarity = " << s.aplanarity());
       _histAplanarity->fill(s.aplanarity(), weight);
 
-      unsigned int num_b_jets = 0;
       const Jets jets = applyProjection<FastJets>(event, "Jets").jets(Cuts::pT > 5*GeV);
-      foreach (const Jet& j, jets) {
-        if (j.bTagged()) num_b_jets += 1;
-      }
+      size_t num_b_jets = count_if(jets.begin(), jets.end(), [](const Jet& j){ return j.bTagged(Cuts::pT > 500*MeV); });
       MSG_DEBUG("Num B-jets with pT > 5 GeV = " << num_b_jets);
     }
 
--- a/src/Core/Cuts.cc	Tue Mar 29 22:30:18 2016 +0100
+++ b/src/Core/Cuts.cc	Wed Mar 30 12:30:09 2016 +0100
@@ -7,7 +7,7 @@
 #include <fastjet/PseudoJet.hh>
 #include <HepMC/SimpleVector.h>
 
-/// @todo Sort out what can go into anonymous namespace{}
+/// @todo Sort out what can go into anonymous namespace
 
 namespace Rivet {
 
@@ -43,6 +43,7 @@
     bool _accept(const CuttableBase &) const { return true; }
   };
 
+
   const Cut& Cuts::open() {
     // Only ever need one static open cut object
     static const Cut open = std::make_shared<Open_Cut>();
@@ -70,6 +71,7 @@
     double low_;
   };
 
+
   // Cut constructor for <
   class Cut_Less : public CutBase {


More information about the Rivet-svn mailing list