Skip to content

Commit 9974666

Browse files
committed
Apply charged-track corrections to EP flow and add correction QA
1 parent 33795e3 commit 9974666

1 file changed

Lines changed: 62 additions & 10 deletions

File tree

‎PWGCF/Flow/Tasks/flowEseTask.cxx‎

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <TF1.h>
5151
#include <TH1.h>
5252
#include <TH2.h>
53+
#include <TH3.h>
5354
#include <THnSparse.h>
5455
#include <TObject.h>
5556
#include <TProfile2D.h>
@@ -150,10 +151,10 @@ struct FlowEseTask {
150151
Configurable<std::string> cfgAccCorPath{"cfgAccCorPath", "", "path for pseudo acceptance correction"};
151152

152153
struct : ConfigurableGroup {
153-
Configurable<bool> cfgGfwEffCor{"cfgGfwEffCor", false, "flag to apply charged-track efficiency correction for GFW"};
154-
Configurable<std::string> cfgGfwEffCorPath{"cfgGfwEffCorPath", "", "CCDB path to charged-track efficiency correction for GFW"};
155-
Configurable<bool> cfgGfwAccCor{"cfgGfwAccCor", false, "flag to apply charged-track acceptance correction for GFW"};
156-
Configurable<std::string> cfgGfwAccCorPath{"cfgGfwAccCorPath", "", "CCDB path to charged-track acceptance correction for GFW"};
154+
Configurable<bool> cfgGfwEffCor{"cfgGfwEffCor", false, "flag to apply charged-track efficiency correction for EP and GFW"};
155+
Configurable<std::string> cfgGfwEffCorPath{"cfgGfwEffCorPath", "", "CCDB path to charged-track efficiency correction for EP and GFW"};
156+
Configurable<bool> cfgGfwAccCor{"cfgGfwAccCor", false, "flag to apply charged-track acceptance correction for EP and GFW"};
157+
Configurable<std::string> cfgGfwAccCorPath{"cfgGfwAccCorPath", "", "CCDB path to charged-track acceptance correction for EP and GFW"};
157158
} cfgGfwParam;
158159

159160
Configurable<bool> cfgCalcCum{"cfgCalcCum", false, "flag to calculate cumulants of cossin"};
@@ -187,6 +188,9 @@ struct FlowEseTask {
187188

188189
static constexpr float MinAmplitudeThreshold = 1e-5f;
189190
static constexpr int ShiftLevel = 10;
191+
static constexpr int CorrectionWeightBins = 100;
192+
static constexpr int CorrectionSummaryBins = 8;
193+
static constexpr double LargeNUAWeightThreshold = 10.0;
190194
static constexpr int LambdaId = 3122;
191195
static constexpr int SecondHarmonic = 2;
192196
static constexpr int ThirdHarmonic = 3;
@@ -380,6 +384,7 @@ struct FlowEseTask {
380384
for (int iGroup = 0; iGroup < NEseGroups; ++iGroup) {
381385
const auto suffix = eseGroupSuffix(iGroup);
382386
addEseHistogram<THnSparse>(Form("histV%d_%s", cfgEseHarmonic.value, suffix.c_str()), HistType::kTHnSparseF, {centAxis, ptAxis, cosAxis});
387+
getEseHistogram<THnSparse>(Form("histV%d_%s", cfgEseHarmonic.value, suffix.c_str()))->Sumw2();
383388
addEseHistogram<THnSparse>(Form("psi%d/h_lambda_cos_%s", cfgEseHarmonic.value, suffix.c_str()), HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis});
384389
addEseHistogram<THnSparse>(Form("psi%d/h_alambda_cos_%s", cfgEseHarmonic.value, suffix.c_str()), HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis});
385390
addEseHistogram<THnSparse>(Form("psi%d/h_lambda_cos2_%s", cfgEseHarmonic.value, suffix.c_str()), HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis});
@@ -389,6 +394,26 @@ struct FlowEseTask {
389394
}
390395
histos.add("QA/CentDist", "", {HistType::kTH1F, {centQaAxis}});
391396
histos.add("QA/PVzDist", "", {HistType::kTH1F, {pVzQaAxis}});
397+
AxisSpec phiQaAxis = {72, 0.0, o2::constants::math::TwoPI};
398+
AxisSpec correctionStageAxis = {3, -0.5, 2.5, "0: raw, 1: NUE, 2: NUE*NUA"};
399+
AxisSpec weightTypeAxis = {3, -0.5, 2.5, "0: NUE, 1: NUA, 2: total"};
400+
std::vector<double> weightBins;
401+
for (int i = 0; i <= CorrectionWeightBins; ++i) {
402+
weightBins.push_back(std::pow(10.0, -2.0 + 0.06 * i));
403+
}
404+
AxisSpec weightAxis = {weightBins, "Correction weight"};
405+
histos.add("QA/hPhiRaw", ";#varphi;Counts", {HistType::kTH1D, {phiQaAxis}});
406+
histos.add("QA/hPhiNUA", ";#varphi;Weighted counts", {HistType::kTH1D, {phiQaAxis}});
407+
histos.add("QA/hPtCentStage", "", {HistType::kTH3D, {ptAxis, centAxis, correctionStageAxis}});
408+
histos.add("QA/hWeightPtType", "", {HistType::kTH3D, {ptAxis, weightAxis, weightTypeAxis}});
409+
histos.add("QA/hCorrectionSummary", "", {HistType::kTH1D, {{8, 0.5, 8.5}}});
410+
const char* correctionLabels[] = {"selected", "ptOutsideEffAxis", "invalidEfficiency", "accepted", "sumW", "sumW2", "NUAWeightAbove10", "invalidWeight"};
411+
for (int i = 0; i < CorrectionSummaryBins; ++i) {
412+
histos.get<TH1>(HIST("QA/hCorrectionSummary"))->GetXaxis()->SetBinLabel(i + 1, correctionLabels[i]);
413+
}
414+
histos.get<TH1>(HIST("QA/hPhiNUA"))->Sumw2();
415+
histos.get<TH3>(HIST("QA/hPtCentStage"))->Sumw2();
416+
histos.get<TH1>(HIST("QA/hCorrectionSummary"))->Sumw2();
392417
histos.add("psi2/h_Ref03Gap22", "", {HistType::kTProfile, {centAxis}});
393418
histos.add("psi2/h_PoiN03Gap22", "", {HistType::kTProfile2D, {ptAxis, centAxis}});
394419
histos.add("psi2/h_PoiP03Gap22", "", {HistType::kTProfile2D, {ptAxis, centAxis}});
@@ -955,18 +980,20 @@ struct FlowEseTask {
955980
if (!selectionTrack(trk)) {
956981
continue;
957982
}
958-
if (fillEse) {
959-
const std::array<double, 3> values = {centrality, trk.pt(), std::cos(static_cast<float>(nmode) * (trk.phi() - esePlane))};
960-
histEseVn->Fill(values.data());
961-
}
962-
if (!fillGfw) {
963-
continue;
983+
if (fillGfw) {
984+
histos.fill(HIST("QA/hCorrectionSummary"), 1.0);
964985
}
965986
double weff = 1.0;
966987
double wacc = 1.0;
967988
if (cfgGfwParam.cfgGfwEffCor && gfwState.gfwEffMap != nullptr) {
989+
if (fillGfw && (trk.pt() < gfwState.gfwEffMap->GetXaxis()->GetXmin() || trk.pt() >= gfwState.gfwEffMap->GetXaxis()->GetXmax())) {
990+
histos.fill(HIST("QA/hCorrectionSummary"), 2.0);
991+
}
968992
const double efficiency = gfwState.gfwEffMap->GetBinContent(gfwState.gfwEffMap->FindBin(trk.pt()));
969993
if (efficiency <= 0.0) {
994+
if (fillGfw) {
995+
histos.fill(HIST("QA/hCorrectionSummary"), 3.0);
996+
}
970997
continue;
971998
}
972999
weff = 1.0 / efficiency;
@@ -975,6 +1002,31 @@ struct FlowEseTask {
9751002
wacc = gfwState.gfwAccWeights->getNUA(trk.phi(), trk.eta(), collision.posZ());
9761003
}
9771004
const double trackWeight = weff * wacc;
1005+
if (fillEse) {
1006+
const std::array<double, 3> values = {centrality, trk.pt(), std::cos(static_cast<float>(nmode) * (trk.phi() - esePlane))};
1007+
histEseVn->Fill(values.data(), trackWeight);
1008+
}
1009+
if (!fillGfw) {
1010+
continue;
1011+
}
1012+
if (std::isfinite(trackWeight) && trackWeight > 0.0) {
1013+
histos.fill(HIST("QA/hPhiRaw"), trk.phi());
1014+
histos.fill(HIST("QA/hPhiNUA"), trk.phi(), wacc);
1015+
histos.fill(HIST("QA/hPtCentStage"), trk.pt(), centrality, 0.0);
1016+
histos.fill(HIST("QA/hPtCentStage"), trk.pt(), centrality, 1.0, weff);
1017+
histos.fill(HIST("QA/hPtCentStage"), trk.pt(), centrality, 2.0, trackWeight);
1018+
histos.fill(HIST("QA/hWeightPtType"), trk.pt(), weff, 0.0);
1019+
histos.fill(HIST("QA/hWeightPtType"), trk.pt(), wacc, 1.0);
1020+
histos.fill(HIST("QA/hWeightPtType"), trk.pt(), trackWeight, 2.0);
1021+
histos.fill(HIST("QA/hCorrectionSummary"), 4.0);
1022+
histos.fill(HIST("QA/hCorrectionSummary"), 5.0, trackWeight);
1023+
histos.fill(HIST("QA/hCorrectionSummary"), 6.0, trackWeight * trackWeight);
1024+
if (wacc > LargeNUAWeightThreshold) {
1025+
histos.fill(HIST("QA/hCorrectionSummary"), 7.0);
1026+
}
1027+
} else {
1028+
histos.fill(HIST("QA/hCorrectionSummary"), 8.0);
1029+
}
9781030
const int ptBin = histPoiN22->GetXaxis()->FindBin(trk.pt()) - 1;
9791031
gfwState.fGFW->Fill(trk.eta(), ptBin, trk.phi(), trackWeight, GFWRefMask);
9801032
gfwState.fGFW->Fill(trk.eta(), ptBin, trk.phi(), trackWeight, GFWPoiMask);

0 commit comments

Comments
 (0)