Skip to content

Commit f87f062

Browse files
authored
[PWGLF] Using global ccdb and fixed a bug (#11609)
1 parent acefb1e commit f87f062

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct UccZdc {
8383
Configurable<bool> isZEMcut{"isZEMcut", true, "Use ZEM cut"};
8484
Configurable<bool> useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"};
8585
Configurable<bool> applyEff{"applyEff", true, "Apply track-by-track efficiency correction"};
86+
Configurable<bool> applyFD{"applyFD", false, "Apply track-by-track feed down correction"};
8687
Configurable<bool> correctNch{"correctNch", true, "Correct also Nch"};
8788

8889
// Event selection
@@ -165,6 +166,8 @@ struct UccZdc {
165166
HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
166167
Service<ccdb::BasicCCDBManager> ccdb;
167168

169+
TH1F* fd = nullptr;
170+
168171
void init(InitContext const&)
169172
{
170173
// define axes you want to use
@@ -299,6 +302,7 @@ struct UccZdc {
299302

300303
LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value;
301304
LOG(info) << "\tapplyEff=" << applyEff.value;
305+
LOG(info) << "\tapplyFD=" << applyFD.value;
302306
LOG(info) << "\tcorrectNch=" << correctNch.value;
303307
LOG(info) << "\tpaTHEff=" << paTHEff.value;
304308
LOG(info) << "\tpaTHFD=" << paTHFD.value;
@@ -318,6 +322,11 @@ struct UccZdc {
318322
// Not later than now, will be replaced by the value of the train creation
319323
// This avoids that users can replace objects **while** a train is running
320324
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
325+
// Feed Down is the same for all runs -> use a global object
326+
fd = ccdb->getForTimeStamp<TH1F>(paTHFD.value, ccdbNoLaterThan.value);
327+
if (!fd) {
328+
LOGF(fatal, "Feed Down object not found!");
329+
}
321330
}
322331

323332
template <typename CheckCol>
@@ -697,8 +706,7 @@ struct UccZdc {
697706
}
698707

699708
auto efficiency = ccdb->getForTimeStamp<TH1F>(paTHEff.value, foundBC.timestamp());
700-
auto fd = ccdb->getForTimeStamp<TH1F>(paTHFD.value, foundBC.timestamp());
701-
if (!efficiency || !fd) {
709+
if (!efficiency) {
702710
return;
703711
}
704712

@@ -756,6 +764,9 @@ struct UccZdc {
756764
effValue = efficiency->GetBinContent(efficiency->FindBin(pt));
757765
fdValue = fd->GetBinContent(fd->FindBin(pt));
758766
}
767+
if (applyEff && !applyFD) {
768+
fdValue = 1.0;
769+
}
759770
if ((effValue > 0.) && (fdValue > 0.)) {
760771
pTs.emplace_back(pt);
761772
vecOneOverEff.emplace_back(1. / effValue);
@@ -844,8 +855,7 @@ struct UccZdc {
844855
// To use run-by-run efficiency
845856
const auto& foundBC = collision.foundBC_as<o2::aod::BCsRun3>();
846857
auto efficiency = ccdb->getForTimeStamp<TH1F>(paTHEff.value, foundBC.timestamp());
847-
auto fd = ccdb->getForTimeStamp<TH1F>(paTHFD.value, foundBC.timestamp());
848-
if (!efficiency || !fd) {
858+
if (!efficiency) {
849859
return;
850860
}
851861

@@ -930,7 +940,7 @@ struct UccZdc {
930940
}
931941

932942
double nchMC{0};
933-
nchMult = std::accumulate(vecFullEff.begin(), vecFullEff.end(), 0);
943+
nchMC = std::accumulate(vecFullEff.begin(), vecFullEff.end(), 0);
934944
if (nchMC < minNchSel) {
935945
continue;
936946
}

0 commit comments

Comments
 (0)