From 8b7969abad3db1d4a59e39c05ff44fcc0ccfc10a Mon Sep 17 00:00:00 2001 From: Omar Vazquez Date: Sat, 30 Aug 2025 00:58:52 -0500 Subject: [PATCH] Conditioning the number of CCDB queries --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 22 ++++++++++-- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 36 ++++++++++++++++---- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 465b0caa8a3..078d8aff97a 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -221,8 +221,11 @@ struct UccZdc { bool calibrationsLoaded = false; } cfgNch; + int currentRunNumber; + void init(InitContext const&) { + currentRunNumber = -1; const char* tiT0A{"T0A (#times 1/100, 3.5 < #eta < 4.9)"}; const char* tiT0C{"T0C (#times 1/100, -3.3 < #eta < -2.1)"}; const char* tiT0M{"T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9)"}; @@ -423,6 +426,7 @@ struct UccZdc { LOG(info) << "\tminPt=" << minPt.value; LOG(info) << "\tmaxPt=" << maxPt.value; LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value; + LOG(info) << "\tcurrentRunNumber= " << currentRunNumber; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -602,7 +606,14 @@ struct UccZdc { bool skipEvent{false}; if (useMidRapNchSel) { - loadNchCalibrations(foundBC.timestamp()); + + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumber != nextRunNumber) { + loadNchCalibrations(foundBC.timestamp()); + currentRunNumber = nextRunNumber; + LOG(info) << "\tcurrentRunNumber= " << currentRunNumber << " timeStamp = " << foundBC.timestamp(); + } + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; @@ -787,7 +798,14 @@ struct UccZdc { bool skipEvent{false}; if (useMidRapNchSel) { - loadNchCalibrations(foundBC.timestamp()); + + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumber != nextRunNumber) { + loadNchCalibrations(foundBC.timestamp()); + currentRunNumber = nextRunNumber; + LOG(info) << "\tcurrentRunNumber= " << currentRunNumber << " timeStamp = " << foundBC.timestamp(); + } + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 7506677e038..1fb44ccd448 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -241,10 +241,12 @@ struct PiKpRAA { return selectedTracks; } - void - init(InitContext const&) + int currentRunNumberNchSel; + int currentRunNumberPhiSel; + void init(InitContext const&) { - + currentRunNumberNchSel = -1; + currentRunNumberPhiSel = -1; trkSelDaugthers = trkSelDaugthersV0s(); trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); @@ -362,6 +364,8 @@ struct PiKpRAA { LOG(info) << "\tapplyPhiCut=" << v0Selections.applyPhiCut; LOG(info) << "\tusePinPhiSelection=" << v0Selections.usePinPhiSelection; LOG(info) << "\ttitlePorPt=" << titlePorPt; + LOG(info) << "\tcurrentRunNumberNchSel=" << currentRunNumberNchSel; + LOG(info) << "\tcurrentRunNumberPhiSel=" << currentRunNumberPhiSel; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -406,7 +410,14 @@ struct PiKpRAA { const double nPV{collision.multNTracksPVeta1() / 1.}; if (applyNchSel) { - loadNchCalibrations(timeStamp); + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumberNchSel != nextRunNumber) { + loadNchCalibrations(timeStamp); + currentRunNumberNchSel = nextRunNumber; + LOG(info) << "\tcurrentRunNumberNchSel= " << currentRunNumberNchSel << " timeStamp = " << timeStamp; + } + + // return if Nch selection objects are nullptr if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; } @@ -454,8 +465,18 @@ struct PiKpRAA { registry.fill(HIST("T0Ccent"), collision.centFT0C()); const float centrality{collision.centFT0C()}; - if (v0Selections.applyPhiCut) - loadPhiCutSelections(timeStamp); + if (v0Selections.applyPhiCut) { + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumberPhiSel != nextRunNumber) { + loadPhiCutSelections(timeStamp); + currentRunNumberPhiSel = nextRunNumber; + LOG(info) << "\tcurrentRunNumberPhiSel= " << currentRunNumberPhiSel << " timeStamp = " << timeStamp; + } + + // return if phi cut objects are nullptr + if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) + return; + } for (const auto& track : tracks) { @@ -1069,7 +1090,8 @@ struct PiKpRAA { LOGF(fatal, "Could not load hSigmaNch histogram from %s", pathSigmaNch.value.c_str()); } } - cfgNch.calibrationsLoaded = true; + if (cfgNch.hMeanNch && cfgNch.hSigmaNch) + cfgNch.calibrationsLoaded = true; } void loadPhiCutSelections(const uint64_t& timeStamp)