Skip to content

Commit 9693705

Browse files
committed
CCDB: global call for fMeanNch and fSigmaNch
1 parent ecc7d4c commit 9693705

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ struct UccZdc {
156156
HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
157157
Service<ccdb::BasicCCDBManager> ccdb;
158158

159+
TF1* fMeanNch = nullptr;
160+
TF1* fSigmaNch = nullptr;
161+
159162
void init(InitContext const&)
160163
{
161164
// define axes you want to use
@@ -288,6 +291,21 @@ struct UccZdc {
288291
// This avoids that users can replace objects **while** a train is running
289292
int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
290293
ccdb->setCreatedNotAfter(now);
294+
fMeanNch = ccdb->getForTimeStamp<TF1>(paTHmeanNch.value, now);
295+
fSigmaNch = ccdb->getForTimeStamp<TF1>(paTHsigmaNch.value, now);
296+
if (!fMeanNch) {
297+
LOGF(fatal, "fMeanNch object not found!");
298+
}
299+
if (!fSigmaNch) {
300+
LOGF(fatal, "fSigmaNch object not found!");
301+
}
302+
303+
LOG(info) << "\tnow=" << now;
304+
LOG(info) << "\tapplyEff=" << applyEff.value;
305+
LOG(info) << "\tpaTH=" << paTH.value;
306+
LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value;
307+
LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value;
308+
LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value;
291309
}
292310

293311
template <typename CheckCol>
@@ -461,12 +479,6 @@ struct UccZdc {
461479

462480
// Nch-based selection
463481
if (useMidRapNchSel) {
464-
auto fMeanNch = ccdb->getForRun<TF1>(paTHmeanNch.value, foundBC.runNumber());
465-
auto fSigmaNch = ccdb->getForRun<TF1>(paTHsigmaNch.value, foundBC.runNumber());
466-
if (!fMeanNch || !fSigmaNch) {
467-
return;
468-
}
469-
470482
const double meanNch{fMeanNch->Eval(normT0M)};
471483
const double sigmaNch{fSigmaNch->Eval(normT0M)};
472484
const double nSigmaSelection{nSigmaNchCut * sigmaNch};
@@ -605,13 +617,8 @@ struct UccZdc {
605617
glbTracks++;
606618
}
607619

620+
// Nch-based selection
608621
if (useMidRapNchSel) {
609-
auto fMeanNch = ccdb->getForRun<TF1>(paTHmeanNch.value, foundBC.runNumber());
610-
auto fSigmaNch = ccdb->getForRun<TF1>(paTHsigmaNch.value, foundBC.runNumber());
611-
if (!fMeanNch || !fSigmaNch) {
612-
return;
613-
}
614-
615622
const double meanNch{fMeanNch->Eval(normT0M)};
616623
const double sigmaNch{fSigmaNch->Eval(normT0M)};
617624
const double nSigmaSelection{nSigmaNchCut * sigmaNch};

0 commit comments

Comments
 (0)