Skip to content

Commit 1e789ec

Browse files
author
Somadutta Bhatta
committed
[PWGCF] radialFlowDecorr: no bin labels on profiles and TH3, so merged outputs keep their binning
1 parent 9b9a7ab commit 1e789ec

1 file changed

Lines changed: 14 additions & 24 deletions

File tree

‎PWGCF/EbyEFluctuations/Tasks/radialFlowDecorr.cxx‎

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,13 +1549,9 @@ struct RadialFlowDecorr {
15491549
// ===========================================================================
15501550
// Histogram declarations
15511551
// ===========================================================================
1552-
void labelFwdAxis(TAxis* ax) const
1553-
{
1554-
for (int k = 0; k < nFwd && k < ax->GetNbins(); ++k) {
1555-
ax->SetBinLabel(k + 1, fwdLabels[k].c_str());
1556-
}
1557-
}
1558-
1552+
// Bin labels only on TH1/TH2 and THnSparse axes: ROOT merges labelled axes by label, which for
1553+
// profiles and TH3 extends the axis and sums all bins into a new one, or drops the entries of
1554+
// bins with zero content. Their bins are named in the axis title instead.
15591555
static void labelAxis(TAxis* ax, const std::vector<const char*>& labels)
15601556
{
15611557
for (std::size_t i = 0; i < labels.size() && static_cast<int>(i) < ax->GetNbins(); ++i) {
@@ -1694,10 +1690,8 @@ struct RadialFlowDecorr {
16941690
if (hists.fwdChannel) {
16951691
return;
16961692
}
1697-
hists.fwdChannel = histos.add<TProfile2D>("FwdQA/Prof_Channel_qa", ";channel (FT0A 0-95, FT0C 96-207, FV0A 208-255);quantity", kTProfile2D, {{KNChFT0 + KNChFV0, -0.5, KNChFT0 + KNChFV0 - 0.5}, {kNChQA, -0.5, static_cast<double>(kNChQA) - 0.5}});
1698-
labelAxis(hists.fwdChannel->GetYaxis(), {"amplitude", "gain-equalised amplitude", "#eta (aligned, vs z_{vtx})"});
1693+
hists.fwdChannel = histos.add<TProfile2D>("FwdQA/Prof_Channel_qa", ";channel (FT0A 0-95, FT0C 96-207, FV0A 208-255);quantity (0 amplitude, 1 gain-equalised amplitude, 2 #eta aligned vs z_{vtx})", kTProfile2D, {{KNChFT0 + KNChFV0, -0.5, KNChFT0 + KNChFV0 - 0.5}, {kNChQA, -0.5, static_cast<double>(kNChQA) - 0.5}});
16991694
hists.fwdEta = histos.add<TProfile>("FwdQA/Prof_Eta_fwdbin", ";forward bin;amplitude-weighted #LT#eta#GT", kTProfile, {fwdAxis});
1700-
labelFwdAxis(hists.fwdEta->GetXaxis());
17011695
}
17021696

17031697
void declareEff(uint32_t mask)
@@ -1720,8 +1714,7 @@ struct RadialFlowDecorr {
17201714
histos.add("etaTruthReco", ";#eta^{MC};#eta^{reco}", kTH2F, {{KNbinsEtaRes, -KEtaFineMax, KEtaFineMax}, {KNbinsEtaRes, -KEtaFineMax, KEtaFineMax}});
17211715
histos.add("TruthTracKVz", ";Vz^{MC};Vz^{Reco}", kTH2F, {{KNbinsVz, KVzMin, KVzMax}, {KNbinsVz, KVzMin, KVzMax}});
17221716
histos.add("vzResolution", ";Vz^{MC};(Vz^{reco}-Vz^{MC})/Vz^{MC}", kTH2F, {{KNbinsVz, KVzMin, KVzMax}, {100, -0.1, 0.1}});
1723-
hists.mcTrackOrigin = histos.add<TH3>("MCQA/Hist3D_Nch_pT_origin", ";N_{ch};p_{T} (GeV/c);origin", kTH3F, {{nchAxisObs}, {KNbinsPtRes, KPtMin, KPtMax}, {kNOrigin, -0.5, static_cast<double>(kNOrigin) - 0.5}});
1724-
labelAxis(hists.mcTrackOrigin->GetZaxis(), {"primary", "secondary", "other MC collision", "no label"});
1717+
hists.mcTrackOrigin = histos.add<TH3>("MCQA/Hist3D_Nch_pT_origin", ";N_{ch};p_{T} (GeV/c);origin (0 primary, 1 secondary, 2 other MC collision, 3 no label)", kTH3F, {{nchAxisObs}, {KNbinsPtRes, KPtMin, KPtMax}, {kNOrigin, -0.5, static_cast<double>(kNOrigin) - 0.5}});
17251718
}
17261719

17271720
// vertex QA of all MC passes
@@ -1761,11 +1754,9 @@ struct RadialFlowDecorr {
17611754
for (int l = 0; l < nLev; ++l) {
17621755
const std::string p = systPrefix(v) + (isMC ? mcDir[l] : std::string{});
17631756
auto& h = hists.mean[v][l];
1764-
h.mean = r.add<TProfile3D>((p + "Prof_Mean_Nch_etabin_obs").c_str(), ";N_{ch};#eta-bin;observable", kTProfile3D, {{nchAxisOf(v)}, {etaBinAxis}, {kNMeanObs, -0.5, static_cast<double>(kNMeanObs) - 0.5}});
1765-
labelAxis(h.mean->GetZaxis(), {"#LT[p_{T}]#GT", "#LT N#GT"});
1757+
h.mean = r.add<TProfile3D>((p + "Prof_Mean_Nch_etabin_obs").c_str(), ";N_{ch};#eta-bin;observable (0 #LT[p_{T}]#GT, 1 #LT N#GT)", kTProfile3D, {{nchAxisOf(v)}, {etaBinAxis}, {kNMeanObs, -0.5, static_cast<double>(kNMeanObs) - 0.5}});
17661758
if (cfgFwdOpt.cfgFwd) {
17671759
h.fwdMean = r.add<TProfile2D>((p + "Prof_FwdAmpMean_Nch_fwdbin").c_str(), ";N_{ch};forward bin;#LT a#GT", kTProfile2D, {{nchAxisOf(v)}, {fwdAxis}});
1768-
labelFwdAxis(h.fwdMean->GetYaxis());
17691760
}
17701761
}
17711762
}
@@ -1777,8 +1768,7 @@ struct RadialFlowDecorr {
17771768
{
17781769
FlucHists h;
17791770
auto n = [&](const char* name) { return p + name + s; };
1780-
h.obs = r.add<TProfile3D>(n("Prof_Obs_Nch_etabin_obs").c_str(), ";N_{ch};#eta-bin;observable", kTProfile3D, {{ax}, {etaBinAxis}, {kNFlucObs, -0.5, static_cast<double>(kNFlucObs) - 0.5}});
1781-
labelAxis(h.obs->GetZaxis(), {"N", "[p_{T}]", "c_{2}", "c_{3}", "C_{2}^{sub} (mirror)", "C_{3}^{sub} (mirror)"});
1771+
h.obs = r.add<TProfile3D>(n("Prof_Obs_Nch_etabin_obs").c_str(), ";N_{ch};#eta-bin;observable (0 N, 1 [p_{T}], 2 c_{2}, 3 c_{3}, 4 C_{2}^{sub} mirror, 5 C_{3}^{sub} mirror)", kTProfile3D, {{ax}, {etaBinAxis}, {kNFlucObs, -0.5, static_cast<double>(kNFlucObs) - 0.5}});
17821772
h.c2Sub2D = r.add<TProfile3D>(n("Prof_C2Sub2D_Nch_etaA_etaC").c_str(), ";N_{ch};#eta_{A};#eta_{C}", kTProfile3D, {{ax}, {etaAxis}, {etaAxis}});
17831773
h.c3Sub2D = r.add<TProfile3D>(n("Prof_C3Sub2D_Nch_etaA_etaC").c_str(), ";N_{ch};#eta_{A} (pair);#eta_{C} (single)", kTProfile3D, {{ax}, {etaAxis}, {etaAxis}});
17841774
if (withGapSum) {
@@ -1789,9 +1779,6 @@ struct RadialFlowDecorr {
17891779
h.fwdVar = r.add<TProfile2D>(n("Prof_FwdAmpVar_Nch_fwdbin").c_str(), ";N_{ch};forward bin;#LT #delta a^{2}#GT", kTProfile2D, {{ax}, {fwdAxis}});
17901780
h.covFwdPt = r.add<TProfile3D>(n("Prof_CovFwdAmpMeanpT_Nch_etabin_fwdbin").c_str(), ";N_{ch};#eta-bin;forward bin;#LT #delta[p_{T}] #delta a#GT", kTProfile3D, {{ax}, {etaBinAxis}, {fwdAxis}});
17911781
h.covFwdN = r.add<TProfile3D>(n("Prof_CovFwdAmpNch_Nch_etabin_fwdbin").c_str(), ";N_{ch};#eta-bin;forward bin;#LT #delta N #delta a#GT", kTProfile3D, {{ax}, {etaBinAxis}, {fwdAxis}});
1792-
labelFwdAxis(h.fwdVar->GetYaxis());
1793-
labelFwdAxis(h.covFwdPt->GetZaxis());
1794-
labelFwdAxis(h.covFwdN->GetZaxis());
17951782
}
17961783
return h;
17971784
}
@@ -1842,8 +1829,7 @@ struct RadialFlowDecorr {
18421829
declareFwdQA();
18431830
}
18441831
declareMean(maskAll, true);
1845-
histos.add("Prof_Weights_pT_type", ";p_{T};weight", kTProfile2D, {{KNbinsPtRes, KPtMin, KPtMax}, {3, -0.5, 2.5}});
1846-
labelAxis(histos.get<TProfile2D>(HIST("Prof_Weights_pT_type"))->GetYaxis(), {"eff", "fake", "w"});
1832+
histos.add("Prof_Weights_pT_type", ";p_{T};weight (0 eff, 1 fake, 2 w)", kTProfile2D, {{KNbinsPtRes, KPtMin, KPtMax}, {3, -0.5, 2.5}});
18471833
}
18481834

18491835
void declareMCFlucHists()
@@ -1870,8 +1856,7 @@ struct RadialFlowDecorr {
18701856
declareFwdQA();
18711857
}
18721858
declareMean(maskAll, false);
1873-
histos.add("Prof_Weights_pt_eta_type", ";p_{T} (GeV/c);#eta;weight", kTProfile3D, {{KNbinsPtRes, KPtMin, KPtMax}, {KNbinsEtaFine, -KEtaFineMax, KEtaFineMax}, {3, -0.5, 2.5}});
1874-
labelAxis(histos.get<TProfile3D>(HIST("Prof_Weights_pt_eta_type"))->GetZaxis(), {"eff", "fake", "w_{#phi}"});
1859+
histos.add("Prof_Weights_pt_eta_type", ";p_{T} (GeV/c);#eta;weight (0 eff, 1 fake, 2 w_{#phi})", kTProfile3D, {{KNbinsPtRes, KPtMin, KPtMax}, {KNbinsEtaFine, -KEtaFineMax, KEtaFineMax}, {3, -0.5, 2.5}});
18751860
}
18761861

18771862
void declareDataFlucHists()
@@ -2188,6 +2173,11 @@ struct RadialFlowDecorr {
21882173
LOGF(fatal, "%d forward bins exceed KNFwdMax=%d", nFwd, KNFwdMax);
21892174
}
21902175
fwdAxis = AxisSpec{nFwd, -0.5, nFwd - 0.5, "forward bin"};
2176+
std::string list;
2177+
for (int k = 0; k < nFwd; ++k) {
2178+
list += Form("%s%d %s", k > 0 ? ", " : "", k, fwdLabels[k].c_str());
2179+
}
2180+
LOGF(info, "RadialFlowDecorr forward bins: %s", list.c_str());
21912181
}
21922182

21932183
// ---- variations ----

0 commit comments

Comments
 (0)