From 190b88f00e7aefb2ab7f363bf88e3683fd2a0cf9 Mon Sep 17 00:00:00 2001 From: Luzhiyongg <71517277+Luzhiyongg@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:10:24 +0100 Subject: [PATCH] add solution function for fillCounter problem --- PWGCF/Flow/Tasks/flowTask.cxx | 2 +- .../GenericFramework/Core/FlowPtContainer.cxx | 50 +++++++++++++++++++ PWGCF/GenericFramework/Core/FlowPtContainer.h | 26 ++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index f24c5a0f9fe..6a50a55e362 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -640,7 +640,7 @@ struct FlowTask { continue; auto val = fGFW->Calculate(corrconfigsPtVn.at(l_ind), 0, kFALSE).real() / dnx; if (std::abs(val) < 1) { - (dt == kGen) ? fFCptgen->fillVnPtProfiles(centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]); + (dt == kGen) ? fFCptgen->fillVnPtProfiles(l_ind, centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(l_ind, centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]); } continue; } diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx index 33f2e303711..fd1ebbdebb7 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx @@ -112,16 +112,21 @@ void FlowPtContainer::initialise(const o2::framework::AxisSpec axis, const int& } } if (fUseGap) { + int obsIndex = 0; + fCovFirstIndex.resize(configs.GetSize(), 0); for (int i = 0; i < configs.GetSize(); ++i) { + fCovFirstIndex[i] = obsIndex; for (auto m(1); m <= mpar; ++m) { if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) continue; if (fUseCentralMoments) { for (auto j = 0; j <= m; ++j) { fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nMultiBins, &multiBins[0])); + obsIndex++; } } else { fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nMultiBins, &multiBins[0])); + obsIndex++; } } } @@ -197,16 +202,21 @@ void FlowPtContainer::initialise(int nbinsx, double* xbins, const int& m, const } } if (fUseGap) { + int obsIndex = 0; + fCovFirstIndex.resize(configs.GetSize(), 0); for (int i = 0; i < configs.GetSize(); ++i) { + fCovFirstIndex[i] = obsIndex; for (auto m(1); m <= mpar; ++m) { if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) continue; if (fUseCentralMoments) { for (auto j = 0; j <= m; ++j) { fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nbinsx, xbins)); + obsIndex++; } } else { fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xbins)); + obsIndex++; } } } @@ -280,16 +290,21 @@ void FlowPtContainer::initialise(int nbinsx, double xlow, double xhigh, const in } } if (fUseGap) { + int obsIndex = 0; + fCovFirstIndex.resize(configs.GetSize(), 0); for (int i = 0; i < configs.GetSize(); ++i) { + fCovFirstIndex[i] = obsIndex; for (auto m(1); m <= mpar; ++m) { if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) continue; if (fUseCentralMoments) { for (auto j = 0; j <= m; ++j) { fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nbinsx, xlow, xhigh)); + obsIndex++; } } else { fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xlow, xhigh)); + obsIndex++; } } } @@ -412,6 +427,41 @@ void FlowPtContainer::fillVnDeltaPtProfiles(const double& centmult, const double } return; } +void FlowPtContainer::fillVnPtCorrProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) +{ + if (!mask) { + return; + } + int startIndex = fCovFirstIndex[configIndex]; + for (auto m(1); m <= mpar; ++m) { + if (!(mask & (1 << (m - 1)))) { + continue; + } + if (corrDen[m] != 0) { + dynamic_cast(fCovList->At(startIndex))->FillProfile(centmult, flowval * corrNum[m] / corrDen[m], (fEventWeight == UnityWeight) ? 1.0 : flowtuples * corrDen[m], rn); + } + ++startIndex; + } + return; +} +void FlowPtContainer::fillVnDeltaPtProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) +{ + if (!mask) { + return; + } + int startIndex = fCovFirstIndex[configIndex]; + for (auto m(1); m <= mpar; ++m) { + if (!(mask & (1 << (m - 1)))) + continue; + for (auto i = 0; i <= m; ++i) { + if (cmDen[m] != 0) { + dynamic_cast(fCovList->At(startIndex))->FillProfile(centmult, flowval * ((i == m) ? cmVal[0] : cmVal[m * (m - 1) / 2 + i + 1]), (fEventWeight == UnityWeight) ? 1.0 : flowtuples * cmDen[m], rn); + } + ++startIndex; + } + } + return; +} void FlowPtContainer::fillVnPtCorrStdProfiles(const double& centmult, const double& rn) { double wAABBCC = getStdAABBCC(warr); diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.h b/PWGCF/GenericFramework/Core/FlowPtContainer.h index 207e1a36fe7..977fd719063 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.h +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.h @@ -59,6 +59,8 @@ class FlowPtContainer : public TNamed void fillPtProfiles(const double& lMult, const double& rn); void fillVnPtCorrProfiles(const double& lMult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); void fillVnDeltaPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); + void fillVnPtCorrProfiles(const int configIndex, const double& lMult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); + void fillVnDeltaPtProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); void fillVnDeltaPtStdProfiles(const double& centmult, const double& rn); void fillVnPtCorrStdProfiles(const double& centmult, const double& rn); void fillVnPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) @@ -68,6 +70,29 @@ class FlowPtContainer : public TNamed else fillVnPtCorrProfiles(centmult, flowval, flowtuples, rn, mask); } + void fillVnPtProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) + { + if (fUseCentralMoments) + fillVnDeltaPtProfiles(configIndex, centmult, flowval, flowtuples, rn, mask); + else + fillVnPtCorrProfiles(configIndex, centmult, flowval, flowtuples, rn, mask); + } + void skipVnPtProfiles(uint8_t mask) + { + for (auto m(1); m <= mpar; ++m) { + if (!(mask & (1 << (m - 1)))) { + continue; + } + if (fUseCentralMoments) { + for (auto i = 0; i <= m; ++i) { + ++fillCounter; + } + } else { + ++fillCounter; + } + } + return; + } void fillVnPtStdProfiles(const double& centmult, const double& rn) { if (fUseCentralMoments) @@ -129,6 +154,7 @@ class FlowPtContainer : public TNamed std::vector cmDen; //! std::vector> arr; //! std::vector warr; //! + std::vector fCovFirstIndex; //! template double getStdAABBCC(T& inarr); template