Skip to content

Commit

Permalink
Merge pull request #44 from joequant/dev/fcalccluster
Browse files Browse the repository at this point in the history
fix #43 to compile with c++17
  • Loading branch information
joequant authored Sep 20, 2020
1 parent ddb9629 commit 1ed06f7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/fcalclusterer/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Fcalclusterer(CMakePackage):

# CMAKE_INSTALL_PREFIX is overwritten by the package
patch("install.patch", when="@:1.0.1")
patch("random-shuffle-c17.patch", when="@:1.0.1")

def cmake_args(self):
args = []
Expand Down
21 changes: 21 additions & 0 deletions packages/fcalclusterer/random-shuffle-c17.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git source/BeamCalReco/src/BeamCalBkgPregen.cpp source/BeamCalReco/src/BeamCalBkgPregen.cpp
index 80b217e..839cf13 100644
--- a/source/BeamCalReco/src/BeamCalBkgPregen.cpp
+++ b/source/BeamCalReco/src/BeamCalBkgPregen.cpp
@@ -29,6 +29,7 @@
#include <map>
#include <set>
#include <stdexcept>
+#include <random>

using std::vector;
using std::string;
@@ -67,7 +67,7 @@ void BeamCalBkgPregen::init(vector<string> &bg_files, const int n_bx)
m_backgroundBX = new TChain("bcTree");

//mix up the files, because the random numbers are ordered to avoid repeating
- std::random_shuffle(bg_files.begin(), bg_files.end());
+ std::shuffle(bg_files.begin(), bg_files.end(), std::mt19937(std::random_device()()));

for (std::vector<std::string>::iterator file = bg_files.begin(); file != bg_files.end(); ++file) {
streamlog_out(DEBUG1) << *file << std::endl;

0 comments on commit 1ed06f7

Please sign in to comment.