Skip to content

Commit 9de5de8

Browse files
ilikmetaalibuild
andauthored
[PWGCF] Correct for Nch efficiency (#10600)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent c6c1e6f commit 9de5de8

File tree

1 file changed

+84
-46
lines changed

1 file changed

+84
-46
lines changed

PWGCF/Flow/Tasks/flowGfwTask.cxx

Lines changed: 84 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct FlowGfwTask {
8787
O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples")
8888
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights")
8989
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
90+
O2_DEFINE_CONFIGURABLE(cfgEfficiencyNch, std::string, "", "CCDB path to Nch efficiency object")
9091
O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object")
9192
O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object")
9293
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy")
@@ -138,6 +139,7 @@ struct FlowGfwTask {
138139

139140
// Corrections
140141
TH1D* mEfficiency = nullptr;
142+
TH1D* mEfficiencyNch = nullptr;
141143
GFWWeights* mAcceptance = nullptr;
142144
bool correctionsLoaded = false;
143145

@@ -282,8 +284,10 @@ struct FlowGfwTask {
282284
registry.add("hEta", "", {HistType::kTH1D, {axisEta}});
283285
registry.add("hVtxZ", "Vexter Z distribution", {HistType::kTH1D, {axisVertex}});
284286
registry.add("hMult", "Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}});
287+
registry.add("hMultCorr", "Corrected Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}});
285288
registry.add("hCent", "Centrality distribution", {HistType::kTH1D, {{90, 0, 90}}});
286289
registry.add("cent_vs_Nch", ";Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}});
290+
registry.add("cent_vs_NchCorr", ";Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2D, {axisCentrality, axisNch}});
287291

288292
// Centrality estimators
289293
registry.add("hCentEstimators", "Number of Unfiltered Events;; No. of Events", {HistType::kTH1D, {{kNoCentEstimators, -0.5, static_cast<int>(kNoCentEstimators) - 0.5}}});
@@ -344,7 +348,8 @@ struct FlowGfwTask {
344348
registry.add("ZNvsZEMcollrest", "ZNvsZEMcoll; ZEM; ZDC energy (GeV)", {HistType::kTH2F, {{{nBinsAmp, -0.5, maxZEM}, {nBinsAmp, -0.5, 2. * maxZN}}}});
345349

346350
// Track plots
347-
registry.add("Nch", "N_{ch 0-5%} vs #Events;N_{ch 0-5%};No. of Events", {HistType::kTH1D, {axisNch}});
351+
registry.add("Nch", "N_{ch} vs #Events;N_{ch};No. of Events", {HistType::kTH1D, {axisNch}});
352+
registry.add("Nch05", "N_{ch 0-5%} vs #Events;N_{ch 0-5%};No. of Events", {HistType::kTH1D, {axisNch}});
348353
registry.add("Events_per_Centrality_Bin", "Events_per_Centrality_Bin;Centrality FT0C;No. of Events", kTH1F, {axisCentrality});
349354
registry.add("Tracks_per_Centrality_Bin", "Tracks_per_Centrality_Bin;Centrality FT0C;No. of Tracks", kTH1F, {axisCentrality});
350355
registry.add("pt_Cen_GlobalOnly", "pt_Cen_Global;Centrality (%); p_{T} (GeV/c);", {HistType::kTH2D, {axisCentrality, axisPt}});
@@ -614,6 +619,15 @@ struct FlowGfwTask {
614619
}
615620
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency);
616621
}
622+
623+
if (cfgEfficiencyNch.value.empty() == false) {
624+
mEfficiencyNch = ccdb->getForTimeStamp<TH1D>(cfgEfficiencyNch, timestamp);
625+
if (mEfficiencyNch == nullptr) {
626+
LOGF(fatal, "Could not load Nch efficiency histogram for trigger particles from %s", cfgEfficiencyNch.value.c_str());
627+
}
628+
LOGF(info, "Loaded Nch efficiency histogram from %s (%p)", cfgEfficiencyNch.value.c_str(), (void*)mEfficiencyNch);
629+
}
630+
617631
correctionsLoaded = true;
618632
}
619633

@@ -634,6 +648,19 @@ struct FlowGfwTask {
634648
return true;
635649
}
636650

651+
bool setNch(float& weight_nueNch, float nch)
652+
{
653+
float effNch = 1.;
654+
if (mEfficiencyNch)
655+
effNch = mEfficiencyNch->GetBinContent(mEfficiencyNch->FindBin(nch));
656+
else
657+
effNch = 1.0;
658+
if (effNch == 0)
659+
return false;
660+
weight_nueNch = 1. / effNch;
661+
return true;
662+
}
663+
637664
template <typename TCollision>
638665
bool eventSelected(o2::aod::mult::MultNTracksPV, TCollision collision, const int multTrk, const float centrality)
639666
{
@@ -793,7 +820,9 @@ struct FlowGfwTask {
793820
if (!collision.sel8())
794821
return;
795822

796-
if (tracks.size() < 1)
823+
int nch = tracks.size();
824+
825+
if (nch < 1)
797826
return;
798827

799828
registry.fill(HIST("hEventCount"), kSEL8);
@@ -913,12 +942,20 @@ struct FlowGfwTask {
913942
float vtxz = collision.posZ();
914943
float lRandom = fRndm->Rndm();
915944
registry.fill(HIST("hVtxZ"), vtxz);
916-
registry.fill(HIST("hMult"), tracks.size());
945+
registry.fill(HIST("hMult"), nch);
917946
registry.fill(HIST("hCent"), centrality);
918-
registry.fill(HIST("cent_vs_Nch"), centrality, tracks.size());
947+
registry.fill(HIST("cent_vs_Nch"), centrality, nch);
919948

920949
fGFW->Clear();
921950

951+
float weffNch = 1;
952+
if (!setNch(weffNch, nch))
953+
return;
954+
955+
nch = nch * weffNch;
956+
registry.fill(HIST("hMultCorr"), nch);
957+
registry.fill(HIST("cent_vs_NchCorr"), centrality, nch);
958+
922959
auto bc = collision.bc_as<BCsRun3>();
923960
loadCorrections(bc.timestamp());
924961
registry.fill(HIST("hEventCount"), kCENTRALITY);
@@ -944,7 +981,6 @@ struct FlowGfwTask {
944981
}
945982

946983
// track loop
947-
int globalTracksNch = 0;
948984

949985
for (const auto& track : tracks) {
950986
if (!trackSelected(track))
@@ -976,17 +1012,17 @@ struct FlowGfwTask {
9761012

9771013
if (cfgGlobalplusITS) {
9781014
if (withinPtRef) {
979-
globalTracksNch++;
980-
registry.fill(HIST("GlobalplusITS"), centrality, globalTracksNch);
1015+
nch++;
1016+
registry.fill(HIST("GlobalplusITS"), centrality, nch);
9811017
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
9821018
}
9831019
}
9841020

9851021
if (track.hasTPC()) {
9861022
if (cfgGlobalonly) {
9871023
if (withinPtRef) {
988-
globalTracksNch++;
989-
registry.fill(HIST("Globalonly"), centrality, globalTracksNch);
1024+
nch++;
1025+
registry.fill(HIST("Globalonly"), centrality, nch);
9901026
registry.fill(HIST("pt_Cen_GlobalOnly"), centrality, track.pt());
9911027
registry.fill(HIST("phi_Cen_GlobalOnly"), centrality, track.phi());
9921028
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
@@ -995,8 +1031,8 @@ struct FlowGfwTask {
9951031
} else {
9961032
if (cfgITSonly) {
9971033
if (withinPtRef) {
998-
globalTracksNch++;
999-
registry.fill(HIST("ITSonly"), centrality, globalTracksNch);
1034+
nch++;
1035+
registry.fill(HIST("ITSonly"), centrality, nch);
10001036
registry.fill(HIST("pt_Cen_ITSOnly"), centrality, track.pt());
10011037
registry.fill(HIST("phi_Cen_ITSOnly"), centrality, track.phi());
10021038
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
@@ -1011,7 +1047,7 @@ struct FlowGfwTask {
10111047

10121048
// Only one type of track will be plotted
10131049
registry.fill(HIST("Events_per_Centrality_Bin"), centrality);
1014-
registry.fill(HIST("Tracks_per_Centrality_Bin"), centrality, globalTracksNch);
1050+
registry.fill(HIST("Tracks_per_Centrality_Bin"), centrality, nch);
10151051

10161052
// Filling c22 with ROOT TProfile
10171053
fillProfile(corrconfigs.at(0), HIST("c22"), centrality);
@@ -1023,25 +1059,25 @@ struct FlowGfwTask {
10231059
fillProfile(corrconfigs.at(6), HIST("c32etagap"), centrality);
10241060
fillProfile(corrconfigs.at(7), HIST("c34"), centrality);
10251061

1026-
fillProfile(corrconfigs.at(0), HIST("c22Nch"), globalTracksNch);
1027-
fillProfile(corrconfigs.at(1), HIST("c24Nch"), globalTracksNch);
1028-
fillProfile(corrconfigs.at(2), HIST("c26Nch"), globalTracksNch);
1029-
fillProfile(corrconfigs.at(3), HIST("c28Nch"), globalTracksNch);
1030-
fillProfile(corrconfigs.at(4), HIST("c22Nchetagap"), globalTracksNch);
1031-
fillProfile(corrconfigs.at(5), HIST("c32Nch"), globalTracksNch);
1032-
fillProfile(corrconfigs.at(6), HIST("c32Nchetagap"), globalTracksNch);
1033-
fillProfile(corrconfigs.at(7), HIST("c34Nch"), globalTracksNch);
1062+
fillProfile(corrconfigs.at(0), HIST("c22Nch"), nch);
1063+
fillProfile(corrconfigs.at(1), HIST("c24Nch"), nch);
1064+
fillProfile(corrconfigs.at(2), HIST("c26Nch"), nch);
1065+
fillProfile(corrconfigs.at(3), HIST("c28Nch"), nch);
1066+
fillProfile(corrconfigs.at(4), HIST("c22Nchetagap"), nch);
1067+
fillProfile(corrconfigs.at(5), HIST("c32Nch"), nch);
1068+
fillProfile(corrconfigs.at(6), HIST("c32Nchetagap"), nch);
1069+
fillProfile(corrconfigs.at(7), HIST("c34Nch"), nch);
10341070

10351071
// 0-5% centrality Nch
10361072
if (centrality >= 0 && centrality <= 5) {
1037-
fillProfile(corrconfigs.at(0), HIST("c22Nch05"), globalTracksNch);
1038-
fillProfile(corrconfigs.at(1), HIST("c24Nch05"), globalTracksNch);
1039-
fillProfile(corrconfigs.at(2), HIST("c26Nch05"), globalTracksNch);
1040-
fillProfile(corrconfigs.at(3), HIST("c28Nch05"), globalTracksNch);
1041-
fillProfile(corrconfigs.at(4), HIST("c22Nch05etagap"), globalTracksNch);
1042-
fillProfile(corrconfigs.at(5), HIST("c32Nch05"), globalTracksNch);
1043-
fillProfile(corrconfigs.at(6), HIST("c32Nch05etagap"), globalTracksNch);
1044-
fillProfile(corrconfigs.at(7), HIST("c34Nch05"), globalTracksNch);
1073+
fillProfile(corrconfigs.at(0), HIST("c22Nch05"), nch);
1074+
fillProfile(corrconfigs.at(1), HIST("c24Nch05"), nch);
1075+
fillProfile(corrconfigs.at(2), HIST("c26Nch05"), nch);
1076+
fillProfile(corrconfigs.at(3), HIST("c28Nch05"), nch);
1077+
fillProfile(corrconfigs.at(4), HIST("c22Nch05etagap"), nch);
1078+
fillProfile(corrconfigs.at(5), HIST("c32Nch05"), nch);
1079+
fillProfile(corrconfigs.at(6), HIST("c32Nch05etagap"), nch);
1080+
fillProfile(corrconfigs.at(7), HIST("c34Nch05"), nch);
10451081
}
10461082

10471083
// Filling Bootstrap Samples
@@ -1055,28 +1091,30 @@ struct FlowGfwTask {
10551091
fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32etagap], centrality);
10561092
fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34], centrality);
10571093

1058-
fillProfile(corrconfigs.at(0), bootstrapArray[sampleIndex][kc22Nch], globalTracksNch);
1059-
fillProfile(corrconfigs.at(1), bootstrapArray[sampleIndex][kc24Nch], globalTracksNch);
1060-
fillProfile(corrconfigs.at(2), bootstrapArray[sampleIndex][kc26Nch], globalTracksNch);
1061-
fillProfile(corrconfigs.at(3), bootstrapArray[sampleIndex][kc28Nch], globalTracksNch);
1062-
fillProfile(corrconfigs.at(4), bootstrapArray[sampleIndex][kc22Nchetagap], globalTracksNch);
1063-
fillProfile(corrconfigs.at(5), bootstrapArray[sampleIndex][kc32Nch], globalTracksNch);
1064-
fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32Nchetagap], globalTracksNch);
1065-
fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34Nch], globalTracksNch);
1094+
fillProfile(corrconfigs.at(0), bootstrapArray[sampleIndex][kc22Nch], nch);
1095+
fillProfile(corrconfigs.at(1), bootstrapArray[sampleIndex][kc24Nch], nch);
1096+
fillProfile(corrconfigs.at(2), bootstrapArray[sampleIndex][kc26Nch], nch);
1097+
fillProfile(corrconfigs.at(3), bootstrapArray[sampleIndex][kc28Nch], nch);
1098+
fillProfile(corrconfigs.at(4), bootstrapArray[sampleIndex][kc22Nchetagap], nch);
1099+
fillProfile(corrconfigs.at(5), bootstrapArray[sampleIndex][kc32Nch], nch);
1100+
fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32Nchetagap], nch);
1101+
fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34Nch], nch);
10661102

10671103
if (centrality >= 0 && centrality <= 5) {
1068-
fillProfile(corrconfigs.at(0), bootstrapArray[sampleIndex][kc22Nch05], globalTracksNch);
1069-
fillProfile(corrconfigs.at(1), bootstrapArray[sampleIndex][kc24Nch05], globalTracksNch);
1070-
fillProfile(corrconfigs.at(2), bootstrapArray[sampleIndex][kc26Nch05], globalTracksNch);
1071-
fillProfile(corrconfigs.at(3), bootstrapArray[sampleIndex][kc28Nch05], globalTracksNch);
1072-
fillProfile(corrconfigs.at(4), bootstrapArray[sampleIndex][kc22Nch05etagap], globalTracksNch);
1073-
fillProfile(corrconfigs.at(5), bootstrapArray[sampleIndex][kc32Nch05], globalTracksNch);
1074-
fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32Nch05etagap], globalTracksNch);
1075-
fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34Nch05], globalTracksNch);
1076-
1077-
registry.fill(HIST("Nch"), globalTracksNch);
1104+
fillProfile(corrconfigs.at(0), bootstrapArray[sampleIndex][kc22Nch05], nch);
1105+
fillProfile(corrconfigs.at(1), bootstrapArray[sampleIndex][kc24Nch05], nch);
1106+
fillProfile(corrconfigs.at(2), bootstrapArray[sampleIndex][kc26Nch05], nch);
1107+
fillProfile(corrconfigs.at(3), bootstrapArray[sampleIndex][kc28Nch05], nch);
1108+
fillProfile(corrconfigs.at(4), bootstrapArray[sampleIndex][kc22Nch05etagap], nch);
1109+
fillProfile(corrconfigs.at(5), bootstrapArray[sampleIndex][kc32Nch05], nch);
1110+
fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32Nch05etagap], nch);
1111+
fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34Nch05], nch);
1112+
1113+
registry.fill(HIST("Nch05"), nch);
10781114
}
10791115

1116+
registry.fill(HIST("Nch"), nch);
1117+
10801118
// Filling Flow Container
10811119
for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) {
10821120
fillFC(corrconfigs.at(l_ind), centrality, lRandom);

0 commit comments

Comments
 (0)