Skip to content

Commit 7ad69b8

Browse files
committed
seed rnd with timestamp
1 parent 5c9b8d0 commit 7ad69b8

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

‎Common/Tools/PID/pidTPCModule.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,11 @@ class pidTPCModule
723723
}
724724
auto trackiterator = tracks.begin();
725725
if constexpr (requires { trackiterator.mcParticleId(); }) {
726-
gRandom->SetSeed(0); // Ensure unique seed from UUID for each process call
726+
if (bcs.size() != 0) {
727+
const auto timestamp = bcs.begin().timestamp();
728+
LOG(info) << "gRandom is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")";
729+
gRandom->SetSeed(timestamp);
730+
}
727731
}
728732

729733
// preparatory step: we need the multiplicities for each collision

‎DPG/Tasks/TPC/tpcSkimsTableCreator.cxx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ struct TreeWriterTpcV0 {
166166

167167
o2::aod::rctsel::RCTFlagsChecker rctChecker{};
168168

169-
TRandom3* fRndm = new TRandom3(0);
169+
TRandom3* fRndm = new TRandom3();
170170

171171
using Trks = soa::Join<aod::Tracks, aod::V0Bits, aod::TracksExtra, aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::TrackSelection>;
172172
using TrksWithDEdxCorrection = soa::Join<Trks, aod::DEdxsCorrected>;
@@ -420,6 +420,12 @@ struct TreeWriterTpcV0 {
420420
template <bool IsCorrectedDeDx, int ModeId, typename TrksType, typename BCType, typename TrkQAType>
421421
void runV0(Colls const& collisions, TrksType const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, TrkQAType const& tracksQA)
422422
{
423+
if (collisions.size() != 0) {
424+
const auto timestamp = collisions.begin().bc_as<BCType>().timestamp();
425+
LOG(info) << "fRndm is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")";
426+
fRndm->SetSeed(timestamp);
427+
}
428+
423429
constexpr bool IsWithTrackQa = ModeId != ModeStandard;
424430

425431
std::vector<int64_t> labelTrack2TrackQA;
@@ -714,7 +720,7 @@ struct TreeWriterTpcTof {
714720

715721
o2::aod::rctsel::RCTFlagsChecker rctChecker{};
716722

717-
TRandom3* fRndm = new TRandom3(0);
723+
TRandom3* fRndm = new TRandom3();
718724

719725
using Trks = soa::Join<aod::Tracks, aod::TracksExtra,
720726
aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa,
@@ -850,6 +856,12 @@ struct TreeWriterTpcTof {
850856
template <bool IsCorrectedDeDx, int ModeId, typename TrksType, typename BCType, typename TrkQAType, typename TMOType>
851857
void runTof(Colls const& collisions, TrksType const& myTracks, TrkQAType const& tracksQA, Preslice<TrksType> const& perCollisionTracksType, TMOType const& trackMeanOccs)
852858
{
859+
if (collisions.size() != 0) {
860+
const auto timestamp = collisions.begin().bc_as<BCType>().timestamp();
861+
LOG(info) << "fRndm is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")";
862+
fRndm->SetSeed(timestamp);
863+
}
864+
853865
constexpr bool IsWithTrackQa = ModeId != ModeStandard;
854866

855867
std::vector<int64_t> labelTrack2TrackQA;

‎DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,16 @@ struct TreeCreatorPidTpcDiagnostics {
293293
}
294294
}
295295

296+
void process(const aod::Collisions& collisions,
297+
const aod::BCsWithTimestamps&)
298+
{
299+
if (collisions.size() != 0) {
300+
const auto timestamp = collisions.begin().bc_as<aod::BCsWithTimestamps>().timestamp();
301+
LOG(info) << "mRnd is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")";
302+
mRnd.SetSeed(timestamp);
303+
}
304+
}
305+
296306
#define MAKE_PROCESS_FUNCTIONS(ParticleNameShort, ParticleNameLong, Unused) \
297307
void process##ParticleNameLong(CollisionsExtra const& collisions, \
298308
soa::Join<TrackCandidates, aod::pidTPC##ParticleNameShort> const& tracks, \

0 commit comments

Comments
 (0)