Skip to content

Commit 7e8e23e

Browse files
authored
TRandom3: stack object instead of global
1 parent 9ea1b12 commit 7e8e23e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ using namespace o2::framework::expressions;
4747
using namespace o2::soa;
4848
using namespace o2::aod::hf_sel_electron;
4949

50-
TRandom3* rnd = new TRandom3(0);
5150
std::vector<double> zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0};
5251
std::vector<double> multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.};
5352
std::vector<double> multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries
@@ -84,6 +83,8 @@ struct HfCorrelatorHfeHadrons {
8483

8584
Configurable<float> eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"};
8685

86+
TRandom3 rnd{0};
87+
8788
SliceCache cache;
8889
using TableCollisions = o2::soa::Filtered<o2::soa::Join<aod::Collisions, aod::Mults, aod::EvSels>>;
8990
using TableCollision = TableCollisions::iterator;
@@ -176,7 +177,7 @@ struct HfCorrelatorHfeHadrons {
176177

177178
bool skipEventTableFilling = false;
178179
if (eventFractionToAnalyze > 0) {
179-
if (rnd->Uniform(0, 1) > eventFractionToAnalyze) {
180+
if (rnd.Uniform(0, 1) > eventFractionToAnalyze) {
180181
skipEventTableFilling = true;
181182
}
182183
}

0 commit comments

Comments
 (0)