From 7ad69b88fd208c42b56b7552ad4b9509849b6bb6 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 6 Nov 2026 23:20:49 +0100 Subject: [PATCH 1/2] seed rnd with timestamp --- Common/Tools/PID/pidTPCModule.h | 6 +++++- DPG/Tasks/TPC/tpcSkimsTableCreator.cxx | 16 ++++++++++++++-- DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx | 10 ++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Common/Tools/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h index 802d17a9b06..44234ed5dfa 100644 --- a/Common/Tools/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -723,7 +723,11 @@ class pidTPCModule } auto trackiterator = tracks.begin(); if constexpr (requires { trackiterator.mcParticleId(); }) { - gRandom->SetSeed(0); // Ensure unique seed from UUID for each process call + if (bcs.size() != 0) { + const auto timestamp = bcs.begin().timestamp(); + LOG(info) << "gRandom is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")"; + gRandom->SetSeed(timestamp); + } } // preparatory step: we need the multiplicities for each collision diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index 3aaa024874e..b9488a81ece 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -166,7 +166,7 @@ struct TreeWriterTpcV0 { o2::aod::rctsel::RCTFlagsChecker rctChecker{}; - TRandom3* fRndm = new TRandom3(0); + TRandom3* fRndm = new TRandom3(); using Trks = soa::Join; using TrksWithDEdxCorrection = soa::Join; @@ -420,6 +420,12 @@ struct TreeWriterTpcV0 { template void runV0(Colls const& collisions, TrksType const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, TrkQAType const& tracksQA) { + if (collisions.size() != 0) { + const auto timestamp = collisions.begin().bc_as().timestamp(); + LOG(info) << "fRndm is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")"; + fRndm->SetSeed(timestamp); + } + constexpr bool IsWithTrackQa = ModeId != ModeStandard; std::vector labelTrack2TrackQA; @@ -714,7 +720,7 @@ struct TreeWriterTpcTof { o2::aod::rctsel::RCTFlagsChecker rctChecker{}; - TRandom3* fRndm = new TRandom3(0); + TRandom3* fRndm = new TRandom3(); using Trks = soa::Join void runTof(Colls const& collisions, TrksType const& myTracks, TrkQAType const& tracksQA, Preslice const& perCollisionTracksType, TMOType const& trackMeanOccs) { + if (collisions.size() != 0) { + const auto timestamp = collisions.begin().bc_as().timestamp(); + LOG(info) << "fRndm is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")"; + fRndm->SetSeed(timestamp); + } + constexpr bool IsWithTrackQa = ModeId != ModeStandard; std::vector labelTrack2TrackQA; diff --git a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx index 8822995d239..8b20cb6889a 100644 --- a/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx +++ b/DPG/Tasks/TPC/treeCreatorPidTpcDiagnostics.cxx @@ -293,6 +293,16 @@ struct TreeCreatorPidTpcDiagnostics { } } + void process(const aod::Collisions& collisions, + const aod::BCsWithTimestamps&) + { + if (collisions.size() != 0) { + const auto timestamp = collisions.begin().bc_as().timestamp(); + LOG(info) << "mRnd is seeded with timestamp of the 0-th bunch crossing (" << timestamp << ")"; + mRnd.SetSeed(timestamp); + } + } + #define MAKE_PROCESS_FUNCTIONS(ParticleNameShort, ParticleNameLong, Unused) \ void process##ParticleNameLong(CollisionsExtra const& collisions, \ soa::Join const& tracks, \ From d48785fffef0da1b44036b9637c0b1d13db25ab0 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 6 Nov 2026 23:43:54 +0100 Subject: [PATCH 2/2] do not leave uninitialized variables --- DPG/Tasks/TPC/tpcSkimsTableCreator.cxx | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index b9488a81ece..ec4c98f2d6d 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -698,20 +698,20 @@ struct TreeWriterTpcTof { HistogramRegistry registry{"registry", {}}; struct TofTrack { - bool isApplyHardCutOnly; - double maxMomHardCutOnly; - double maxMomTPCOnly; - double tpcNSigma; - double nSigmaTPCOnly; - double downsamplingTsalis; - double mass; - double tofNSigma; - double itsNSigma; - double tpcExpSignal; - o2::track::PID::ID pid; - double dwnSmplFactor; - double nSigmaTofTpctof; - double nSigmaTpcTpctof; + bool isApplyHardCutOnly{false}; + double maxMomHardCutOnly{UndefValueDouble}; + double maxMomTPCOnly{UndefValueDouble}; + double tpcNSigma{UndefValueDouble}; + double nSigmaTPCOnly{UndefValueDouble}; + double downsamplingTsalis{UndefValueDouble}; + double mass{UndefValueDouble}; + double tofNSigma{UndefValueDouble}; + double itsNSigma{UndefValueDouble}; + double tpcExpSignal{UndefValueDouble}; + o2::track::PID::ID pid{0}; + double dwnSmplFactor{UndefValueDouble}; + double nSigmaTofTpctof{UndefValueDouble}; + double nSigmaTpcTpctof{UndefValueDouble}; }; Service ccdb{};