Skip to content

Commit 700811a

Browse files
authored
[PWGLF] Conditioning the number of CCDB queries (#12793)
1 parent 1ade607 commit 700811a

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,11 @@ struct UccZdc {
221221
bool calibrationsLoaded = false;
222222
} cfgNch;
223223

224+
int currentRunNumber;
225+
224226
void init(InitContext const&)
225227
{
228+
currentRunNumber = -1;
226229
const char* tiT0A{"T0A (#times 1/100, 3.5 < #eta < 4.9)"};
227230
const char* tiT0C{"T0C (#times 1/100, -3.3 < #eta < -2.1)"};
228231
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 {
423426
LOG(info) << "\tminPt=" << minPt.value;
424427
LOG(info) << "\tmaxPt=" << maxPt.value;
425428
LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value;
429+
LOG(info) << "\tcurrentRunNumber= " << currentRunNumber;
426430

427431
ccdb->setURL("http://alice-ccdb.cern.ch");
428432
ccdb->setCaching(true);
@@ -602,7 +606,14 @@ struct UccZdc {
602606

603607
bool skipEvent{false};
604608
if (useMidRapNchSel) {
605-
loadNchCalibrations(foundBC.timestamp());
609+
610+
const int nextRunNumber{foundBC.runNumber()};
611+
if (currentRunNumber != nextRunNumber) {
612+
loadNchCalibrations(foundBC.timestamp());
613+
currentRunNumber = nextRunNumber;
614+
LOG(info) << "\tcurrentRunNumber= " << currentRunNumber << " timeStamp = " << foundBC.timestamp();
615+
}
616+
606617
if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch))
607618
return;
608619

@@ -787,7 +798,14 @@ struct UccZdc {
787798

788799
bool skipEvent{false};
789800
if (useMidRapNchSel) {
790-
loadNchCalibrations(foundBC.timestamp());
801+
802+
const int nextRunNumber{foundBC.runNumber()};
803+
if (currentRunNumber != nextRunNumber) {
804+
loadNchCalibrations(foundBC.timestamp());
805+
currentRunNumber = nextRunNumber;
806+
LOG(info) << "\tcurrentRunNumber= " << currentRunNumber << " timeStamp = " << foundBC.timestamp();
807+
}
808+
791809
if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch))
792810
return;
793811

PWGLF/Tasks/Nuspex/piKpRAA.cxx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,12 @@ struct PiKpRAA {
241241
return selectedTracks;
242242
}
243243

244-
void
245-
init(InitContext const&)
244+
int currentRunNumberNchSel;
245+
int currentRunNumberPhiSel;
246+
void init(InitContext const&)
246247
{
247-
248+
currentRunNumberNchSel = -1;
249+
currentRunNumberPhiSel = -1;
248250
trkSelDaugthers = trkSelDaugthersV0s();
249251
trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
250252

@@ -362,6 +364,8 @@ struct PiKpRAA {
362364
LOG(info) << "\tapplyPhiCut=" << v0Selections.applyPhiCut;
363365
LOG(info) << "\tusePinPhiSelection=" << v0Selections.usePinPhiSelection;
364366
LOG(info) << "\ttitlePorPt=" << titlePorPt;
367+
LOG(info) << "\tcurrentRunNumberNchSel=" << currentRunNumberNchSel;
368+
LOG(info) << "\tcurrentRunNumberPhiSel=" << currentRunNumberPhiSel;
365369

366370
ccdb->setURL("http://alice-ccdb.cern.ch");
367371
ccdb->setCaching(true);
@@ -406,7 +410,14 @@ struct PiKpRAA {
406410
const double nPV{collision.multNTracksPVeta1() / 1.};
407411

408412
if (applyNchSel) {
409-
loadNchCalibrations(timeStamp);
413+
const int nextRunNumber{foundBC.runNumber()};
414+
if (currentRunNumberNchSel != nextRunNumber) {
415+
loadNchCalibrations(timeStamp);
416+
currentRunNumberNchSel = nextRunNumber;
417+
LOG(info) << "\tcurrentRunNumberNchSel= " << currentRunNumberNchSel << " timeStamp = " << timeStamp;
418+
}
419+
420+
// return if Nch selection objects are nullptr
410421
if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch))
411422
return;
412423
}
@@ -454,8 +465,18 @@ struct PiKpRAA {
454465
registry.fill(HIST("T0Ccent"), collision.centFT0C());
455466
const float centrality{collision.centFT0C()};
456467

457-
if (v0Selections.applyPhiCut)
458-
loadPhiCutSelections(timeStamp);
468+
if (v0Selections.applyPhiCut) {
469+
const int nextRunNumber{foundBC.runNumber()};
470+
if (currentRunNumberPhiSel != nextRunNumber) {
471+
loadPhiCutSelections(timeStamp);
472+
currentRunNumberPhiSel = nextRunNumber;
473+
LOG(info) << "\tcurrentRunNumberPhiSel= " << currentRunNumberPhiSel << " timeStamp = " << timeStamp;
474+
}
475+
476+
// return if phi cut objects are nullptr
477+
if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow))
478+
return;
479+
}
459480

460481
for (const auto& track : tracks) {
461482

@@ -1069,7 +1090,8 @@ struct PiKpRAA {
10691090
LOGF(fatal, "Could not load hSigmaNch histogram from %s", pathSigmaNch.value.c_str());
10701091
}
10711092
}
1072-
cfgNch.calibrationsLoaded = true;
1093+
if (cfgNch.hMeanNch && cfgNch.hSigmaNch)
1094+
cfgNch.calibrationsLoaded = true;
10731095
}
10741096

10751097
void loadPhiCutSelections(const uint64_t& timeStamp)

0 commit comments

Comments
 (0)