From 60c78140f5f1ce86f298d081a9406fbd913f2f48 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Tue, 15 Sep 2026 23:03:48 +0200 Subject: [PATCH 1/8] add new process for simultaneous MC reco and gen --- .../Tasks/flowGenericFramework.cxx | 92 +++++++++++++------ 1 file changed, 65 insertions(+), 27 deletions(-) diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index 8bac910d2c8..0270a059d68 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -285,9 +285,10 @@ struct FlowGenericFramework { } cfg; // Define output - OutputObj fFC{FlowContainer("FlowContainer")}; - OutputObj fFCpt{FlowPtContainer("FlowPtContainer")}; - OutputObj fFCgen{FlowContainer("FlowContainer_gen")}; + OutputObj fFC{"FlowContainer"}; + OutputObj fFCpt{"FlowPtContainer"}; + OutputObj fFCgen{"FlowContainer_gen"}; + OutputObj fFCptGen{"FlowPtContainer_gen"}; HistogramRegistry registry{"registry"}; HistogramRegistry registryQA{"registryQA"}; @@ -874,23 +875,31 @@ struct FlowGenericFramework { addConfigObjectsToObjArray(oba, corrconfigsV02); addConfigObjectsToObjArray(oba, corrconfigsV0); - if (doprocessData || doprocessRun2 || doprocessMCReco) { - fFC->SetName("FlowContainer"); + if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { + fFC.setObject(new FlowContainer("FlowContainer")); fFC->SetXAxis(fPtAxis); fFC->Initialize(oba, multAxis, cfgNbootstrap); + + fFCpt.setObject(new FlowPtContainer("FlowPtContainer")); + fFCpt->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); + fFCpt->setUseCentralMoments(cfgUseCentralMoments); + fFCpt->setUseGapMethod(cfgUseGapMethod); + fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); + fFCpt->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap); } - if (doprocessMCGen || doprocessOnTheFly) { - fFCgen->SetName("FlowContainer_gen"); + if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { + fFCgen.setObject(new FlowContainer("FlowContainer_gen")); fFCgen->SetXAxis(fPtAxis); fFCgen->Initialize(oba, multAxis, cfgNbootstrap); + + fFCptGen.setObject(new FlowPtContainer("FlowPtContainer_gen")); + fFCptGen->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); + fFCptGen->setUseCentralMoments(cfgUseCentralMoments); + fFCptGen->setUseGapMethod(cfgUseGapMethod); + fFCptGen->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); + fFCptGen->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap); } delete oba; - fFCpt->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); - fFCpt->setUseCentralMoments(cfgUseCentralMoments); - fFCpt->setUseGapMethod(cfgUseGapMethod); - fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); - fFCpt->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap); - fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgTrackCuts.cfgDCAxyPtDep->c_str()), 0.001, 100); fPtDepDCAxy->SetParameter(0, cfgTrackCuts.cfgDCAxyNSigma / 7.); LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgTrackCuts.cfgDCAxyPtDep->c_str())); @@ -1596,14 +1605,17 @@ struct FlowGenericFramework { template void fillOutputContainers(const float& centmult, const double& rndm) { - fFCpt->calculateCorrelations(); - fFCpt->calculateSubeventCorrelations(); - fFCpt->fillPtProfiles(centmult, rndm); - fFCpt->fillSubeventPtProfiles(centmult, rndm); - fFCpt->fillCMProfiles(centmult, rndm); - fFCpt->fillCMSubeventProfiles(centmult, rndm); + auto& flowContainer = (dt == Gen) ? fFCgen : fFC; + auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt; + + flowPtContainer->calculateCorrelations(); + flowPtContainer->calculateSubeventCorrelations(); + flowPtContainer->fillPtProfiles(centmult, rndm); + flowPtContainer->fillSubeventPtProfiles(centmult, rndm); + flowPtContainer->fillCMProfiles(centmult, rndm); + flowPtContainer->fillCMSubeventProfiles(centmult, rndm); if (!cfgUseGapMethod) { - fFCpt->fillVnPtStdProfiles(centmult, rndm); + flowPtContainer->fillVnPtStdProfiles(centmult, rndm); } for (uint l_ind = 0; l_ind < corrconfigs.size(); ++l_ind) { @@ -1617,9 +1629,9 @@ struct FlowGenericFramework { if (corrconfigs.at(l_ind).Head.find("3pcW") != std::string::npos && cfgEventWeight.cfgUseMultiplicityFractionWeights) { dnx *= histosNpt[FractionV02][ChargedID]->Integral(); } - (dt == Gen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); if (cfgUseGapMethod) { - fFCpt->fillVnPtProfiles(centmult, val, dnx, rndm, gfwMemberCache.configs.GetpTCorrMasks()[l_ind]); + flowPtContainer->fillVnPtProfiles(centmult, val, dnx, rndm, gfwMemberCache.configs.GetpTCorrMasks()[l_ind]); } } continue; @@ -1631,7 +1643,7 @@ struct FlowGenericFramework { } auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1) { - (dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } @@ -1660,7 +1672,7 @@ struct FlowGenericFramework { if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { dnx *= dnsV02[l_ind]; } - (dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } @@ -1686,7 +1698,7 @@ struct FlowGenericFramework { if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { profileWeight *= dnsV0[l_ind]; } - (dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm); } } } @@ -1695,6 +1707,8 @@ struct FlowGenericFramework { template void fillResonanceOutput(FractionSetup setup, const float& centmult, const double& rndm) { + auto& flowContainer = (dt == Gen) ? fFCgen : fFC; + if (setup == FractionV02) { if (histosNpt[FractionV02][ChargedID]->Integral() <= 0) { return; @@ -1750,7 +1764,7 @@ struct FlowGenericFramework { if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { dnx *= dns[l_ind - 4]; } - (dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } @@ -1835,7 +1849,7 @@ struct FlowGenericFramework { } const double value = mpt * histosResoNpt[FractionV0][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4]; const double weight = cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0; - (dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm); } } } @@ -2794,6 +2808,30 @@ struct FlowGenericFramework { } PROCESS_SWITCH(FlowGenericFramework, processData, "Process analysis for non-derived data", true); + void processMC(soa::Filtered::iterator const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& particles, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::V0Datas const& v0s) + { + if (collisions.size() != 1) { + return; + } + int run = 0; + float centrality = -1; + for (const auto& collision : collisions) { + centrality = getCentrality(collision); + } + processCollision(mcCollision, particles, v0s, centrality, -999, run); + + for (const auto& collision : collisions) { + auto bc = collision.bc_as(); + run = bc.runNumber(); + if (run != lastRun) { + lastRun = run; + } + auto field = (cfgEventSelection.cfgMagField == DefaultMagneticFieldCut) ? getMagneticField(bc.timestamp()) : static_cast(cfgEventSelection.cfgMagField); + processCollision(collision, tracks, v0s, centrality, field, run); + } + } + PROCESS_SWITCH(FlowGenericFramework, processMC, "Process analysis for MC reconstructed and generated events simultaneously", false); + void processMCReco(GFWCollisions::iterator const& collision, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::McParticles const&, aod::V0Datas const& v0s) { auto bc = collision.bc_as(); From 0c9e90a37e73627582cb71d9db5e876f86e60cf9 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Wed, 16 Sep 2026 11:37:14 +0200 Subject: [PATCH 2/8] fix bug in separate processing --- .../Tasks/flowGenericFramework.cxx | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index 0270a059d68..a0ba47a0c8e 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -651,7 +651,7 @@ struct FlowGenericFramework { const int ptbins = static_cast(gfwMemberCache.ptbinning.size() - 1); fPtAxis = new TAxis(ptbins, gfwMemberCache.ptbinning.data()); - if (doprocessMCGen || doprocessOnTheFly) { + if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { if (cfgFill.cfgFillQA) { registryQA.add("MCGen/before/pt_gen", "", {HistType::kTH1D, {ptAxis}}); registryQA.add("MCGen/before/phi_eta_vtxZ_gen", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); @@ -669,7 +669,7 @@ struct FlowGenericFramework { registry.add("Efficiency/lambdaFeeddownRecoXi", "; #it{p}_{T}^{#Lambda, reco}; #it{p}_{T}^{#Xi, gen}; Centrality (%)", {HistType::kTHnSparseF, {{ptAxis, axisFeeddownXiPt, centAxis, lambdaFeeddownSpeciesAxis}}}); registry.add("Efficiency/lambdaFeeddownGeneratedXi", "; #it{p}_{T}^{#Xi, gen}; Centrality (%)", {HistType::kTHnSparseF, {{axisFeeddownXiPt, centAxis, lambdaFeeddownSpeciesAxis}}}); } - if (doprocessMCReco || doprocessData || doprocessRun2 || doprocessEfficiency) { + if (doprocessMCReco || doprocessData || doprocessRun2 || doprocessEfficiency || doprocessMC) { if (cfgFill.cfgFillQA) { registryQA.add("trackQA/before/phi_eta_vtxZ", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); registryQA.add("trackQA/before/pt_dcaXY_dcaZ", "", {HistType::kTH3D, {ptAxis, dcaXYAXis, dcaZAXis}}); @@ -1682,11 +1682,11 @@ struct FlowGenericFramework { return; } - if (fFCpt->corrDen[1] == 0.) { + if (flowPtContainer->corrDen[1] == 0.) { return; } - double dnx = fFCpt->corrDen[1]; - double mpt = fFCpt->corrNum[1] / dnx; + double dnx = flowPtContainer->corrDen[1]; + double mpt = flowPtContainer->corrNum[1] / dnx; if (std::isnan(mpt)) { return; } @@ -1708,6 +1708,7 @@ struct FlowGenericFramework { void fillResonanceOutput(FractionSetup setup, const float& centmult, const double& rndm) { auto& flowContainer = (dt == Gen) ? fFCgen : fFC; + auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt; if (setup == FractionV02) { if (histosNpt[FractionV02][ChargedID]->Integral() <= 0) { @@ -1812,25 +1813,25 @@ struct FlowGenericFramework { std::vector dns = {dnK0SB1, dnK0Sig, dnK0SB2, dnLambdaSB1, dnLambdaSig, dnLambdaSB2}; - if (fFCpt->corrDenSub[0][1] == 0. || fFCpt->corrDenSub[1][1] == 0.) { + if (flowPtContainer->corrDenSub[0][1] == 0. || flowPtContainer->corrDenSub[1][1] == 0.) { return; } double mpt = 0; double dnx = 0; if (cfgKinematics.cfgEtaPtPt->first * cfgKinematics.cfgEtaPtPt->second >= 0) { - if (fFCpt->corrDen[1] == 0.) { + if (flowPtContainer->corrDen[1] == 0.) { return; } - dnx = fFCpt->corrDen[1]; - mpt = fFCpt->corrNum[1] / dnx; + dnx = flowPtContainer->corrDen[1]; + mpt = flowPtContainer->corrNum[1] / dnx; } else { - if (fFCpt->corrDenSub[0][1] == 0. || fFCpt->corrDenSub[1][1] == 0.) { + if (flowPtContainer->corrDenSub[0][1] == 0. || flowPtContainer->corrDenSub[1][1] == 0.) { return; } - double mptSub1 = fFCpt->corrNumSub[0][1] / fFCpt->corrDenSub[0][1]; - double mptSub2 = fFCpt->corrNumSub[1][1] / fFCpt->corrDenSub[1][1]; - dnx = 0.5 * (fFCpt->corrDenSub[0][1] + fFCpt->corrDenSub[1][1]); + double mptSub1 = flowPtContainer->corrNumSub[0][1] / flowPtContainer->corrDenSub[0][1]; + double mptSub2 = flowPtContainer->corrNumSub[1][1] / flowPtContainer->corrDenSub[1][1]; + dnx = 0.5 * (flowPtContainer->corrDenSub[0][1] + flowPtContainer->corrDenSub[1][1]); mpt = 0.5 * (mptSub1 + mptSub2); } @@ -1877,7 +1878,8 @@ struct FlowGenericFramework { th1sList[run][Cent]->Fill(centrality); } fGFW->Clear(); - fFCpt->clearVector(); + auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt; + flowPtContainer->clearVector(); float lRandom = fRndm->Rndm(); // be cautious, this only works for Pb-Pb @@ -2514,6 +2516,7 @@ struct FlowGenericFramework { template inline void fillPtSums(const TTrack& track, const float& centrality, const double& vtxz) { + auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt; double wacc = (dt == Gen) ? 1. : getAcceptance(track, vtxz, 0); double weff = (dt == Gen) ? 1. : getEfficiency(track, centrality); if (weff < 0) { @@ -2522,22 +2525,22 @@ struct FlowGenericFramework { // Fill the nominal sums if (track.eta() > cfgKinematics.cfgEtaPtPt->first && track.eta() < cfgKinematics.cfgEtaPtPt->second) { - fFCpt->fill(weff, track.pt()); + flowPtContainer->fill(weff, track.pt()); } // Fill the subevent sums std::size_t index = 0; for (const auto& [etamin, etamax] : gfwMemberCache.etagapsPtPt) { if (etamin < track.eta() && track.eta() < etamax) { - fFCpt->fillSub(weff, track.pt(), index); + flowPtContainer->fillSub(weff, track.pt(), index); } ++index; } if (!cfgUseGapMethod) { std::complex q2p = {weff * wacc * std::cos(2 * track.phi()), weff * wacc * std::sin(2 * track.phi())}; std::complex q2n = {weff * wacc * std::cos(-2 * track.phi()), weff * wacc * std::sin(-2 * track.phi())}; - fFCpt->fillArray(q2p, q2n, weff * track.pt(), weff); - fFCpt->fillArray(weff * wacc, weff * wacc, weff, weff); + flowPtContainer->fillArray(q2p, q2n, weff * track.pt(), weff); + flowPtContainer->fillArray(weff * wacc, weff * wacc, weff, weff); } } From 9ca86331da490ad74c75e9f4377599ee84d90c99 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Wed, 16 Sep 2026 23:52:40 +0200 Subject: [PATCH 3/8] flowGenericFramework.cxx: Additional histograms for different event weightings --- .../GenericFramework/Core/FlowPtContainer.cxx | 39 ++ PWGCF/GenericFramework/Core/FlowPtContainer.h | 4 + .../Tasks/flowGenericFramework.cxx | 338 +++++++++++++++--- 3 files changed, 330 insertions(+), 51 deletions(-) diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx index b65c19b9047..550958e967f 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx @@ -707,6 +707,45 @@ void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn) } return; } +bool FlowPtContainer::addPtProfile(const char* name, int observableOrder) +{ + if (!fCorrList || !name || !name[0] || observableOrder < 1 || observableOrder > mpar) { + LOGF(error, "Cannot add pT profile %s for order %d", name ? name : "(null)", observableOrder); + return false; + } + const std::string profileName{name}; + if (fCorrList->FindObject(profileName.c_str())) { + LOGF(error, "pT profile %s already exists", profileName.c_str()); + return false; + } + auto* original = dynamic_cast(fCorrList->At(observableOrder - 1)); + const auto* axis = original->GetXaxis(); + BootstrapProfile* profile = nullptr; + if (axis->GetXbins()->GetSize()) { + profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXbins()->GetArray()); + } else { + profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXmin(), axis->GetXmax()); + } + if (original->fListOfEntries) { + profile->InitializeSubsamples(original->fListOfEntries->GetEntries()); + } + fCorrList->Add(profile); + return true; +} +bool FlowPtContainer::fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn) +{ + if (!fCorrList || !name || observableOrder < 1 || observableOrder > mpar || + static_cast(observableOrder) >= corrDen.size() || corrDen[observableOrder] == 0. || eventWeight == 0.) { + return false; + } + auto* profile = dynamic_cast(fCorrList->FindObject(name)); + if (!profile) { + LOGF(error, "pT profile %s has not been booked", name); + return false; + } + profile->FillProfile(mult, corrNum[observableOrder] / corrDen[observableOrder], eventWeight, rn); + return true; +} void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const double& rn) { int histCounter = 0; diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.h b/PWGCF/GenericFramework/Core/FlowPtContainer.h index f6641d108f0..8616b4c85aa 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.h +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.h @@ -67,6 +67,10 @@ class FlowPtContainer : public TNamed void calculateSubeventCorrelations(); void calculateCMTerms(); void fillPtProfiles(const double& lMult, const double& rn); + // Book and fill a separate pT observable with a weight calculated by the task. + // The task can supply a separate event weight for the same observable. + bool addPtProfile(const char* name, int observableOrder); + bool fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn); void fillSubeventPtProfiles(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); diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index a0ba47a0c8e..43268cb5742 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -135,6 +135,8 @@ struct FlowGenericFramework { O2_DEFINE_CONFIGURABLE(cfgUsePtCorrWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for pt-pt correlations"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for azimuthal correlations"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFractionWeights, bool, false, "Enable or disable the use of multiplicity-based event weighting for the spectral fraction"); + O2_DEFINE_CONFIGURABLE(cfgStoreCombinedFractionWeights, bool, false, "Store additional V02 fractions weighted by flow tuples times dnsV02, and V0 fractions and mean pT weighted by corrDen[1] times dnsV0"); + Configurable> cfgFlowProfileWeightModes{"cfgFlowProfileWeightModes", {}, "Per cfgCorrConfig: 0 uses the flow tuple denominator, 1 uses that denominator times dnsV02; empty keeps legacy behavior"}; } cfgEventWeight; struct : ConfigurableGroup{ O2_DEFINE_CONFIGURABLE(cfgEfficiencyPath, std::string, "", "CCDB path to efficiency object") @@ -290,6 +292,7 @@ struct FlowGenericFramework { OutputObj fFCgen{"FlowContainer_gen"}; OutputObj fFCptGen{"FlowPtContainer_gen"}; HistogramRegistry registry{"registry"}; + HistogramRegistry registryGen{"registryGen"}; HistogramRegistry registryQA{"registryQA"}; std::array, 14> resoCutVals{}; @@ -804,26 +807,67 @@ struct FlowGenericFramework { } } if (!doprocessEfficiency) { - registry.add("npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { + registry.add("npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + } + if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { + registryGen.add("MCGen/npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + } + if (cfgEventWeight.cfgStoreCombinedFractionWeights) { + for (const auto& name : {"npt_v02_ch", "npt_v02_pi", "npt_v02_ka", "npt_v02_pr", + "npt_v0_ch", "npt_v0_pi", "npt_v0_ka", "npt_v0_pr", + "npt_v02_K0_sig", "npt_v02_K0_sb1", "npt_v02_K0_sb2", + "npt_v02_Lambda_sig", "npt_v02_Lambda_sb1", "npt_v02_Lambda_sb2", + "npt_v0_K0_sig", "npt_v0_K0_sb1", "npt_v0_K0_sb2", + "npt_v0_Lambda_sig", "npt_v0_Lambda_sb1", "npt_v0_Lambda_sb2"}) { + const std::string source{name}; + const std::string target = source + (source.rfind("npt_v02_", 0) == 0 ? "_w3pc" : "_w2pc"); + if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { + registry.addClone(source, target); + } + if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { + registryGen.addClone("MCGen/" + source, "MCGen/" + target); + } + } + } } for (auto setup = 0; setup < FractionSetupCount; ++setup) { const char* setupName = (setup == FractionV02) ? "V02" : "V0"; @@ -854,6 +898,15 @@ struct FlowGenericFramework { if (corrconfigs.empty()) { LOGF(error, "Configuration contains vectors of different size - check the GFWCorrConfig configurable"); } + const auto& flowWeightModes = cfgEventWeight.cfgFlowProfileWeightModes.value; + if (!flowWeightModes.empty() && flowWeightModes.size() != corrconfigs.size()) { + LOGF(fatal, "cfgFlowProfileWeightModes must have one entry per cfgCorrConfig"); + } + for (const int& mode : flowWeightModes) { + if (mode != 0 && mode != 1) { + LOGF(fatal, "Invalid flow profile weight mode %d", mode); + } + } // Radial flow configs for (auto i = 0; i < gfwMemberCache.configsV02.GetSize(); ++i) { @@ -885,6 +938,13 @@ struct FlowGenericFramework { fFCpt->setUseCentralMoments(cfgUseCentralMoments); fFCpt->setUseGapMethod(cfgUseGapMethod); fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); + if (cfgEventWeight.cfgStoreCombinedFractionWeights) { + for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { + if (!fFCpt->addPtProfile(name, 1)) { + LOGF(fatal, "Could not add mean-pT profile %s", name); + } + } + } fFCpt->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap); } if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { @@ -897,6 +957,13 @@ struct FlowGenericFramework { fFCptGen->setUseCentralMoments(cfgUseCentralMoments); fFCptGen->setUseGapMethod(cfgUseGapMethod); fFCptGen->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); + if (cfgEventWeight.cfgStoreCombinedFractionWeights) { + for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { + if (!fFCptGen->addPtProfile(name, 1)) { + LOGF(fatal, "Could not add generated mean-pT profile %s", name); + } + } + } fFCptGen->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap); } delete oba; @@ -1543,6 +1610,102 @@ struct FlowGenericFramework { return dns; } + template + void fillFractionProfile(const TRecoName& recoName, const TGenName& genName, Args... args) + { + if constexpr (dt == Gen) { + registryGen.fill(genName, args...); + } else { + registry.fill(recoName, args...); + } + } + + template + void fillCombinedFractionProfile(FractionSetup setup, int index, bool resonance, double pt, double centmult, double fraction, double weight) + { + if (!cfgEventWeight.cfgStoreCombinedFractionWeights || weight <= 0.) { + return; + } + if (setup == FractionV02) { + if (resonance) { + switch (index) { + case 0: + fillFractionProfile
(HIST("npt_v02_K0_sb1_w3pc"), HIST("MCGen/npt_v02_K0_sb1_w3pc"), pt, centmult, fraction, weight); + break; + case 1: + fillFractionProfile
(HIST("npt_v02_K0_sig_w3pc"), HIST("MCGen/npt_v02_K0_sig_w3pc"), pt, centmult, fraction, weight); + break; + case 2: + fillFractionProfile
(HIST("npt_v02_K0_sb2_w3pc"), HIST("MCGen/npt_v02_K0_sb2_w3pc"), pt, centmult, fraction, weight); + break; + case 3: + fillFractionProfile
(HIST("npt_v02_Lambda_sb1_w3pc"), HIST("MCGen/npt_v02_Lambda_sb1_w3pc"), pt, centmult, fraction, weight); + break; + case 4: + fillFractionProfile
(HIST("npt_v02_Lambda_sig_w3pc"), HIST("MCGen/npt_v02_Lambda_sig_w3pc"), pt, centmult, fraction, weight); + break; + case 5: + fillFractionProfile
(HIST("npt_v02_Lambda_sb2_w3pc"), HIST("MCGen/npt_v02_Lambda_sb2_w3pc"), pt, centmult, fraction, weight); + break; + } + } else { + switch (index) { + case 0: + fillFractionProfile
(HIST("npt_v02_ch_w3pc"), HIST("MCGen/npt_v02_ch_w3pc"), pt, centmult, fraction, weight); + break; + case 1: + fillFractionProfile
(HIST("npt_v02_pi_w3pc"), HIST("MCGen/npt_v02_pi_w3pc"), pt, centmult, fraction, weight); + break; + case 2: + fillFractionProfile
(HIST("npt_v02_ka_w3pc"), HIST("MCGen/npt_v02_ka_w3pc"), pt, centmult, fraction, weight); + break; + case 3: + fillFractionProfile
(HIST("npt_v02_pr_w3pc"), HIST("MCGen/npt_v02_pr_w3pc"), pt, centmult, fraction, weight); + break; + } + } + } else { + if (resonance) { + switch (index) { + case 0: + fillFractionProfile
(HIST("npt_v0_K0_sb1_w2pc"), HIST("MCGen/npt_v0_K0_sb1_w2pc"), pt, centmult, fraction, weight); + break; + case 1: + fillFractionProfile
(HIST("npt_v0_K0_sig_w2pc"), HIST("MCGen/npt_v0_K0_sig_w2pc"), pt, centmult, fraction, weight); + break; + case 2: + fillFractionProfile
(HIST("npt_v0_K0_sb2_w2pc"), HIST("MCGen/npt_v0_K0_sb2_w2pc"), pt, centmult, fraction, weight); + break; + case 3: + fillFractionProfile
(HIST("npt_v0_Lambda_sb1_w2pc"), HIST("MCGen/npt_v0_Lambda_sb1_w2pc"), pt, centmult, fraction, weight); + break; + case 4: + fillFractionProfile
(HIST("npt_v0_Lambda_sig_w2pc"), HIST("MCGen/npt_v0_Lambda_sig_w2pc"), pt, centmult, fraction, weight); + break; + case 5: + fillFractionProfile
(HIST("npt_v0_Lambda_sb2_w2pc"), HIST("MCGen/npt_v0_Lambda_sb2_w2pc"), pt, centmult, fraction, weight); + break; + } + } else { + switch (index) { + case 0: + fillFractionProfile
(HIST("npt_v0_ch_w2pc"), HIST("MCGen/npt_v0_ch_w2pc"), pt, centmult, fraction, weight); + break; + case 1: + fillFractionProfile
(HIST("npt_v0_pi_w2pc"), HIST("MCGen/npt_v0_pi_w2pc"), pt, centmult, fraction, weight); + break; + case 2: + fillFractionProfile
(HIST("npt_v0_ka_w2pc"), HIST("MCGen/npt_v0_ka_w2pc"), pt, centmult, fraction, weight); + break; + case 3: + fillFractionProfile
(HIST("npt_v0_pr_w2pc"), HIST("MCGen/npt_v0_pr_w2pc"), pt, centmult, fraction, weight); + break; + } + } + } + } + + template void fillNptRegistry(FractionSetup setup, const float& centmult, const NptHistos& nptHistos, const NptDenominators& dns) { if (dns[ChargedID] <= 0) { @@ -1551,26 +1714,26 @@ struct FlowGenericFramework { for (int i = 1; i <= fPtAxis->GetNbins(); ++i) { if (setup == FractionV02) { - registry.fill(HIST("npt_v02_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); + fillFractionProfile
(HIST("npt_v02_ch"), HIST("MCGen/npt_v02_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); if (dns[PionID] > 0) { - registry.fill(HIST("npt_v02_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); + fillFractionProfile
(HIST("npt_v02_pi"), HIST("MCGen/npt_v02_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); } if (dns[KaonID] > 0) { - registry.fill(HIST("npt_v02_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); + fillFractionProfile
(HIST("npt_v02_ka"), HIST("MCGen/npt_v02_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); } if (dns[ProtonID] > 0) { - registry.fill(HIST("npt_v02_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); + fillFractionProfile
(HIST("npt_v02_pr"), HIST("MCGen/npt_v02_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); } } else { - registry.fill(HIST("npt_v0_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); + fillFractionProfile
(HIST("npt_v0_ch"), HIST("MCGen/npt_v0_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); if (dns[PionID] > 0) { - registry.fill(HIST("npt_v0_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); + fillFractionProfile
(HIST("npt_v0_pi"), HIST("MCGen/npt_v0_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); } if (dns[KaonID] > 0) { - registry.fill(HIST("npt_v0_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); + fillFractionProfile
(HIST("npt_v0_ka"), HIST("MCGen/npt_v0_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); } if (dns[ProtonID] > 0) { - registry.fill(HIST("npt_v0_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); + fillFractionProfile
(HIST("npt_v0_pr"), HIST("MCGen/npt_v0_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); } } } @@ -1607,6 +1770,14 @@ struct FlowGenericFramework { { auto& flowContainer = (dt == Gen) ? fFCgen : fFC; auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt; + const auto& nptV02 = histosNpt[FractionV02]; + const auto& nptV0 = histosNpt[FractionV0]; + const auto dnsV02 = getNptDenominators(nptV02); + const auto dnsV0 = getNptDenominators(nptV0); + const auto& flowWeightModes = cfgEventWeight.cfgFlowProfileWeightModes.value; + auto useV02Denominator = [&](uint index) { + return flowWeightModes.empty() ? (cfgEventWeight.cfgUseMultiplicityFractionWeights && corrconfigs[index].Head.find("3pcW") != std::string::npos) : flowWeightModes[index] == 1; + }; flowPtContainer->calculateCorrelations(); flowPtContainer->calculateSubeventCorrelations(); @@ -1626,8 +1797,8 @@ struct FlowGenericFramework { } auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx; if (std::abs(val) < 1) { - if (corrconfigs.at(l_ind).Head.find("3pcW") != std::string::npos && cfgEventWeight.cfgUseMultiplicityFractionWeights) { - dnx *= histosNpt[FractionV02][ChargedID]->Integral(); + if (useV02Denominator(l_ind)) { + dnx *= dnsV02[ChargedID]; } flowContainer->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); if (cfgUseGapMethod) { @@ -1643,18 +1814,22 @@ struct FlowGenericFramework { } auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1) { + if (useV02Denominator(l_ind)) { + dnx *= dnsV02[ChargedID]; + } flowContainer->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } - const auto& nptV02 = histosNpt[FractionV02]; - const auto& nptV0 = histosNpt[FractionV0]; - auto dnsV02 = getNptDenominators(nptV02); - auto dnsV0 = getNptDenominators(nptV0); - - fillNptRegistry(FractionV02, centmult, nptV02, dnsV02); - fillNptRegistry(FractionV0, centmult, nptV0, dnsV0); + fillNptRegistry
(FractionV02, centmult, nptV02, dnsV02); + fillNptRegistry
(FractionV0, centmult, nptV0, dnsV0); + if (cfgEventWeight.cfgStoreCombinedFractionWeights && flowPtContainer->corrDen[1] > 0.) { + constexpr std::array ProfileNames = {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}; + for (int species = 0; species < SpeciesCount; ++species) { + flowPtContainer->fillPtProfile(ProfileNames[species], 1, centmult, flowPtContainer->corrDen[1] * dnsV0[species], rndm); + } + } if (corrconfigsV02.size() < SpeciesCount) { return; @@ -1669,6 +1844,7 @@ struct FlowGenericFramework { } auto val = fGFW->Calculate(corrconfigsV02.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1 && dnsV02[l_ind] > 0) { + fillCombinedFractionProfile
(FractionV02, l_ind, false, fPtAxis->GetBinCenter(i), centmult, nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], dnx * dnsV02[l_ind]); if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { dnx *= dnsV02[l_ind]; } @@ -1694,6 +1870,7 @@ struct FlowGenericFramework { for (uint l_ind = 0; l_ind < SpeciesCount; ++l_ind) { for (int i = 1; i <= fPtAxis->GetNbins(); i++) { if (dnsV0[l_ind] > 0) { + fillCombinedFractionProfile
(FractionV0, l_ind, false, fPtAxis->GetBinCenter(i), centmult, nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], dnx * dnsV0[l_ind]); double profileWeight = dnx; if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { profileWeight *= dnsV0[l_ind]; @@ -1733,22 +1910,22 @@ struct FlowGenericFramework { for (int i = 1; i <= fPtAxis->GetNbins(); ++i) { if (dnK0SB1 > 0) { - registry.fill(HIST("npt_v02_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); + fillFractionProfile
(HIST("npt_v02_K0_sb1"), HIST("MCGen/npt_v02_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); } if (dnK0Sig > 0) { - registry.fill(HIST("npt_v02_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Signal]->GetBinContent(i) / dnK0Sig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); + fillFractionProfile
(HIST("npt_v02_K0_sig"), HIST("MCGen/npt_v02_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Signal]->GetBinContent(i) / dnK0Sig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); } if (dnK0SB2 > 0) { - registry.fill(HIST("npt_v02_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); + fillFractionProfile
(HIST("npt_v02_K0_sb2"), HIST("MCGen/npt_v02_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); } if (dnLambdaSB1 > 0) { - registry.fill(HIST("npt_v02_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); + fillFractionProfile
(HIST("npt_v02_Lambda_sb1"), HIST("MCGen/npt_v02_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); } if (dnLambdaSig > 0) { - registry.fill(HIST("npt_v02_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); + fillFractionProfile
(HIST("npt_v02_Lambda_sig"), HIST("MCGen/npt_v02_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); } if (dnLambdaSB2 > 0) { - registry.fill(HIST("npt_v02_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); + fillFractionProfile
(HIST("npt_v02_Lambda_sb2"), HIST("MCGen/npt_v02_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); } } @@ -1762,6 +1939,7 @@ struct FlowGenericFramework { } auto val = fGFW->Calculate(corrconfigsV02.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1 && dns[l_ind - 4] > 0) { + fillCombinedFractionProfile
(FractionV02, l_ind - SpeciesCount, true, fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][l_ind - SpeciesCount]->GetBinContent(i) / dns[l_ind - SpeciesCount], dnx * dns[l_ind - SpeciesCount]); if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { dnx *= dns[l_ind - 4]; } @@ -1792,22 +1970,22 @@ struct FlowGenericFramework { for (int i = 1; i <= fPtAxis->GetNbins(); ++i) { if (dnK0SB1 > 0) { - registry.fill(HIST("npt_v0_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); + fillFractionProfile
(HIST("npt_v0_K0_sb1"), HIST("MCGen/npt_v0_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); } if (dnK0Sig > 0) { - registry.fill(HIST("npt_v0_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Signal]->GetBinContent(i) / dnK0Sig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); + fillFractionProfile
(HIST("npt_v0_K0_sig"), HIST("MCGen/npt_v0_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Signal]->GetBinContent(i) / dnK0Sig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); } if (dnK0SB2 > 0) { - registry.fill(HIST("npt_v0_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); + fillFractionProfile
(HIST("npt_v0_K0_sb2"), HIST("MCGen/npt_v0_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); } if (dnLambdaSB1 > 0) { - registry.fill(HIST("npt_v0_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); + fillFractionProfile
(HIST("npt_v0_Lambda_sb1"), HIST("MCGen/npt_v0_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); } if (dnLambdaSig > 0) { - registry.fill(HIST("npt_v0_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); + fillFractionProfile
(HIST("npt_v0_Lambda_sig"), HIST("MCGen/npt_v0_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); } if (dnLambdaSB2 > 0) { - registry.fill(HIST("npt_v0_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); + fillFractionProfile
(HIST("npt_v0_Lambda_sb2"), HIST("MCGen/npt_v0_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); } } @@ -1850,6 +2028,7 @@ struct FlowGenericFramework { } const double value = mpt * histosResoNpt[FractionV0][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4]; const double weight = cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0; + fillCombinedFractionProfile
(FractionV0, l_ind - SpeciesCount, true, fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][l_ind - SpeciesCount]->GetBinContent(i) / dns[l_ind - SpeciesCount], flowPtContainer->corrDen[1] * dns[l_ind - SpeciesCount]); flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm); } } @@ -2732,6 +2911,8 @@ struct FlowGenericFramework { using GFWMCTracks = soa::Filtered>; SliceCache cache; + Preslice mcTracksPerCollision = aod::track::collisionId; + Preslice mcV0sPerCollision = aod::v0data::collisionId; Partition posTracks = aod::track::signed1Pt > 0.0f; Partition negTracks = aod::track::signed1Pt < 0.0f; @@ -2811,7 +2992,7 @@ struct FlowGenericFramework { } PROCESS_SWITCH(FlowGenericFramework, processData, "Process analysis for non-derived data", true); - void processMC(soa::Filtered::iterator const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& particles, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::V0Datas const& v0s) + void processMC(soa::Filtered::iterator const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& particles, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::V0Datas const& v0s) { if (collisions.size() != 1) { return; @@ -2828,9 +3009,64 @@ struct FlowGenericFramework { run = bc.runNumber(); if (run != lastRun) { lastRun = run; + if (cfgFill.cfgFillRunByRunQA) { + createRunByRunHistograms(run); + } + if (!cfgFill.cfgFillWeights && cfgRunByRun) { + loadCorrections(bc); + } + } + if (!cfgFill.cfgFillWeights && !cfgRunByRun) { + loadCorrections(bc); + } + + registryQA.fill(HIST("eventQA/eventSel"), 0.5); + if (cfgFill.cfgFillRunByRunQA) { + th1sList[run][EventSel]->Fill(0.5); + } + + if (!collision.sel8()) { + return; + } + + registryQA.fill(HIST("eventQA/eventSel"), 1.5); + if (cfgFill.cfgFillRunByRunQA) { + th1sList[run][EventSel]->Fill(1.5); + } + + const auto centrality = getCentrality(collision); + + if (cfgEventSelection.cfgOccupancySelection >= 0) { + int occupancy = collision.trackOccupancyInTimeRange(); + if (cfgFill.cfgFillQA) { + registryQA.fill(HIST("eventQA/before/occ_mult_cent"), occupancy, tracks.size(), centrality); + } + if (occupancy < 0 || occupancy > cfgEventSelection.cfgOccupancySelection) { + return; + } + if (cfgFill.cfgFillQA) { + registryQA.fill(HIST("eventQA/after/occ_mult_cent"), occupancy, tracks.size(), centrality); + } } + registryQA.fill(HIST("eventQA/eventSel"), 2.5); + if (cfgFill.cfgFillRunByRunQA) { + th1sList[run][EventSel]->Fill(2.5); + } + + if (cfgFill.cfgFillQA) { + fillEventQA(collision, tracks); + } + if (!eventSelected(collision, tracks.size(), centrality, run)) { + return; + } + if (cfgFill.cfgFillQA) { + fillEventQA(collision, tracks); + } + auto field = (cfgEventSelection.cfgMagField == DefaultMagneticFieldCut) ? getMagneticField(bc.timestamp()) : static_cast(cfgEventSelection.cfgMagField); - processCollision(collision, tracks, v0s, centrality, field, run); + const auto groupedTracks = tracks.sliceBy(mcTracksPerCollision, collision.globalIndex()); + const auto groupedV0s = v0s.sliceBy(mcV0sPerCollision, collision.globalIndex()); + processCollision(collision, groupedTracks, groupedV0s, centrality, field, run); } } PROCESS_SWITCH(FlowGenericFramework, processMC, "Process analysis for MC reconstructed and generated events simultaneously", false); From 698027946e9680c3543fccd905f594d923942095 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Thu, 17 Sep 2026 00:29:22 +0200 Subject: [PATCH 4/8] add configurable to switch between species analyses --- .../Tasks/flowGenericFramework.cxx | 231 +++++++++++------- 1 file changed, 140 insertions(+), 91 deletions(-) diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index 43268cb5742..81aa9344b8d 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -131,6 +131,10 @@ struct FlowGenericFramework { O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") O2_DEFINE_CONFIGURABLE(cfgUsePID, bool, true, "Enable PID information") O2_DEFINE_CONFIGURABLE(cfgUseGapMethod, bool, false, "Use gap method in vn-pt calculations") + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgAnalyseChargedHadrons, bool, true, "Store radial-flow and fraction outputs for charged tracks, pions, kaons, and protons"); + O2_DEFINE_CONFIGURABLE(cfgAnalyseK0Lambda, bool, true, "Store radial-flow and fraction outputs for K0 and Lambda candidates"); + } cfgAnalysisChannels; struct : ConfigurableGroup { O2_DEFINE_CONFIGURABLE(cfgUsePtCorrWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for pt-pt correlations"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for azimuthal correlations"); @@ -531,6 +535,9 @@ struct FlowGenericFramework { void init(InitContext const&) { LOGF(info, "FlowGenericFramework::init()"); + if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons && !cfgAnalysisChannels.cfgAnalyseK0Lambda) { + LOGF(fatal, "Enable at least one radial-flow analysis channel"); + } gfwMemberCache.regions.SetNames(cfgRegions->GetNames()); gfwMemberCache.regions.SetEtaMin(cfgRegions->GetEtaMin()); gfwMemberCache.regions.SetEtaMax(cfgRegions->GetEtaMax()); @@ -734,11 +741,11 @@ struct FlowGenericFramework { AxisSpec axisLambdaMass = {resoSwitchVals[MassBins][Lambda], resoCutVals[MassMin][Lambda], resoCutVals[MassMax][Lambda]}; AxisSpec yAxis = {100, -1, 1}; // QA histograms for V0s - if (cfgFill.cfgFillV0QA && (resoSwitchVals[UseParticle][K0] != 0 || resoSwitchVals[UseParticle][Lambda] != 0)) { + if (cfgAnalysisChannels.cfgAnalyseK0Lambda && cfgFill.cfgFillV0QA && (resoSwitchVals[UseParticle][K0] != 0 || resoSwitchVals[UseParticle][Lambda] != 0)) { registryQA.add("trackQA/after/etaV02", "; #eta; Counts", {HistType::kTH1D, {etaAxis}}); registryQA.add("trackQA/after/etaV0", "; #eta; Counts", {HistType::kTH1D, {etaAxis}}); } - if (resoSwitchVals[UseParticle][K0] != 0) { + if (cfgAnalysisChannels.cfgAnalyseK0Lambda && resoSwitchVals[UseParticle][K0] != 0) { if (cfgFill.cfgFillV0QA) { registryQA.add("K0/PiPlusTPC_K0", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); registryQA.add("K0/PiMinusTPC_K0", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); @@ -768,7 +775,7 @@ struct FlowGenericFramework { registryQA.get(HIST("K0/hK0Count"))->GetXaxis()->SetBinLabel(FillV0DaughterTrackSelection, "v0 Daughter eta selection"); } - if (resoSwitchVals[UseParticle][Lambda] != 0) { + if (cfgAnalysisChannels.cfgAnalyseK0Lambda && resoSwitchVals[UseParticle][Lambda] != 0) { if (cfgFill.cfgFillV0QA) { registryQA.add("Lambda/PrPlusTPC_L", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); registryQA.add("Lambda/PiMinusTPC_L", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); @@ -808,48 +815,56 @@ struct FlowGenericFramework { } if (!doprocessEfficiency) { if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { - registry.add("npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registry.add("npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + registry.add("npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + } + if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + registry.add("npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registry.add("npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + } } if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { - registryGen.add("MCGen/npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); - registryGen.add("MCGen/npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + registryGen.add("MCGen/npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + } + if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + registryGen.add("MCGen/npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v02_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_Lambda_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_Lambda_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + registryGen.add("MCGen/npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); + } } if (cfgEventWeight.cfgStoreCombinedFractionWeights) { for (const auto& name : {"npt_v02_ch", "npt_v02_pi", "npt_v02_ka", "npt_v02_pr", @@ -859,6 +874,10 @@ struct FlowGenericFramework { "npt_v0_K0_sig", "npt_v0_K0_sb1", "npt_v0_K0_sb2", "npt_v0_Lambda_sig", "npt_v0_Lambda_sb1", "npt_v0_Lambda_sb2"}) { const std::string source{name}; + const bool resonance = source.find("_K0") != std::string::npos || source.find("_Lambda") != std::string::npos; + if (resonance ? !cfgAnalysisChannels.cfgAnalyseK0Lambda : !cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + continue; + } const std::string target = source + (source.rfind("npt_v02_", 0) == 0 ? "_w3pc" : "_w2pc"); if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { registry.addClone(source, target); @@ -877,13 +896,15 @@ struct FlowGenericFramework { histosNpt[setup][KaonID] = std::make_unique(Form("npt%sKa", setupName), "; #it{p}_{T} (GeV/#it{c}; Count)", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); histosNpt[setup][ProtonID] = std::make_unique(Form("npt%sPr", setupName), "; #it{p}_{T} (GeV/#it{c}; Count)", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - histosResoNpt[setup].resize(ResonanceCount); - histosResoNpt[setup][K0Sideband1] = std::make_unique(Form("npt%sK0SB1", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - histosResoNpt[setup][K0Signal] = std::make_unique(Form("npt%sK0Sig", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - histosResoNpt[setup][K0Sideband2] = std::make_unique(Form("npt%sK0SB2", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - histosResoNpt[setup][LambdaSideband1] = std::make_unique(Form("npt%sLambdaSB1", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - histosResoNpt[setup][LambdaSignal] = std::make_unique(Form("npt%sLambdaSig", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - histosResoNpt[setup][LambdaSideband2] = std::make_unique(Form("npt%sLambdaSB2", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + histosResoNpt[setup].resize(ResonanceCount); + histosResoNpt[setup][K0Sideband1] = std::make_unique(Form("npt%sK0SB1", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + histosResoNpt[setup][K0Signal] = std::make_unique(Form("npt%sK0Sig", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + histosResoNpt[setup][K0Sideband2] = std::make_unique(Form("npt%sK0SB2", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + histosResoNpt[setup][LambdaSideband1] = std::make_unique(Form("npt%sLambdaSB1", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + histosResoNpt[setup][LambdaSignal] = std::make_unique(Form("npt%sLambdaSig", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + histosResoNpt[setup][LambdaSideband2] = std::make_unique(Form("npt%sLambdaSB2", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); + } } if (gfwMemberCache.regions.GetSize() < 0) { @@ -924,9 +945,19 @@ struct FlowGenericFramework { fGFW->CreateRegions(); auto oba = new TObjArray(); - addConfigObjectsToObjArray(oba, corrconfigs); - addConfigObjectsToObjArray(oba, corrconfigsV02); - addConfigObjectsToObjArray(oba, corrconfigsV0); + addConfigObjectsToObjArray(oba, corrconfigs, 0, corrconfigs.size()); + if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + addConfigObjectsToObjArray(oba, corrconfigsV02, 0, std::min(SpeciesCount, corrconfigsV02.size())); + } + if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + addConfigObjectsToObjArray(oba, corrconfigsV02, std::min(SpeciesCount, corrconfigsV02.size()), corrconfigsV02.size()); + } + if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + addConfigObjectsToObjArray(oba, corrconfigsV0, 0, std::min(SpeciesCount, corrconfigsV0.size())); + } + if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + addConfigObjectsToObjArray(oba, corrconfigsV0, std::min(SpeciesCount, corrconfigsV0.size()), corrconfigsV0.size()); + } if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { fFC.setObject(new FlowContainer("FlowContainer")); @@ -940,6 +971,9 @@ struct FlowGenericFramework { fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); if (cfgEventWeight.cfgStoreCombinedFractionWeights) { for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { + if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { + continue; + } if (!fFCpt->addPtProfile(name, 1)) { LOGF(fatal, "Could not add mean-pT profile %s", name); } @@ -959,6 +993,9 @@ struct FlowGenericFramework { fFCptGen->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); if (cfgEventWeight.cfgStoreCombinedFractionWeights) { for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { + if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { + continue; + } if (!fFCptGen->addPtProfile(name, 1)) { LOGF(fatal, "Could not add generated mean-pT profile %s", name); } @@ -1129,9 +1166,9 @@ struct FlowGenericFramework { After }; - void addConfigObjectsToObjArray(TObjArray* oba, const std::vector& configs) + void addConfigObjectsToObjArray(TObjArray* oba, const std::vector& configs, size_t first, size_t last) { - for (auto it = configs.begin(); it != configs.end(); ++it) { + for (auto it = configs.begin() + first; it != configs.begin() + last; ++it) { if (it->pTDif) { std::string suffix = "_ptDiff"; for (auto i = 0; i < fPtAxis->GetNbins(); ++i) { @@ -1623,7 +1660,8 @@ struct FlowGenericFramework { template void fillCombinedFractionProfile(FractionSetup setup, int index, bool resonance, double pt, double centmult, double fraction, double weight) { - if (!cfgEventWeight.cfgStoreCombinedFractionWeights || weight <= 0.) { + if (!cfgEventWeight.cfgStoreCombinedFractionWeights || weight <= 0. || + (resonance ? !cfgAnalysisChannels.cfgAnalyseK0Lambda : !cfgAnalysisChannels.cfgAnalyseChargedHadrons)) { return; } if (setup == FractionV02) { @@ -1708,7 +1746,7 @@ struct FlowGenericFramework { template void fillNptRegistry(FractionSetup setup, const float& centmult, const NptHistos& nptHistos, const NptDenominators& dns) { - if (dns[ChargedID] <= 0) { + if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons || dns[ChargedID] <= 0) { return; } @@ -1827,15 +1865,18 @@ struct FlowGenericFramework { if (cfgEventWeight.cfgStoreCombinedFractionWeights && flowPtContainer->corrDen[1] > 0.) { constexpr std::array ProfileNames = {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}; for (int species = 0; species < SpeciesCount; ++species) { + if (species != ChargedID && !cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + continue; + } flowPtContainer->fillPtProfile(ProfileNames[species], 1, centmult, flowPtContainer->corrDen[1] * dnsV0[species], rndm); } } - if (corrconfigsV02.size() < SpeciesCount) { + if (cfgAnalysisChannels.cfgAnalyseChargedHadrons && corrconfigsV02.size() < SpeciesCount) { return; } - if (dnsV02[ChargedID] > 0) { + if (cfgAnalysisChannels.cfgAnalyseChargedHadrons && dnsV02[ChargedID] > 0) { for (uint l_ind = 0; l_ind < SpeciesCount; ++l_ind) { for (int i = 1; i <= fPtAxis->GetNbins(); i++) { auto dnx = fGFW->Calculate(corrconfigsV02.at(l_ind), i - 1, kTRUE).real(); @@ -1854,6 +1895,9 @@ struct FlowGenericFramework { } } + if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + return; + } if (corrconfigsV0.size() < SpeciesCount) { return; } @@ -1884,8 +1928,11 @@ struct FlowGenericFramework { template void fillResonanceOutput(FractionSetup setup, const float& centmult, const double& rndm) { + if (!cfgAnalysisChannels.cfgAnalyseK0Lambda) { + return; + } auto& flowContainer = (dt == Gen) ? fFCgen : fFC; - auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt; + const auto& flowPtContainer = (dt == Gen) ? *fFCptGen : *fFCpt; if (setup == FractionV02) { if (histosNpt[FractionV02][ChargedID]->Integral() <= 0) { @@ -1991,25 +2038,25 @@ struct FlowGenericFramework { std::vector dns = {dnK0SB1, dnK0Sig, dnK0SB2, dnLambdaSB1, dnLambdaSig, dnLambdaSB2}; - if (flowPtContainer->corrDenSub[0][1] == 0. || flowPtContainer->corrDenSub[1][1] == 0.) { + if (flowPtContainer.corrDenSub[0][1] == 0. || flowPtContainer.corrDenSub[1][1] == 0.) { return; } double mpt = 0; double dnx = 0; if (cfgKinematics.cfgEtaPtPt->first * cfgKinematics.cfgEtaPtPt->second >= 0) { - if (flowPtContainer->corrDen[1] == 0.) { + if (flowPtContainer.corrDen[1] == 0.) { return; } - dnx = flowPtContainer->corrDen[1]; - mpt = flowPtContainer->corrNum[1] / dnx; + dnx = flowPtContainer.corrDen[1]; + mpt = flowPtContainer.corrNum[1] / dnx; } else { - if (flowPtContainer->corrDenSub[0][1] == 0. || flowPtContainer->corrDenSub[1][1] == 0.) { + if (flowPtContainer.corrDenSub[0][1] == 0. || flowPtContainer.corrDenSub[1][1] == 0.) { return; } - double mptSub1 = flowPtContainer->corrNumSub[0][1] / flowPtContainer->corrDenSub[0][1]; - double mptSub2 = flowPtContainer->corrNumSub[1][1] / flowPtContainer->corrDenSub[1][1]; - dnx = 0.5 * (flowPtContainer->corrDenSub[0][1] + flowPtContainer->corrDenSub[1][1]); + double mptSub1 = flowPtContainer.corrNumSub[0][1] / flowPtContainer.corrDenSub[0][1]; + double mptSub2 = flowPtContainer.corrNumSub[1][1] / flowPtContainer.corrDenSub[1][1]; + dnx = 0.5 * (flowPtContainer.corrDenSub[0][1] + flowPtContainer.corrDenSub[1][1]); mpt = 0.5 * (mptSub1 + mptSub2); } @@ -2028,7 +2075,7 @@ struct FlowGenericFramework { } const double value = mpt * histosResoNpt[FractionV0][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4]; const double weight = cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0; - fillCombinedFractionProfile
(FractionV0, l_ind - SpeciesCount, true, fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][l_ind - SpeciesCount]->GetBinContent(i) / dns[l_ind - SpeciesCount], flowPtContainer->corrDen[1] * dns[l_ind - SpeciesCount]); + fillCombinedFractionProfile
(FractionV0, l_ind - SpeciesCount, true, fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][l_ind - SpeciesCount]->GetBinContent(i) / dns[l_ind - SpeciesCount], flowPtContainer.corrDen[1] * dns[l_ind - SpeciesCount]); flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm); } } @@ -2133,27 +2180,29 @@ struct FlowGenericFramework { fillOutputContainers
((cfgUseNch) ? multiplicity : centrality, lRandom); - // Reset fraction histograms per event - for (const auto& vec : histosResoNpt) { - for (const auto& h : vec) { - h->Reset("ICESM"); + if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + // Reset fraction histograms per event + for (const auto& vec : histosResoNpt) { + for (const auto& h : vec) { + h->Reset("ICESM"); + } } - } - // Process V0s only for reconstructed-track workflows. - if constexpr (dt != Gen) { - for (const auto& v0 : v0s) { - processV0(v0, tracks, collision, centrality); - } - } else { - for (const auto& particle : tracks) { - processV0(particle, tracks, collision, centrality); + // Process V0s only for reconstructed-track workflows. + if constexpr (dt != Gen) { + for (const auto& v0 : v0s) { + processV0(v0, tracks, collision, centrality); + } + } else { + for (const auto& particle : tracks) { + processV0(particle, tracks, collision, centrality); + } } - } - for (auto setup = 0; setup < FractionSetupCount; ++setup) { - auto fractionSetup = static_cast(setup); - fillResonanceOutput
(fractionSetup, (cfgUseNch) ? multiplicity : centrality, lRandom); + for (auto setup = 0; setup < FractionSetupCount; ++setup) { + auto fractionSetup = static_cast(setup); + fillResonanceOutput
(fractionSetup, (cfgUseNch) ? multiplicity : centrality, lRandom); + } } } @@ -3034,18 +3083,18 @@ struct FlowGenericFramework { th1sList[run][EventSel]->Fill(1.5); } - const auto centrality = getCentrality(collision); + const auto recoCentrality = getCentrality(collision); if (cfgEventSelection.cfgOccupancySelection >= 0) { int occupancy = collision.trackOccupancyInTimeRange(); if (cfgFill.cfgFillQA) { - registryQA.fill(HIST("eventQA/before/occ_mult_cent"), occupancy, tracks.size(), centrality); + registryQA.fill(HIST("eventQA/before/occ_mult_cent"), occupancy, tracks.size(), recoCentrality); } if (occupancy < 0 || occupancy > cfgEventSelection.cfgOccupancySelection) { return; } if (cfgFill.cfgFillQA) { - registryQA.fill(HIST("eventQA/after/occ_mult_cent"), occupancy, tracks.size(), centrality); + registryQA.fill(HIST("eventQA/after/occ_mult_cent"), occupancy, tracks.size(), recoCentrality); } } registryQA.fill(HIST("eventQA/eventSel"), 2.5); @@ -3056,7 +3105,7 @@ struct FlowGenericFramework { if (cfgFill.cfgFillQA) { fillEventQA(collision, tracks); } - if (!eventSelected(collision, tracks.size(), centrality, run)) { + if (!eventSelected(collision, tracks.size(), recoCentrality, run)) { return; } if (cfgFill.cfgFillQA) { @@ -3066,7 +3115,7 @@ struct FlowGenericFramework { auto field = (cfgEventSelection.cfgMagField == DefaultMagneticFieldCut) ? getMagneticField(bc.timestamp()) : static_cast(cfgEventSelection.cfgMagField); const auto groupedTracks = tracks.sliceBy(mcTracksPerCollision, collision.globalIndex()); const auto groupedV0s = v0s.sliceBy(mcV0sPerCollision, collision.globalIndex()); - processCollision(collision, groupedTracks, groupedV0s, centrality, field, run); + processCollision(collision, groupedTracks, groupedV0s, recoCentrality, field, run); } } PROCESS_SWITCH(FlowGenericFramework, processMC, "Process analysis for MC reconstructed and generated events simultaneously", false); From 16b9b30a85b8b6bad6fafdfc2f908a4fee7efd78 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Thu, 17 Sep 2026 10:11:06 +0200 Subject: [PATCH 5/8] reduce task members --- .../Tasks/flowGenericFramework.cxx | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index 81aa9344b8d..391c2ad2867 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -123,18 +123,17 @@ struct FlowGenericFramework { O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Do correlations as function of Nch") O2_DEFINE_CONFIGURABLE(cfgUseNchCorrection, int, 1, "Use correction for Nch; 0: Use size of tracks table, 1: Use efficiency-corrected Nch values, 2: Use uncorrected Nch values"); O2_DEFINE_CONFIGURABLE(cfgRunByRun, bool, false, "Use run-by-run NUA") - struct : ConfigurableGroup{ - O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, false, "Fill NUA weights") - O2_DEFINE_CONFIGURABLE(cfgFillQA, bool, false, "Fill QA histograms") - O2_DEFINE_CONFIGURABLE(cfgFillV0QA, bool, true, "Fill QA histograms for V0 reconstruction") - O2_DEFINE_CONFIGURABLE(cfgFillRunByRunQA, bool, false, "Fill histograms on a run-by-run basis")} cfgFill; - O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") - O2_DEFINE_CONFIGURABLE(cfgUsePID, bool, true, "Enable PID information") - O2_DEFINE_CONFIGURABLE(cfgUseGapMethod, bool, false, "Use gap method in vn-pt calculations") struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, false, "Fill NUA weights"); + O2_DEFINE_CONFIGURABLE(cfgFillQA, bool, false, "Fill QA histograms"); + O2_DEFINE_CONFIGURABLE(cfgFillV0QA, bool, true, "Fill QA histograms for V0 reconstruction"); + O2_DEFINE_CONFIGURABLE(cfgFillRunByRunQA, bool, false, "Fill histograms on a run-by-run basis"); O2_DEFINE_CONFIGURABLE(cfgAnalyseChargedHadrons, bool, true, "Store radial-flow and fraction outputs for charged tracks, pions, kaons, and protons"); O2_DEFINE_CONFIGURABLE(cfgAnalyseK0Lambda, bool, true, "Store radial-flow and fraction outputs for K0 and Lambda candidates"); - } cfgAnalysisChannels; + } cfgFill; + O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") + O2_DEFINE_CONFIGURABLE(cfgUsePID, bool, true, "Enable PID information") + O2_DEFINE_CONFIGURABLE(cfgUseGapMethod, bool, false, "Use gap method in vn-pt calculations") struct : ConfigurableGroup { O2_DEFINE_CONFIGURABLE(cfgUsePtCorrWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for pt-pt correlations"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for azimuthal correlations"); @@ -535,7 +534,7 @@ struct FlowGenericFramework { void init(InitContext const&) { LOGF(info, "FlowGenericFramework::init()"); - if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons && !cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (!cfgFill.cfgAnalyseChargedHadrons && !cfgFill.cfgAnalyseK0Lambda) { LOGF(fatal, "Enable at least one radial-flow analysis channel"); } gfwMemberCache.regions.SetNames(cfgRegions->GetNames()); @@ -741,11 +740,11 @@ struct FlowGenericFramework { AxisSpec axisLambdaMass = {resoSwitchVals[MassBins][Lambda], resoCutVals[MassMin][Lambda], resoCutVals[MassMax][Lambda]}; AxisSpec yAxis = {100, -1, 1}; // QA histograms for V0s - if (cfgAnalysisChannels.cfgAnalyseK0Lambda && cfgFill.cfgFillV0QA && (resoSwitchVals[UseParticle][K0] != 0 || resoSwitchVals[UseParticle][Lambda] != 0)) { + if (cfgFill.cfgAnalyseK0Lambda && cfgFill.cfgFillV0QA && (resoSwitchVals[UseParticle][K0] != 0 || resoSwitchVals[UseParticle][Lambda] != 0)) { registryQA.add("trackQA/after/etaV02", "; #eta; Counts", {HistType::kTH1D, {etaAxis}}); registryQA.add("trackQA/after/etaV0", "; #eta; Counts", {HistType::kTH1D, {etaAxis}}); } - if (cfgAnalysisChannels.cfgAnalyseK0Lambda && resoSwitchVals[UseParticle][K0] != 0) { + if (cfgFill.cfgAnalyseK0Lambda && resoSwitchVals[UseParticle][K0] != 0) { if (cfgFill.cfgFillV0QA) { registryQA.add("K0/PiPlusTPC_K0", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); registryQA.add("K0/PiMinusTPC_K0", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); @@ -775,7 +774,7 @@ struct FlowGenericFramework { registryQA.get(HIST("K0/hK0Count"))->GetXaxis()->SetBinLabel(FillV0DaughterTrackSelection, "v0 Daughter eta selection"); } - if (cfgAnalysisChannels.cfgAnalyseK0Lambda && resoSwitchVals[UseParticle][Lambda] != 0) { + if (cfgFill.cfgAnalyseK0Lambda && resoSwitchVals[UseParticle][Lambda] != 0) { if (cfgFill.cfgFillV0QA) { registryQA.add("Lambda/PrPlusTPC_L", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); registryQA.add("Lambda/PiMinusTPC_L", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}}); @@ -815,7 +814,7 @@ struct FlowGenericFramework { } if (!doprocessEfficiency) { if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { - if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (cfgFill.cfgAnalyseChargedHadrons) { registry.add("npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registry.add("npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registry.add("npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); @@ -825,7 +824,7 @@ struct FlowGenericFramework { registry.add("npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registry.add("npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); } - if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (cfgFill.cfgAnalyseK0Lambda) { registry.add("npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registry.add("npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registry.add("npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); @@ -841,7 +840,7 @@ struct FlowGenericFramework { } } if (doprocessMCGen || doprocessOnTheFly || doprocessMC) { - if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (cfgFill.cfgAnalyseChargedHadrons) { registryGen.add("MCGen/npt_v02_ch", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registryGen.add("MCGen/npt_v02_pi", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registryGen.add("MCGen/npt_v02_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); @@ -851,7 +850,7 @@ struct FlowGenericFramework { registryGen.add("MCGen/npt_v0_ka", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registryGen.add("MCGen/npt_v0_pr", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); } - if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (cfgFill.cfgAnalyseK0Lambda) { registryGen.add("MCGen/npt_v02_K0_sig", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registryGen.add("MCGen/npt_v02_K0_sb1", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); registryGen.add("MCGen/npt_v02_K0_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); @@ -875,7 +874,7 @@ struct FlowGenericFramework { "npt_v0_Lambda_sig", "npt_v0_Lambda_sb1", "npt_v0_Lambda_sb2"}) { const std::string source{name}; const bool resonance = source.find("_K0") != std::string::npos || source.find("_Lambda") != std::string::npos; - if (resonance ? !cfgAnalysisChannels.cfgAnalyseK0Lambda : !cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (resonance ? !cfgFill.cfgAnalyseK0Lambda : !cfgFill.cfgAnalyseChargedHadrons) { continue; } const std::string target = source + (source.rfind("npt_v02_", 0) == 0 ? "_w3pc" : "_w2pc"); @@ -896,7 +895,7 @@ struct FlowGenericFramework { histosNpt[setup][KaonID] = std::make_unique(Form("npt%sKa", setupName), "; #it{p}_{T} (GeV/#it{c}; Count)", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); histosNpt[setup][ProtonID] = std::make_unique(Form("npt%sPr", setupName), "; #it{p}_{T} (GeV/#it{c}; Count)", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); - if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (cfgFill.cfgAnalyseK0Lambda) { histosResoNpt[setup].resize(ResonanceCount); histosResoNpt[setup][K0Sideband1] = std::make_unique(Form("npt%sK0SB1", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); histosResoNpt[setup][K0Signal] = std::make_unique(Form("npt%sK0Sig", setupName), "; #it{p}_{T} (GeV/#it{c}; Count", ptAxis.binEdges.size() - 1, ptAxis.binEdges.data()); @@ -946,16 +945,16 @@ struct FlowGenericFramework { fGFW->CreateRegions(); auto oba = new TObjArray(); addConfigObjectsToObjArray(oba, corrconfigs, 0, corrconfigs.size()); - if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (cfgFill.cfgAnalyseChargedHadrons) { addConfigObjectsToObjArray(oba, corrconfigsV02, 0, std::min(SpeciesCount, corrconfigsV02.size())); } - if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (cfgFill.cfgAnalyseK0Lambda) { addConfigObjectsToObjArray(oba, corrconfigsV02, std::min(SpeciesCount, corrconfigsV02.size()), corrconfigsV02.size()); } - if (cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (cfgFill.cfgAnalyseChargedHadrons) { addConfigObjectsToObjArray(oba, corrconfigsV0, 0, std::min(SpeciesCount, corrconfigsV0.size())); } - if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (cfgFill.cfgAnalyseK0Lambda) { addConfigObjectsToObjArray(oba, corrconfigsV0, std::min(SpeciesCount, corrconfigsV0.size()), corrconfigsV0.size()); } @@ -971,7 +970,7 @@ struct FlowGenericFramework { fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); if (cfgEventWeight.cfgStoreCombinedFractionWeights) { for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { - if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { + if (!cfgFill.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { continue; } if (!fFCpt->addPtProfile(name, 1)) { @@ -993,7 +992,7 @@ struct FlowGenericFramework { fFCptGen->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); if (cfgEventWeight.cfgStoreCombinedFractionWeights) { for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { - if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { + if (!cfgFill.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { continue; } if (!fFCptGen->addPtProfile(name, 1)) { @@ -1661,7 +1660,7 @@ struct FlowGenericFramework { void fillCombinedFractionProfile(FractionSetup setup, int index, bool resonance, double pt, double centmult, double fraction, double weight) { if (!cfgEventWeight.cfgStoreCombinedFractionWeights || weight <= 0. || - (resonance ? !cfgAnalysisChannels.cfgAnalyseK0Lambda : !cfgAnalysisChannels.cfgAnalyseChargedHadrons)) { + (resonance ? !cfgFill.cfgAnalyseK0Lambda : !cfgFill.cfgAnalyseChargedHadrons)) { return; } if (setup == FractionV02) { @@ -1746,7 +1745,7 @@ struct FlowGenericFramework { template void fillNptRegistry(FractionSetup setup, const float& centmult, const NptHistos& nptHistos, const NptDenominators& dns) { - if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons || dns[ChargedID] <= 0) { + if (!cfgFill.cfgAnalyseChargedHadrons || dns[ChargedID] <= 0) { return; } @@ -1865,18 +1864,18 @@ struct FlowGenericFramework { if (cfgEventWeight.cfgStoreCombinedFractionWeights && flowPtContainer->corrDen[1] > 0.) { constexpr std::array ProfileNames = {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}; for (int species = 0; species < SpeciesCount; ++species) { - if (species != ChargedID && !cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (species != ChargedID && !cfgFill.cfgAnalyseChargedHadrons) { continue; } flowPtContainer->fillPtProfile(ProfileNames[species], 1, centmult, flowPtContainer->corrDen[1] * dnsV0[species], rndm); } } - if (cfgAnalysisChannels.cfgAnalyseChargedHadrons && corrconfigsV02.size() < SpeciesCount) { + if (cfgFill.cfgAnalyseChargedHadrons && corrconfigsV02.size() < SpeciesCount) { return; } - if (cfgAnalysisChannels.cfgAnalyseChargedHadrons && dnsV02[ChargedID] > 0) { + if (cfgFill.cfgAnalyseChargedHadrons && dnsV02[ChargedID] > 0) { for (uint l_ind = 0; l_ind < SpeciesCount; ++l_ind) { for (int i = 1; i <= fPtAxis->GetNbins(); i++) { auto dnx = fGFW->Calculate(corrconfigsV02.at(l_ind), i - 1, kTRUE).real(); @@ -1895,7 +1894,7 @@ struct FlowGenericFramework { } } - if (!cfgAnalysisChannels.cfgAnalyseChargedHadrons) { + if (!cfgFill.cfgAnalyseChargedHadrons) { return; } if (corrconfigsV0.size() < SpeciesCount) { @@ -1928,7 +1927,7 @@ struct FlowGenericFramework { template void fillResonanceOutput(FractionSetup setup, const float& centmult, const double& rndm) { - if (!cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (!cfgFill.cfgAnalyseK0Lambda) { return; } auto& flowContainer = (dt == Gen) ? fFCgen : fFC; @@ -2180,7 +2179,7 @@ struct FlowGenericFramework { fillOutputContainers
((cfgUseNch) ? multiplicity : centrality, lRandom); - if (cfgAnalysisChannels.cfgAnalyseK0Lambda) { + if (cfgFill.cfgAnalyseK0Lambda) { // Reset fraction histograms per event for (const auto& vec : histosResoNpt) { for (const auto& h : vec) { From ed039620445656cea148e89a270a3d0928b27a02 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Thu, 17 Sep 2026 12:41:08 +0200 Subject: [PATCH 6/8] further reduction in task members --- .../Tasks/flowGenericFramework.cxx | 191 +++++++++--------- 1 file changed, 96 insertions(+), 95 deletions(-) diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index 391c2ad2867..b1a40206e07 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -120,31 +120,32 @@ struct FlowGenericFramework { O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgMpar, int, 8, "Highest order of pt-pt correlations") O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FT0A, 4:NTPV, 5:NGlobal, 6:MFT") - O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Do correlations as function of Nch") - O2_DEFINE_CONFIGURABLE(cfgUseNchCorrection, int, 1, "Use correction for Nch; 0: Use size of tracks table, 1: Use efficiency-corrected Nch values, 2: Use uncorrected Nch values"); - O2_DEFINE_CONFIGURABLE(cfgRunByRun, bool, false, "Use run-by-run NUA") struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgRunByRun, bool, false, "Use run-by-run NUA"); O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, false, "Fill NUA weights"); O2_DEFINE_CONFIGURABLE(cfgFillQA, bool, false, "Fill QA histograms"); O2_DEFINE_CONFIGURABLE(cfgFillV0QA, bool, true, "Fill QA histograms for V0 reconstruction"); O2_DEFINE_CONFIGURABLE(cfgFillRunByRunQA, bool, false, "Fill histograms on a run-by-run basis"); O2_DEFINE_CONFIGURABLE(cfgAnalyseChargedHadrons, bool, true, "Store radial-flow and fraction outputs for charged tracks, pions, kaons, and protons"); O2_DEFINE_CONFIGURABLE(cfgAnalyseK0Lambda, bool, true, "Store radial-flow and fraction outputs for K0 and Lambda candidates"); + O2_DEFINE_CONFIGURABLE(cfgUsePID, bool, true, "Enable PID information"); + O2_DEFINE_CONFIGURABLE(cfgUsePIDTotal, bool, false, "use fraction of PID total"); } cfgFill; - O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") - O2_DEFINE_CONFIGURABLE(cfgUsePID, bool, true, "Enable PID information") - O2_DEFINE_CONFIGURABLE(cfgUseGapMethod, bool, false, "Use gap method in vn-pt calculations") struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations"); + O2_DEFINE_CONFIGURABLE(cfgUseGapMethod, bool, false, "Use gap method in vn-pt calculations"); O2_DEFINE_CONFIGURABLE(cfgUsePtCorrWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for pt-pt correlations"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting for azimuthal correlations"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFractionWeights, bool, false, "Enable or disable the use of multiplicity-based event weighting for the spectral fraction"); O2_DEFINE_CONFIGURABLE(cfgStoreCombinedFractionWeights, bool, false, "Store additional V02 fractions weighted by flow tuples times dnsV02, and V0 fractions and mean pT weighted by corrDen[1] times dnsV0"); Configurable> cfgFlowProfileWeightModes{"cfgFlowProfileWeightModes", {}, "Per cfgCorrConfig: 0 uses the flow tuple denominator, 1 uses that denominator times dnsV02; empty keeps legacy behavior"}; - } cfgEventWeight; - struct : ConfigurableGroup{ - O2_DEFINE_CONFIGURABLE(cfgEfficiencyPath, std::string, "", "CCDB path to efficiency object") - O2_DEFINE_CONFIGURABLE(cfgUsePIDEfficiencies, bool, false, "Use species dependent efficiencies") - O2_DEFINE_CONFIGURABLE(cfgUse2DEfficiency, bool, false, "Toggle the use of 2D (pt, centrality) efficiency versus centrality integrated efficiency")} cfgEfficiency; + } cfgMethod; + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgEfficiencyPath, std::string, "", "CCDB path to efficiency object"); + O2_DEFINE_CONFIGURABLE(cfgUsePIDEfficiencies, bool, false, "Use species dependent efficiencies"); + O2_DEFINE_CONFIGURABLE(cfgUse2DEfficiency, bool, false, "Toggle the use of 2D (pt, centrality) efficiency versus centrality integrated efficiency"); + O2_DEFINE_CONFIGURABLE(cfgUseDensityDependentCorrection, bool, false, "Use density dependent efficiency correction based on Run 2 measurements"); + } cfgEfficiency; O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") struct : ConfigurableGroup { Configurable> cfgEtaNptV02{"cfgEtaNptV02", {-0.5, 0.5}, "eta cut for v02 fractional spectra"}; @@ -156,7 +157,6 @@ struct FlowGenericFramework { O2_DEFINE_CONFIGURABLE(cfgPtmax, float, 10, "maximum pt (GeV/c)"); } cfgKinematics; Configurable> cfgPtPtGaps{"cfgPtPtGaps", {LongArrayDouble.front().data(), 4, 2, {"subevent 1", "subevent 2", "subevent 3", "subevent 4"}, {"etamin", "etamax"}}, "{etamin,etamax} for all ptpt-subevents"}; - O2_DEFINE_CONFIGURABLE(cfgUsePIDTotal, bool, false, "use fraction of PID total"); O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10, "vertex cut (cm)"); struct : ConfigurableGroup { O2_DEFINE_CONFIGURABLE(cfgDCAxyNSigma, float, 7, "Cut on number of sigma deviations from expected DCA in the transverse direction"); @@ -184,11 +184,12 @@ struct FlowGenericFramework { O2_DEFINE_CONFIGURABLE(cfgIsVertexITSTPC, bool, true, "IsVertexITSTPC - Selects collisions with at least one ITS-TPC track"); } cfgEventCutFlags; struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Do correlations as function of Nch"); + O2_DEFINE_CONFIGURABLE(cfgUseNchCorrection, int, 1, "Use correction for Nch; 0: Use size of tracks table, 1: Use efficiency-corrected Nch values, 2: Use uncorrected Nch values"); O2_DEFINE_CONFIGURABLE(cfgOccupancySelection, int, -999, "Max occupancy selection, -999 to disable"); O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried"); O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, false, "Use additional event cut on mult correlations"); } cfgEventSelection; - O2_DEFINE_CONFIGURABLE(cfgUseDensityDependentCorrection, bool, false, "Use density dependent efficiency correction based on Run 2 measurements"); Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; struct : ConfigurableGroup { @@ -638,7 +639,7 @@ struct FlowGenericFramework { AxisSpec multpvAxis = {3500, 0, 3500, "N_{ch} (PV)"}; AxisSpec occAxis = {500, 0, 5000, "occupancy"}; AxisSpec multAxis = (doprocessOnTheFly) ? bAxis : centAxis; - if (cfgUseNch) { + if (cfgEventSelection.cfgUseNch) { multAxis = nchAxis; } AxisSpec dcaZAXis = {200, -2, 2, "DCA_{z} (cm)"}; @@ -697,7 +698,7 @@ struct FlowGenericFramework { registryQA.add("trackQA/after/etaNch", "; #eta; Counts", {HistType::kTH1D, {etaAxis}}); registryQA.add("trackQA/after/etaPtPt", "; #eta; Counts", {HistType::kTH1D, {etaAxis}}); if (!cfgFill.cfgFillRunByRunQA) { - if (cfgUsePID) { + if (cfgFill.cfgUsePID) { registryQA.add("phi_eta_vtxz_ref", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); registryQA.add("phi_eta_vtxz_ch", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); registryQA.add("phi_eta_vtxz_pi", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); @@ -865,7 +866,7 @@ struct FlowGenericFramework { registryGen.add("MCGen/npt_v0_Lambda_sb2", "; #it{p}_{T} (GeV/#it{c}; ; centrality (%); fraction)", {HistType::kTProfile2D, {ptAxis, centAxis}}); } } - if (cfgEventWeight.cfgStoreCombinedFractionWeights) { + if (cfgMethod.cfgStoreCombinedFractionWeights) { for (const auto& name : {"npt_v02_ch", "npt_v02_pi", "npt_v02_ka", "npt_v02_pr", "npt_v0_ch", "npt_v0_pi", "npt_v0_ka", "npt_v0_pr", "npt_v02_K0_sig", "npt_v02_K0_sb1", "npt_v02_K0_sb2", @@ -918,7 +919,7 @@ struct FlowGenericFramework { if (corrconfigs.empty()) { LOGF(error, "Configuration contains vectors of different size - check the GFWCorrConfig configurable"); } - const auto& flowWeightModes = cfgEventWeight.cfgFlowProfileWeightModes.value; + const auto& flowWeightModes = cfgMethod.cfgFlowProfileWeightModes.value; if (!flowWeightModes.empty() && flowWeightModes.size() != corrconfigs.size()) { LOGF(fatal, "cfgFlowProfileWeightModes must have one entry per cfgCorrConfig"); } @@ -964,11 +965,11 @@ struct FlowGenericFramework { fFC->Initialize(oba, multAxis, cfgNbootstrap); fFCpt.setObject(new FlowPtContainer("FlowPtContainer")); - fFCpt->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); - fFCpt->setUseCentralMoments(cfgUseCentralMoments); - fFCpt->setUseGapMethod(cfgUseGapMethod); + fFCpt->setEventWeight(cfgMethod.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); + fFCpt->setUseCentralMoments(cfgMethod.cfgUseCentralMoments); + fFCpt->setUseGapMethod(cfgMethod.cfgUseGapMethod); fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); - if (cfgEventWeight.cfgStoreCombinedFractionWeights) { + if (cfgMethod.cfgStoreCombinedFractionWeights) { for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { if (!cfgFill.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { continue; @@ -986,11 +987,11 @@ struct FlowGenericFramework { fFCgen->Initialize(oba, multAxis, cfgNbootstrap); fFCptGen.setObject(new FlowPtContainer("FlowPtContainer_gen")); - fFCptGen->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); - fFCptGen->setUseCentralMoments(cfgUseCentralMoments); - fFCptGen->setUseGapMethod(cfgUseGapMethod); + fFCptGen->setEventWeight(cfgMethod.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight); + fFCptGen->setUseCentralMoments(cfgMethod.cfgUseCentralMoments); + fFCptGen->setUseGapMethod(cfgMethod.cfgUseGapMethod); fFCptGen->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap); - if (cfgEventWeight.cfgStoreCombinedFractionWeights) { + if (cfgMethod.cfgStoreCombinedFractionWeights) { for (const auto& name : {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}) { if (!cfgFill.cfgAnalyseChargedHadrons && std::string_view{name} != "mpt1_w2pc_ch") { continue; @@ -1068,7 +1069,7 @@ struct FlowGenericFramework { fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); } // Density dependent corrections - if (cfgUseDensityDependentCorrection) { + if (cfgEfficiency.cfgUseDensityDependentCorrection) { std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, pTEffBins.data()); funcEff.resize(pTEffBins.size() - 1); @@ -1200,13 +1201,13 @@ struct FlowGenericFramework { void loadCorrections(aod::BCsWithTimestamps::iterator const& bc) { uint64_t timestamp = bc.timestamp(); - if (!cfgRunByRun && cfg.correctionsLoaded) { + if (!cfgFill.cfgRunByRun && cfg.correctionsLoaded) { return; } if (!cfgAcceptance.value.empty()) { - std::string runstr = (cfgRunByRun) ? "RunByRun/" : ""; + std::string runstr = (cfgFill.cfgRunByRun) ? "RunByRun/" : ""; cfg.mAcceptance.clear(); - if (cfgUsePID) { + if (cfgFill.cfgUsePID) { cfg.mAcceptance.push_back(ccdb->getForTimeStamp(cfgAcceptance.value + runstr + "ref/", timestamp)); cfg.mAcceptance.push_back(ccdb->getForTimeStamp(cfgAcceptance.value + runstr + "ch/", timestamp)); cfg.mAcceptance.push_back(ccdb->getForTimeStamp(cfgAcceptance.value + runstr + "pi/", timestamp)); @@ -1536,7 +1537,7 @@ struct FlowGenericFramework { template void fillWeights(const TTrack& track, const double vtxz, const int pid_index, const int run) { - if (cfgUsePID) { + if (cfgFill.cfgUsePID) { std::array ptpidmins = {gfwMemberCache.ptpoilow, gfwMemberCache.ptpoilow, 0.3, 0.5}; // min pt for ch, pi, ka, pr std::array ptpidmaxs = {gfwMemberCache.ptpoiup, gfwMemberCache.ptpoiup, 6.0, 6.0}; // max pt for ch, pi, ka, pr bool withinPtPOI = (ptpidmins[pid_index] < track.pt()) && (track.pt() < ptpidmaxs[pid_index]); // within POI pT range @@ -1614,7 +1615,7 @@ struct FlowGenericFramework { histos[EventSel]->GetXaxis()->SetBinLabel(TrackCent, "has track + within cent"); th1sList.insert(std::make_pair(run, histos)); std::vector> histos3d(TH3NameCount); - if (cfgUsePID) { + if (cfgFill.cfgUsePID) { histos3d[NUAref] = registryQA.add(Form("%d/phi_eta_vtxz_ref", run), "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); histos3d[NUAch] = registryQA.add(Form("%d/phi_eta_vtxz_ch", run), "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); histos3d[NUApi] = registryQA.add(Form("%d/phi_eta_vtxz_pi", run), "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); @@ -1623,7 +1624,7 @@ struct FlowGenericFramework { } else { histos3d[NUAref] = registryQA.add(Form("%d/phi_eta_vtxz_ref", run), "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); } - histos3d[PtPhiMult] = registryQA.add(Form("%d/pt_phi_mult", run), "", {HistType::kTH3D, {ptAxis, phiModAxis, (cfgUseNch) ? nchAxis : centAxis}}); + histos3d[PtPhiMult] = registryQA.add(Form("%d/pt_phi_mult", run), "", {HistType::kTH3D, {ptAxis, phiModAxis, (cfgEventSelection.cfgUseNch) ? nchAxis : centAxis}}); th3sList.insert(std::make_pair(run, histos3d)); } @@ -1638,7 +1639,7 @@ struct FlowGenericFramework { NptDenominators getNptDenominators(const NptHistos& nptHistos) { NptDenominators dns = {nptHistos[ChargedID]->Integral(), nptHistos[ChargedID]->Integral(), nptHistos[ChargedID]->Integral(), nptHistos[ChargedID]->Integral()}; - if (cfgUsePIDTotal) { + if (cfgFill.cfgUsePIDTotal) { dns[PionID] = nptHistos[PionID]->Integral(); dns[KaonID] = nptHistos[KaonID]->Integral(); dns[ProtonID] = nptHistos[ProtonID]->Integral(); @@ -1659,7 +1660,7 @@ struct FlowGenericFramework { template void fillCombinedFractionProfile(FractionSetup setup, int index, bool resonance, double pt, double centmult, double fraction, double weight) { - if (!cfgEventWeight.cfgStoreCombinedFractionWeights || weight <= 0. || + if (!cfgMethod.cfgStoreCombinedFractionWeights || weight <= 0. || (resonance ? !cfgFill.cfgAnalyseK0Lambda : !cfgFill.cfgAnalyseChargedHadrons)) { return; } @@ -1751,26 +1752,26 @@ struct FlowGenericFramework { for (int i = 1; i <= fPtAxis->GetNbins(); ++i) { if (setup == FractionV02) { - fillFractionProfile
(HIST("npt_v02_ch"), HIST("MCGen/npt_v02_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); + fillFractionProfile
(HIST("npt_v02_ch"), HIST("MCGen/npt_v02_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); if (dns[PionID] > 0) { - fillFractionProfile
(HIST("npt_v02_pi"), HIST("MCGen/npt_v02_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); + fillFractionProfile
(HIST("npt_v02_pi"), HIST("MCGen/npt_v02_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); } if (dns[KaonID] > 0) { - fillFractionProfile
(HIST("npt_v02_ka"), HIST("MCGen/npt_v02_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); + fillFractionProfile
(HIST("npt_v02_ka"), HIST("MCGen/npt_v02_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); } if (dns[ProtonID] > 0) { - fillFractionProfile
(HIST("npt_v02_pr"), HIST("MCGen/npt_v02_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); + fillFractionProfile
(HIST("npt_v02_pr"), HIST("MCGen/npt_v02_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); } } else { - fillFractionProfile
(HIST("npt_v0_ch"), HIST("MCGen/npt_v0_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); + fillFractionProfile
(HIST("npt_v0_ch"), HIST("MCGen/npt_v0_ch"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ChargedID]->GetBinContent(i) / dns[ChargedID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[ChargedID] : 1.0); if (dns[PionID] > 0) { - fillFractionProfile
(HIST("npt_v0_pi"), HIST("MCGen/npt_v0_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); + fillFractionProfile
(HIST("npt_v0_pi"), HIST("MCGen/npt_v0_pi"), fPtAxis->GetBinCenter(i), centmult, nptHistos[PionID]->GetBinContent(i) / dns[PionID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[PionID] : 1.0); } if (dns[KaonID] > 0) { - fillFractionProfile
(HIST("npt_v0_ka"), HIST("MCGen/npt_v0_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); + fillFractionProfile
(HIST("npt_v0_ka"), HIST("MCGen/npt_v0_ka"), fPtAxis->GetBinCenter(i), centmult, nptHistos[KaonID]->GetBinContent(i) / dns[KaonID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[KaonID] : 1.0); } if (dns[ProtonID] > 0) { - fillFractionProfile
(HIST("npt_v0_pr"), HIST("MCGen/npt_v0_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgEventWeight.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); + fillFractionProfile
(HIST("npt_v0_pr"), HIST("MCGen/npt_v0_pr"), fPtAxis->GetBinCenter(i), centmult, nptHistos[ProtonID]->GetBinContent(i) / dns[ProtonID], cfgMethod.cfgUseMultiplicityFractionWeights ? dns[ProtonID] : 1.0); } } } @@ -1811,9 +1812,9 @@ struct FlowGenericFramework { const auto& nptV0 = histosNpt[FractionV0]; const auto dnsV02 = getNptDenominators(nptV02); const auto dnsV0 = getNptDenominators(nptV0); - const auto& flowWeightModes = cfgEventWeight.cfgFlowProfileWeightModes.value; + const auto& flowWeightModes = cfgMethod.cfgFlowProfileWeightModes.value; auto useV02Denominator = [&](uint index) { - return flowWeightModes.empty() ? (cfgEventWeight.cfgUseMultiplicityFractionWeights && corrconfigs[index].Head.find("3pcW") != std::string::npos) : flowWeightModes[index] == 1; + return flowWeightModes.empty() ? (cfgMethod.cfgUseMultiplicityFractionWeights && corrconfigs[index].Head.find("3pcW") != std::string::npos) : flowWeightModes[index] == 1; }; flowPtContainer->calculateCorrelations(); @@ -1822,7 +1823,7 @@ struct FlowGenericFramework { flowPtContainer->fillSubeventPtProfiles(centmult, rndm); flowPtContainer->fillCMProfiles(centmult, rndm); flowPtContainer->fillCMSubeventProfiles(centmult, rndm); - if (!cfgUseGapMethod) { + if (!cfgMethod.cfgUseGapMethod) { flowPtContainer->fillVnPtStdProfiles(centmult, rndm); } @@ -1837,8 +1838,8 @@ struct FlowGenericFramework { if (useV02Denominator(l_ind)) { dnx *= dnsV02[ChargedID]; } - flowContainer->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); - if (cfgUseGapMethod) { + flowContainer->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgMethod.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + if (cfgMethod.cfgUseGapMethod) { flowPtContainer->fillVnPtProfiles(centmult, val, dnx, rndm, gfwMemberCache.configs.GetpTCorrMasks()[l_ind]); } } @@ -1854,14 +1855,14 @@ struct FlowGenericFramework { if (useV02Denominator(l_ind)) { dnx *= dnsV02[ChargedID]; } - flowContainer->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgMethod.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } fillNptRegistry
(FractionV02, centmult, nptV02, dnsV02); fillNptRegistry
(FractionV0, centmult, nptV0, dnsV0); - if (cfgEventWeight.cfgStoreCombinedFractionWeights && flowPtContainer->corrDen[1] > 0.) { + if (cfgMethod.cfgStoreCombinedFractionWeights && flowPtContainer->corrDen[1] > 0.) { constexpr std::array ProfileNames = {"mpt1_w2pc_ch", "mpt1_w2pc_pi", "mpt1_w2pc_ka", "mpt1_w2pc_pr"}; for (int species = 0; species < SpeciesCount; ++species) { if (species != ChargedID && !cfgFill.cfgAnalyseChargedHadrons) { @@ -1885,10 +1886,10 @@ struct FlowGenericFramework { auto val = fGFW->Calculate(corrconfigsV02.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1 && dnsV02[l_ind] > 0) { fillCombinedFractionProfile
(FractionV02, l_ind, false, fPtAxis->GetBinCenter(i), centmult, nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], dnx * dnsV02[l_ind]); - if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { + if (cfgMethod.cfgUseMultiplicityFractionWeights) { dnx *= dnsV02[l_ind]; } - flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgMethod.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } @@ -1915,10 +1916,10 @@ struct FlowGenericFramework { if (dnsV0[l_ind] > 0) { fillCombinedFractionProfile
(FractionV0, l_ind, false, fPtAxis->GetBinCenter(i), centmult, nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], dnx * dnsV0[l_ind]); double profileWeight = dnx; - if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { + if (cfgMethod.cfgUseMultiplicityFractionWeights) { profileWeight *= dnsV0[l_ind]; } - flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgMethod.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm); } } } @@ -1945,7 +1946,7 @@ struct FlowGenericFramework { double dnLambdaSig = histosNpt[FractionV02][ChargedID]->Integral(); double dnLambdaSB2 = histosNpt[FractionV02][ChargedID]->Integral(); - if (cfgUsePIDTotal) { + if (cfgFill.cfgUsePIDTotal) { dnK0SB1 = histosResoNpt[FractionV02][K0Sideband1]->Integral(); dnK0Sig = histosResoNpt[FractionV02][K0Signal]->Integral(); dnK0SB2 = histosResoNpt[FractionV02][K0Sideband2]->Integral(); @@ -1956,22 +1957,22 @@ struct FlowGenericFramework { for (int i = 1; i <= fPtAxis->GetNbins(); ++i) { if (dnK0SB1 > 0) { - fillFractionProfile
(HIST("npt_v02_K0_sb1"), HIST("MCGen/npt_v02_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); + fillFractionProfile
(HIST("npt_v02_K0_sb1"), HIST("MCGen/npt_v02_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgMethod.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); } if (dnK0Sig > 0) { - fillFractionProfile
(HIST("npt_v02_K0_sig"), HIST("MCGen/npt_v02_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Signal]->GetBinContent(i) / dnK0Sig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); + fillFractionProfile
(HIST("npt_v02_K0_sig"), HIST("MCGen/npt_v02_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Signal]->GetBinContent(i) / dnK0Sig, cfgMethod.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); } if (dnK0SB2 > 0) { - fillFractionProfile
(HIST("npt_v02_K0_sb2"), HIST("MCGen/npt_v02_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); + fillFractionProfile
(HIST("npt_v02_K0_sb2"), HIST("MCGen/npt_v02_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgMethod.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); } if (dnLambdaSB1 > 0) { - fillFractionProfile
(HIST("npt_v02_Lambda_sb1"), HIST("MCGen/npt_v02_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); + fillFractionProfile
(HIST("npt_v02_Lambda_sb1"), HIST("MCGen/npt_v02_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgMethod.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); } if (dnLambdaSig > 0) { - fillFractionProfile
(HIST("npt_v02_Lambda_sig"), HIST("MCGen/npt_v02_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); + fillFractionProfile
(HIST("npt_v02_Lambda_sig"), HIST("MCGen/npt_v02_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgMethod.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); } if (dnLambdaSB2 > 0) { - fillFractionProfile
(HIST("npt_v02_Lambda_sb2"), HIST("MCGen/npt_v02_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); + fillFractionProfile
(HIST("npt_v02_Lambda_sb2"), HIST("MCGen/npt_v02_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgMethod.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); } } @@ -1986,10 +1987,10 @@ struct FlowGenericFramework { auto val = fGFW->Calculate(corrconfigsV02.at(l_ind), i - 1, kFALSE).real() / dnx; if (std::abs(val) < 1 && dns[l_ind - 4] > 0) { fillCombinedFractionProfile
(FractionV02, l_ind - SpeciesCount, true, fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV02][l_ind - SpeciesCount]->GetBinContent(i) / dns[l_ind - SpeciesCount], dnx * dns[l_ind - SpeciesCount]); - if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { + if (cfgMethod.cfgUseMultiplicityFractionWeights) { dnx *= dns[l_ind - 4]; } - flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); + flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgMethod.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm); } } } @@ -2005,7 +2006,7 @@ struct FlowGenericFramework { double dnLambdaSig = histosNpt[FractionV0][ChargedID]->Integral(); double dnLambdaSB2 = histosNpt[FractionV0][ChargedID]->Integral(); - if (cfgUsePIDTotal) { + if (cfgFill.cfgUsePIDTotal) { dnK0SB1 = histosResoNpt[FractionV0][K0Sideband1]->Integral(); dnK0Sig = histosResoNpt[FractionV0][K0Signal]->Integral(); dnK0SB2 = histosResoNpt[FractionV0][K0Sideband2]->Integral(); @@ -2016,22 +2017,22 @@ struct FlowGenericFramework { for (int i = 1; i <= fPtAxis->GetNbins(); ++i) { if (dnK0SB1 > 0) { - fillFractionProfile
(HIST("npt_v0_K0_sb1"), HIST("MCGen/npt_v0_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); + fillFractionProfile
(HIST("npt_v0_K0_sb1"), HIST("MCGen/npt_v0_K0_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband1]->GetBinContent(i) / dnK0SB1, cfgMethod.cfgUseMultiplicityFractionWeights ? dnK0SB1 : 1.); } if (dnK0Sig > 0) { - fillFractionProfile
(HIST("npt_v0_K0_sig"), HIST("MCGen/npt_v0_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Signal]->GetBinContent(i) / dnK0Sig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); + fillFractionProfile
(HIST("npt_v0_K0_sig"), HIST("MCGen/npt_v0_K0_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Signal]->GetBinContent(i) / dnK0Sig, cfgMethod.cfgUseMultiplicityFractionWeights ? dnK0Sig : 1.); } if (dnK0SB2 > 0) { - fillFractionProfile
(HIST("npt_v0_K0_sb2"), HIST("MCGen/npt_v0_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); + fillFractionProfile
(HIST("npt_v0_K0_sb2"), HIST("MCGen/npt_v0_K0_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][K0Sideband2]->GetBinContent(i) / dnK0SB2, cfgMethod.cfgUseMultiplicityFractionWeights ? dnK0SB2 : 1.); } if (dnLambdaSB1 > 0) { - fillFractionProfile
(HIST("npt_v0_Lambda_sb1"), HIST("MCGen/npt_v0_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); + fillFractionProfile
(HIST("npt_v0_Lambda_sb1"), HIST("MCGen/npt_v0_Lambda_sb1"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband1]->GetBinContent(i) / dnLambdaSB1, cfgMethod.cfgUseMultiplicityFractionWeights ? dnLambdaSB1 : 1.); } if (dnLambdaSig > 0) { - fillFractionProfile
(HIST("npt_v0_Lambda_sig"), HIST("MCGen/npt_v0_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); + fillFractionProfile
(HIST("npt_v0_Lambda_sig"), HIST("MCGen/npt_v0_Lambda_sig"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSignal]->GetBinContent(i) / dnLambdaSig, cfgMethod.cfgUseMultiplicityFractionWeights ? dnLambdaSig : 1.); } if (dnLambdaSB2 > 0) { - fillFractionProfile
(HIST("npt_v0_Lambda_sb2"), HIST("MCGen/npt_v0_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgEventWeight.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); + fillFractionProfile
(HIST("npt_v0_Lambda_sb2"), HIST("MCGen/npt_v0_Lambda_sb2"), fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][LambdaSideband2]->GetBinContent(i) / dnLambdaSB2, cfgMethod.cfgUseMultiplicityFractionWeights ? dnLambdaSB2 : 1.); } } @@ -2069,11 +2070,11 @@ struct FlowGenericFramework { continue; } double profileWeight = dnx; - if (cfgEventWeight.cfgUseMultiplicityFractionWeights) { + if (cfgMethod.cfgUseMultiplicityFractionWeights) { profileWeight *= dns[l_ind - 4]; } const double value = mpt * histosResoNpt[FractionV0][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4]; - const double weight = cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0; + const double weight = cfgMethod.cfgUsePtCorrWeights ? profileWeight : 1.0; fillCombinedFractionProfile
(FractionV0, l_ind - SpeciesCount, true, fPtAxis->GetBinCenter(i), centmult, histosResoNpt[FractionV0][l_ind - SpeciesCount]->GetBinContent(i) / dns[l_ind - SpeciesCount], flowPtContainer.corrDen[1] * dns[l_ind - SpeciesCount]); flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm); } @@ -2110,7 +2111,7 @@ struct FlowGenericFramework { // be cautious, this only works for Pb-Pb // esimate the Event plane and vn for this event DensityCorr densitycorrections; - if (cfgUseDensityDependentCorrection) { + if (cfgEfficiency.cfgUseDensityDependentCorrection) { double psi2Est = 0, psi3Est = 0, psi4Est = 0; double v2 = 0, v3 = 0, v4 = 0; double q2x = 0, q2y = 0; @@ -2158,7 +2159,7 @@ struct FlowGenericFramework { } float multiplicity = 0.f; - switch (cfgUseNchCorrection) { + switch (cfgEventSelection.cfgUseNchCorrection) { case 0: multiplicity = tracks.size(); break; @@ -2177,7 +2178,7 @@ struct FlowGenericFramework { return; } - fillOutputContainers
((cfgUseNch) ? multiplicity : centrality, lRandom); + fillOutputContainers
((cfgEventSelection.cfgUseNch) ? multiplicity : centrality, lRandom); if (cfgFill.cfgAnalyseK0Lambda) { // Reset fraction histograms per event @@ -2200,7 +2201,7 @@ struct FlowGenericFramework { for (auto setup = 0; setup < FractionSetupCount; ++setup) { auto fractionSetup = static_cast(setup); - fillResonanceOutput
(fractionSetup, (cfgUseNch) ? multiplicity : centrality, lRandom); + fillResonanceOutput
(fractionSetup, (cfgEventSelection.cfgUseNch) ? multiplicity : centrality, lRandom); } } } @@ -2229,7 +2230,7 @@ struct FlowGenericFramework { double weffCh = getEfficiency(track, centrality, 0); if (track.eta() > cfgKinematics.cfgEtaNch->first && track.eta() < cfgKinematics.cfgEtaNch->second) { if (weffCh > 0) { - acceptedTracks.total += (cfgUseNchCorrection) ? weffCh : 1.0; + acceptedTracks.total += (cfgEventSelection.cfgUseNchCorrection) ? weffCh : 1.0; } ++acceptedTracks.totaluncorr; } @@ -2249,8 +2250,8 @@ struct FlowGenericFramework { pidIndex = ProtonID; } double weff = getEfficiency(track, centrality, pidIndex); - double nptWeightCh = (weffCh > 0) ? ((cfgUseNchCorrection) ? weffCh : 1.0) : -1.0; - double nptWeightPid = (weff > 0) ? ((cfgUseNchCorrection) ? weff : 1.0) : -1.0; + double nptWeightCh = (weffCh > 0) ? ((cfgEventSelection.cfgUseNchCorrection) ? weffCh : 1.0) : -1.0; + double nptWeightPid = (weff > 0) ? ((cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0) : -1.0; fillNptHistosForEta(track.eta(), track.pt(), pidIndex, nptWeightCh, nptWeightPid); if (cfgFill.cfgFillWeights) { fillWeights(mcParticle, vtxz, 0, run); @@ -2311,7 +2312,7 @@ struct FlowGenericFramework { double weffCh = getEfficiency(track, centrality, 0); if (track.eta() > cfgKinematics.cfgEtaNch->first && track.eta() < cfgKinematics.cfgEtaNch->second) { if (weffCh > 0) { - acceptedTracks.total += (cfgUseNchCorrection) ? weffCh : 1.0; + acceptedTracks.total += (cfgEventSelection.cfgUseNchCorrection) ? weffCh : 1.0; } ++acceptedTracks.totaluncorr; } @@ -2319,12 +2320,12 @@ struct FlowGenericFramework { return; } // int pidIndex = 0; - // if (cfgUsePID) Need PID for v02 + // if (cfgFill.cfgUsePID) Need PID for v02 int pidIndex = getNsigmaPID(track); double weff = getEfficiency(track, centrality, pidIndex); - double nptWeightCh = (weffCh > 0) ? ((cfgUseNchCorrection) ? weffCh : 1.0) : -1.0; - double nptWeightPid = (weff > 0) ? ((cfgUseNchCorrection) ? weff : 1.0) : -1.0; + double nptWeightCh = (weffCh > 0) ? ((cfgEventSelection.cfgUseNchCorrection) ? weffCh : 1.0) : -1.0; + double nptWeightPid = (weff > 0) ? ((cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0) : -1.0; fillNptHistosForEta(track.eta(), track.pt(), pidIndex, nptWeightCh, nptWeightPid); if (cfgFill.cfgFillWeights) { fillWeights(track, vtxz, pidIndex, run); @@ -2374,13 +2375,13 @@ struct FlowGenericFramework { } if (v0.mK0Short() > cfgPIDCuts.cfgK0SideBand1Min && v0.mK0Short() < cfgPIDCuts.cfgK0SideBand1Max) { - histosResoNpt[fractionSetup][K0Sideband1]->Fill(v0.pt(), (cfgUseNchCorrection) ? weff : 1.0); + histosResoNpt[fractionSetup][K0Sideband1]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0); } if (v0.mK0Short() > cfgPIDCuts.cfgK0SignalMin && v0.mK0Short() < cfgPIDCuts.cfgK0SignalMax) { - histosResoNpt[fractionSetup][K0Signal]->Fill(v0.pt(), (cfgUseNchCorrection) ? weff : 1.0); + histosResoNpt[fractionSetup][K0Signal]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0); } if (v0.mK0Short() > cfgPIDCuts.cfgK0SideBand2Min && v0.mK0Short() < cfgPIDCuts.cfgK0SideBand2Max) { - histosResoNpt[fractionSetup][K0Sideband2]->Fill(v0.pt(), (cfgUseNchCorrection) ? weff : 1.0); + histosResoNpt[fractionSetup][K0Sideband2]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0); } } } @@ -2410,13 +2411,13 @@ struct FlowGenericFramework { } const double lambdaMass = lambdaSelection.isL ? v0.mLambda() : v0.mAntiLambda(); if (lambdaMass > cfgPIDCuts.cfgLambdaSideBand1Min && lambdaMass < cfgPIDCuts.cfgLambdaSideBand1Max) { - histosResoNpt[fractionSetup][LambdaSideband1]->Fill(v0.pt(), (cfgUseNchCorrection) ? weff : 1.0); + histosResoNpt[fractionSetup][LambdaSideband1]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0); } if (v0.mLambda() > cfgPIDCuts.cfgLambdaSignalMin && v0.mLambda() < cfgPIDCuts.cfgLambdaSignalMax) { - histosResoNpt[fractionSetup][LambdaSignal]->Fill(v0.pt(), (cfgUseNchCorrection) ? weff : 1.0); + histosResoNpt[fractionSetup][LambdaSignal]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0); } if (v0.mLambda() > cfgPIDCuts.cfgLambdaSideBand2Min && v0.mLambda() < cfgPIDCuts.cfgLambdaSideBand2Max) { - histosResoNpt[fractionSetup][LambdaSideband2]->Fill(v0.pt(), (cfgUseNchCorrection) ? weff : 1.0); + histosResoNpt[fractionSetup][LambdaSideband2]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0); } } } @@ -2763,7 +2764,7 @@ struct FlowGenericFramework { } ++index; } - if (!cfgUseGapMethod) { + if (!cfgMethod.cfgUseGapMethod) { std::complex q2p = {weff * wacc * std::cos(2 * track.phi()), weff * wacc * std::sin(2 * track.phi())}; std::complex q2n = {weff * wacc * std::cos(-2 * track.phi()), weff * wacc * std::sin(-2 * track.phi())}; flowPtContainer->fillArray(q2p, q2n, weff * track.pt(), weff); @@ -2774,7 +2775,7 @@ struct FlowGenericFramework { template inline void fillGFW(const TTrack& track, const float& centrality, const double& vtxz, int pid_index, const DensityCorr& densitycorrections) { - if (cfgUsePID) { // Analysing POI flow with id'ed particles + if (cfgFill.cfgUsePID) { // Analysing POI flow with id'ed particles std::array ptmins = {gfwMemberCache.ptpoilow, gfwMemberCache.ptpoilow, 0.3, 0.5}; std::array ptmaxs = {gfwMemberCache.ptpoiup, gfwMemberCache.ptpoiup, 6.0, 6.0}; bool withinPtRef = (track.pt() > gfwMemberCache.ptreflow && track.pt() < gfwMemberCache.ptrefup); @@ -2815,7 +2816,7 @@ struct FlowGenericFramework { if (weff < 0) { return; } - if (cfgUseDensityDependentCorrection && withinPtRef && dt != Gen) { + if (cfgEfficiency.cfgUseDensityDependentCorrection && withinPtRef && dt != Gen) { double fphi = densitycorrections.v2 * std::cos(2 * (track.phi() - densitycorrections.psi2Est)) + densitycorrections.v3 * std::cos(3 * (track.phi() - densitycorrections.psi3Est)) + densitycorrections.v4 * std::cos(4 * (track.phi() - densitycorrections.psi4Est)); fphi = (1 + 2 * fphi); int pTBinForEff = hFindPtBin->FindBin(track.pt()); @@ -2975,7 +2976,7 @@ struct FlowGenericFramework { if (run != lastRun) { lastRun = run; LOGF(info, "run = %d", run); - if (cfgRunByRun) { + if (cfgFill.cfgRunByRun) { if (std::find(runNumbers.begin(), runNumbers.end(), run) == runNumbers.end()) { if (cfgFill.cfgFillRunByRunQA) { createRunByRunHistograms(run); @@ -2989,7 +2990,7 @@ struct FlowGenericFramework { } } } - if (!cfgFill.cfgFillWeights && !cfgRunByRun) { + if (!cfgFill.cfgFillWeights && !cfgFill.cfgRunByRun) { loadCorrections(bc); } registryQA.fill(HIST("eventQA/eventSel"), 0.5); @@ -3060,11 +3061,11 @@ struct FlowGenericFramework { if (cfgFill.cfgFillRunByRunQA) { createRunByRunHistograms(run); } - if (!cfgFill.cfgFillWeights && cfgRunByRun) { + if (!cfgFill.cfgFillWeights && cfgFill.cfgRunByRun) { loadCorrections(bc); } } - if (!cfgFill.cfgFillWeights && !cfgRunByRun) { + if (!cfgFill.cfgFillWeights && !cfgFill.cfgRunByRun) { loadCorrections(bc); } From 5024a2703c9271b5ce830297e78ea6c0bb391106 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Thu, 17 Sep 2026 18:32:59 +0200 Subject: [PATCH 7/8] codecheck --- .../GenericFramework/Core/FlowPtContainer.cxx | 645 +++++++++--------- PWGCF/GenericFramework/Core/FlowPtContainer.h | 45 +- 2 files changed, 339 insertions(+), 351 deletions(-) diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx index 550958e967f..aae48349f8a 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx @@ -42,32 +42,21 @@ using namespace o2::analysis::genericframework; using namespace o2::analysis::genericframework::eventweight; -FlowPtContainer::FlowPtContainer() : fCMTermList(0), - fCorrList(0), - fCovList(0), - fSubList(0), - fSubCMList(0), - fCumulantList(0), - fCentralMomentList(0), +FlowPtContainer::FlowPtContainer() : fCMTermList(nullptr), + fCorrList(nullptr), + fCovList(nullptr), + fSubList(nullptr), + fSubCMList(nullptr), + fCumulantList(nullptr), + fCentralMomentList(nullptr), mpar(0), nSubevents(0), fillCounter(0), fEventWeight(EventWeight::UnityWeight), fUseCentralMoments(true), - fUseGap(false), - sumP(), - insub(), - corrNum(), - corrNumSub(), - corrDen(), - corrDenSub(), - cmVal(), - cmValSub(), - cmDen(), - cmDenSub(), - arr(), - warr(), - subevents() {} + fUseGap(false) +{ +} FlowPtContainer::~FlowPtContainer() { delete fCMTermList; @@ -79,91 +68,68 @@ FlowPtContainer::~FlowPtContainer() delete fCentralMomentList; }; FlowPtContainer::FlowPtContainer(const char* name) : TNamed(name, name), - fCMTermList(0), - fCorrList(0), - fCovList(0), - fSubList(0), - fSubCMList(0), - fCumulantList(0), - fCentralMomentList(0), + fCMTermList(nullptr), + fCorrList(nullptr), + fCovList(nullptr), + fSubList(nullptr), + fSubCMList(nullptr), + fCumulantList(nullptr), + fCentralMomentList(nullptr), mpar(0), nSubevents(0), fillCounter(0), fEventWeight(EventWeight::UnityWeight), fUseCentralMoments(true), - fUseGap(false), - sumP(), - insub(), - corrNum(), - corrNumSub(), - corrDen(), - corrDenSub(), - cmVal(), - cmValSub(), - cmDen(), - cmDenSub(), - arr(), - warr(), - subevents() {} + fUseGap(false) +{ +} FlowPtContainer::FlowPtContainer(const char* name, const char* title) : TNamed(name, title), - fCMTermList(0), - fCorrList(0), - fCovList(0), - fSubList(0), - fSubCMList(0), - fCumulantList(0), - fCentralMomentList(0), + fCMTermList(nullptr), + fCorrList(nullptr), + fCovList(nullptr), + fSubList(nullptr), + fSubCMList(nullptr), + fCumulantList(nullptr), + fCentralMomentList(nullptr), mpar(0), nSubevents(0), fillCounter(0), fEventWeight(EventWeight::UnityWeight), fUseCentralMoments(true), - fUseGap(false), - sumP(), - insub(), - corrNum(), - corrNumSub(), - corrDen(), - corrDenSub(), - cmVal(), - cmValSub(), - cmDen(), - cmDenSub(), - arr(), - warr(), - subevents() {} -void FlowPtContainer::initialise(const o2::framework::AxisSpec axis, const int& maxOrder, const GFWCorrConfigs& configs, const int& nsub) + fUseGap(false) +{ +} +void FlowPtContainer::initialise(const o2::framework::AxisSpec& axis, const int& maxOrder, const GFWCorrConfigs& configs, const int& nsub) { arr.resize(3 * 3 * 3 * 3); warr.resize(3 * 3 * 3 * 3); - if (!mpar) + if (mpar == 0) { mpar = maxOrder; + } std::vector multiBins = axis.binEdges; int nMultiBins = axis.nBins.value_or(0); - if (nMultiBins <= 0) + if (nMultiBins <= 0) { nMultiBins = multiBins.size() - 1; + } if (nMultiBins <= 0) { LOGF(warning, "Multiplicity axis does not exist"); return; } - if (fCMTermList) - delete fCMTermList; + delete fCMTermList; fCMTermList = new TList(); fCMTermList->SetOwner(kTRUE); - if (fCorrList) - delete fCorrList; + delete fCorrList; fCorrList = new TList(); fCorrList->SetOwner(kTRUE); - if (fCovList) - delete fCovList; + delete fCovList; fCovList = new TList(); fCovList->SetOwner(kTRUE); for (int m = 0; m < mpar; ++m) { - fCorrList->Add(new BootstrapProfile(Form("mpt%i", m + 1), Form("mpt%i", m + 1), nMultiBins, &multiBins[0])); + fCorrList->Add(new BootstrapProfile(Form("mpt%i", m + 1), Form("mpt%i", m + 1), nMultiBins, multiBins.data())); } for (int m = 0; m < centralMomentMaxOrder; ++m) { for (int i = 0; i <= m; ++i) { - fCMTermList->Add(new BootstrapProfile(Form("cm%i_Mpt%i", m + 1, i), Form("cm%i_Mpt%i", m + 1, i), nMultiBins, &multiBins[0])); + fCMTermList->Add(new BootstrapProfile(Form("cm%i_Mpt%i", m + 1, i), Form("cm%i_Mpt%i", m + 1, i), nMultiBins, multiBins.data())); } } if (fUseGap) { @@ -172,80 +138,81 @@ void FlowPtContainer::initialise(const o2::framework::AxisSpec axis, const int& 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)))) + if ((configs.GetpTCorrMasks()[i] & (1 << (m - 1))) == 0) { 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])); + 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.data())); 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])); + fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nMultiBins, multiBins.data())); obsIndex++; } } } } else { if (fUseCentralMoments) { - fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt0", "ChFull24pt2_Mpt0", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt1", "ChFull24pt2_Mpt1", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt2", "ChFull24pt2_Mpt2", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt0", "ChFull24pt2_Mpt0", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt1", "ChFull24pt2_Mpt1", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt2", "ChFull24pt2_Mpt2", nMultiBins, multiBins.data())); - fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt0", "ChFull24pt1_Mpt0", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt1", "ChFull24pt1_Mpt1", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt0", "ChFull24pt1_Mpt0", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt1", "ChFull24pt1_Mpt1", nMultiBins, multiBins.data())); - fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt0", "ChFull22pt2_Mpt0", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt1", "ChFull22pt2_Mpt1", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt2", "ChFull22pt2_Mpt2", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt0", "ChFull22pt2_Mpt0", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt1", "ChFull22pt2_Mpt1", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt2", "ChFull22pt2_Mpt2", nMultiBins, multiBins.data())); - fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt0", "ChFull22pt1_Mpt0", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt1", "ChFull22pt1_Mpt1", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt0", "ChFull22pt1_Mpt0", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt1", "ChFull22pt1_Mpt1", nMultiBins, multiBins.data())); - fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt0", "ChFull22pt3_Mpt0", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt1", "ChFull22pt3_Mpt1", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt2", "ChFull22pt3_Mpt2", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt3", "ChFull22pt3_Mpt3", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt0", "ChFull22pt3_Mpt0", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt1", "ChFull22pt3_Mpt1", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt2", "ChFull22pt3_Mpt2", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt3_Mpt3", "ChFull22pt3_Mpt3", nMultiBins, multiBins.data())); - fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt0", "ChFull22pt4_Mpt0", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt1", "ChFull22pt4_Mpt1", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt2", "ChFull22pt4_Mpt2", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt3", "ChFull22pt4_Mpt3", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt4", "ChFull22pt4_Mpt4", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt0", "ChFull22pt4_Mpt0", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt1", "ChFull22pt4_Mpt1", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt2", "ChFull22pt4_Mpt2", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt3", "ChFull22pt4_Mpt3", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt4_Mpt4", "ChFull22pt4_Mpt4", nMultiBins, multiBins.data())); } else { - fCovList->Add(new BootstrapProfile("ChFull24pt2", "ChFull24pt2", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull24pt1", "ChFull24pt1", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt2", "ChFull22pt2", nMultiBins, &multiBins[0])); - fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt2", "ChFull24pt2", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull24pt1", "ChFull24pt1", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt2", "ChFull22pt2", nMultiBins, multiBins.data())); + fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nMultiBins, multiBins.data())); } } - if (nsub) { - for (int i = 0; i < fCorrList->GetEntries(); ++i) + if (nsub != 0) { + for (int i = 0; i < fCorrList->GetEntries(); ++i) { dynamic_cast(fCorrList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fCMTermList->GetEntries(); ++i) + } + for (int i = 0; i < fCMTermList->GetEntries(); ++i) { dynamic_cast(fCMTermList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fCovList->GetEntries(); ++i) + } + for (int i = 0; i < fCovList->GetEntries(); ++i) { dynamic_cast(fCovList->At(i))->InitializeSubsamples(nsub); + } } LOGF(info, "Container %s initialized with m = %i\n and %i subsamples", this->GetName(), mpar, nsub); - return; }; void FlowPtContainer::initialise(int nbinsx, double* xbins, const int& maxOrder, const GFWCorrConfigs& configs, const int& nsub) { arr.resize(3 * 3 * 5 * 5); warr.resize(3 * 3 * 5 * 5); - if (!mpar) + if (mpar == 0) { mpar = maxOrder; - if (fCMTermList) - delete fCMTermList; + } + delete fCMTermList; fCMTermList = new TList(); fCMTermList->SetOwner(kTRUE); - if (fCorrList) - delete fCorrList; + delete fCorrList; fCorrList = new TList(); fCorrList->SetOwner(kTRUE); - if (fCovList) - delete fCovList; + delete fCovList; fCovList = new TList(); fCovList->SetOwner(kTRUE); for (int m = 0; m < mpar; ++m) { @@ -262,8 +229,9 @@ void FlowPtContainer::initialise(int nbinsx, double* xbins, const int& maxOrder, 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)))) + if ((configs.GetpTCorrMasks()[i] & (1 << (m - 1))) == 0) { 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)); @@ -308,13 +276,16 @@ void FlowPtContainer::initialise(int nbinsx, double* xbins, const int& maxOrder, fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nbinsx, xbins)); } } - if (nsub) { - for (int i = 0; i < fCorrList->GetEntries(); ++i) + if (nsub != 0) { + for (int i = 0; i < fCorrList->GetEntries(); ++i) { dynamic_cast(fCorrList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fCMTermList->GetEntries(); ++i) + } + for (int i = 0; i < fCMTermList->GetEntries(); ++i) { dynamic_cast(fCMTermList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fCovList->GetEntries(); ++i) + } + for (int i = 0; i < fCovList->GetEntries(); ++i) { dynamic_cast(fCovList->At(i))->InitializeSubsamples(nsub); + } } LOGF(info, "Container %s initialized with m = %i\n", this->GetName(), mpar); }; @@ -322,18 +293,16 @@ void FlowPtContainer::initialise(int nbinsx, double xlow, double xhigh, const in { arr.resize(3 * 3 * 5 * 5); warr.resize(3 * 3 * 5 * 5); - if (!mpar) + if (mpar == 0) { mpar = maxOrder; - if (fCMTermList) - delete fCMTermList; + } + delete fCMTermList; fCMTermList = new TList(); fCMTermList->SetOwner(kTRUE); - if (fCorrList) - delete fCorrList; + delete fCorrList; fCorrList = new TList(); fCorrList->SetOwner(kTRUE); - if (fCovList) - delete fCovList; + delete fCovList; fCovList = new TList(); fCovList->SetOwner(kTRUE); for (int m = 0; m < mpar; ++m) { @@ -350,8 +319,9 @@ void FlowPtContainer::initialise(int nbinsx, double xlow, double xhigh, const in 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)))) + if ((configs.GetpTCorrMasks()[i] & (1 << (m - 1))) == 0) { 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)); @@ -396,36 +366,40 @@ void FlowPtContainer::initialise(int nbinsx, double xlow, double xhigh, const in fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nbinsx, xlow, xhigh)); } } - if (nsub) { - for (int i = 0; i < fCorrList->GetEntries(); ++i) + if (nsub != 0) { + for (int i = 0; i < fCorrList->GetEntries(); ++i) { dynamic_cast(fCorrList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fCMTermList->GetEntries(); ++i) + } + for (int i = 0; i < fCMTermList->GetEntries(); ++i) { dynamic_cast(fCMTermList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fCovList->GetEntries(); ++i) + } + for (int i = 0; i < fCovList->GetEntries(); ++i) { dynamic_cast(fCovList->At(i))->InitializeSubsamples(nsub); + } } LOGF(info, "Container %s initialized with m = %i\n", this->GetName(), mpar); }; -void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec axis, const int& maxOrder, const int& nsubev, const int& nsub) +void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, const int& maxOrder, const int& nsubev, const int& nsub) { if (nsubev < 1) { LOGF(fatal, "Need at least one subevent"); return; } nSubevents = nsubev; - if (!mpar) + if (mpar == 0) { mpar = maxOrder; + } std::vector multiBins = axis.binEdges; int nMultiBins = axis.nBins.value_or(0); - if (nMultiBins <= 0) + if (nMultiBins <= 0) { nMultiBins = multiBins.size() - 1; + } if (nMultiBins <= 0) { LOGF(warning, "Multiplicity axis does not exist"); return; } - if (fSubList) - delete fSubList; + delete fSubList; fSubList = new TList(); fSubList->SetOwner(kTRUE); @@ -433,8 +407,9 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec axis, con std::vector current; getSubevents(mpar, nsubev + 1, current, subevents); // remove unused "extra" subevent - for (auto& subevent : subevents) // o2-linter: disable=const-ref-in-for-loop (modified through pop_back()) + for (auto& subevent : subevents) { // o2-linter: disable=const-ref-in-for-loop (modified through pop_back()) subevent.pop_back(); + } subevents.erase(subevents.begin(), subevents.begin() + 1); std::vector histnames; @@ -448,41 +423,45 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec axis, con } histnames.push_back(outstr); } - for (const auto& name : histnames) - fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nMultiBins, &multiBins[0])); + for (const auto& name : histnames) { + fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nMultiBins, multiBins.data())); + } - if (fSubCMList) - delete fSubCMList; + delete fSubCMList; fSubCMList = new TList(); fSubCMList->SetOwner(kTRUE); const int maxSubEv = 2; for (int subEv = 0; subEv < maxSubEv; ++subEv) { for (int m = 0; m < centralMomentMaxOrder; ++m) { for (int i = 0; i <= m; ++i) { - fSubCMList->Add(new BootstrapProfile(Form("cm%i_sub%i_Mpt%i", m + 1, subEv + 1, i), this->GetTitle(), nMultiBins, &multiBins[0])); + fSubCMList->Add(new BootstrapProfile(Form("cm%i_sub%i_Mpt%i", m + 1, subEv + 1, i), this->GetTitle(), nMultiBins, multiBins.data())); } } } for (int m = 2; m <= centralMomentMaxOrder; ++m) { for (int first = 1; first < m; ++first) { for (int second = first; second < m; ++second) { - if (first > second) + if (first > second) { continue; + } int fourth = m - second; for (int third = 1; third < m; ++third) { - if (third > fourth) + if (third > fourth) { continue; - fSubCMList->Add(new BootstrapProfile(Form("cm%i_%i%isub1_%i%isub2", m, first, second, third, fourth), this->GetTitle(), nMultiBins, &multiBins[0])); + } + fSubCMList->Add(new BootstrapProfile(Form("cm%i_%i%isub1_%i%isub2", m, first, second, third, fourth), this->GetTitle(), nMultiBins, multiBins.data())); } } } } - if (nsub) { - for (int i = 0; i < fSubList->GetEntries(); ++i) + if (nsub != 0) { + for (int i = 0; i < fSubList->GetEntries(); ++i) { dynamic_cast(fSubList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fSubCMList->GetEntries(); ++i) + } + for (int i = 0; i < fSubCMList->GetEntries(); ++i) { dynamic_cast(fSubCMList->At(i))->InitializeSubsamples(nsub); + } } LOGF(info, "Container %s initialized Subevents and %i subsamples", this->GetName(), nsub); } @@ -493,11 +472,11 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m return; } nSubevents = nsubev; - if (!mpar) + if (mpar == 0) { mpar = maxOrder; + } - if (fSubList) - delete fSubList; + delete fSubList; fSubList = new TList(); fSubList->SetOwner(kTRUE); @@ -505,8 +484,9 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m std::vector current; getSubevents(mpar, nsubev + 1, current, subevents); // remove unused "extra" subevent - for (auto& subevent : subevents) // o2-linter: disable=const-ref-in-for-loop (modified through pop_back()) + for (auto& subevent : subevents) { // o2-linter: disable=const-ref-in-for-loop (modified through pop_back()) subevent.pop_back(); + } subevents.erase(subevents.begin(), subevents.begin() + 1); std::vector histnames; @@ -520,11 +500,11 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m } histnames.push_back(outstr); } - for (const auto& name : histnames) + for (const auto& name : histnames) { fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nbinsx, xbins)); + } - if (fSubCMList) - delete fSubCMList; + delete fSubCMList; fSubCMList = new TList(); fSubCMList->SetOwner(kTRUE); const int maxSubEv = 2; @@ -538,23 +518,27 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m for (int m = 2; m <= centralMomentMaxOrder; ++m) { for (int first = 1; first < m; ++first) { for (int second = first; second < m; ++second) { - if (first > second) + if (first > second) { continue; + } int fourth = m - second; for (int third = 1; third < m; ++third) { - if (third > fourth) + if (third > fourth) { continue; + } fSubCMList->Add(new BootstrapProfile(Form("cm%i_%i%isub1_%i%isub2", m, first, second, third, fourth), this->GetTitle(), nbinsx, xbins)); } } } } - if (nsub) { - for (int i = 0; i < fSubList->GetEntries(); ++i) + if (nsub != 0) { + for (int i = 0; i < fSubList->GetEntries(); ++i) { dynamic_cast(fSubList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fSubCMList->GetEntries(); ++i) + } + for (int i = 0; i < fSubCMList->GetEntries(); ++i) { dynamic_cast(fSubCMList->At(i))->InitializeSubsamples(nsub); + } } LOGF(info, "Container %s initialized Subevents and %i subsamples", this->GetName(), nsub); } @@ -565,10 +549,10 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh, return; } nSubevents = nsubev; - if (!mpar) + if (mpar == 0) { mpar = maxOrder; - if (fSubList) - delete fSubList; + } + delete fSubList; fSubList = new TList(); fSubList->SetOwner(kTRUE); @@ -576,8 +560,9 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh, std::vector current; getSubevents(mpar, nsubev + 1, current, subevents); // remove unused "extra" subevent - for (auto& subevent : subevents) // o2-linter: disable=const-ref-in-for-loop (modified through pop_back()) + for (auto& subevent : subevents) { // o2-linter: disable=const-ref-in-for-loop (modified through pop_back()) subevent.pop_back(); + } subevents.erase(subevents.begin(), subevents.begin() + 1); std::vector histnames; @@ -591,11 +576,11 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh, } histnames.push_back(outstr); } - for (const auto& name : histnames) + for (const auto& name : histnames) { fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nbinsx, xlow, xhigh)); + } - if (fSubCMList) - delete fSubCMList; + delete fSubCMList; fSubCMList = new TList(); fSubCMList->SetOwner(kTRUE); const int maxSubEv = 2; @@ -609,22 +594,26 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh, for (int m = 2; m <= centralMomentMaxOrder; ++m) { for (int first = 1; first < m; ++first) { for (int second = first; second < m; ++second) { - if (first > second) + if (first > second) { continue; + } int fourth = m - second; for (int third = 1; third < m; ++third) { - if (third > fourth) + if (third > fourth) { continue; + } fSubCMList->Add(new BootstrapProfile(Form("cm%i_%i%isub1_%i%isub2", m, first, second, third, fourth), this->GetTitle(), nbinsx, xlow, xhigh)); } } } } - if (nsub) { - for (int i = 0; i < fSubList->GetEntries(); ++i) + if (nsub != 0) { + for (int i = 0; i < fSubList->GetEntries(); ++i) { dynamic_cast(fSubList->At(i))->InitializeSubsamples(nsub); - for (int i = 0; i < fSubCMList->GetEntries(); ++i) + } + for (int i = 0; i < fSubCMList->GetEntries(); ++i) { dynamic_cast(fSubCMList->At(i))->InitializeSubsamples(nsub); + } } LOGF(info, "Container %s initialized Subevents and %i subsamples", this->GetName(), nsub); } @@ -633,7 +622,6 @@ void FlowPtContainer::fill(const double& w, const double& pt) for (size_t i = 0; i < sumP.size(); ++i) { sumP[i] += std::pow(w, i % (mpar + 1)) * std::pow(pt, i / (mpar + 1)); } - return; } void FlowPtContainer::fillSub(const double& w, const double& pt, int subIndex) { @@ -666,17 +654,18 @@ void FlowPtContainer::calculateCorrelations() corrNum[m] = sumNum; corrDen[m] = sumDenum; } - return; } void FlowPtContainer::calculateSubeventCorrelations() { corrNumSub.clear(); corrNumSub.resize(nSubevents, std::vector(mpar + 1, 0)); - for (auto& corrnum : corrNumSub) // o2-linter: disable=const-ref-in-for-loop (assigned a value) + for (auto& corrnum : corrNumSub) { // o2-linter: disable=const-ref-in-for-loop (assigned a value) corrnum[0] = 1.0; + } corrDenSub.resize(nSubevents, std::vector(mpar + 1, 0)); - for (auto& corrden : corrDenSub) // o2-linter: disable=const-ref-in-for-loop (assigned a value) + for (auto& corrden : corrDenSub) { // o2-linter: disable=const-ref-in-for-loop (assigned a value) corrden[0] = 1.0; + } for (int subIndex = 0; subIndex < nSubevents; ++subIndex) { double sumNum = 0.0; @@ -696,7 +685,6 @@ void FlowPtContainer::calculateSubeventCorrelations() corrDenSub[subIndex][m] = sumDenum; } } - return; } void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn) { @@ -705,46 +693,6 @@ void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn) dynamic_cast(fCorrList->At(m - 1))->FillProfile(centmult, corrNum[m] / corrDen[m], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : corrDen[m], rn); } } - return; -} -bool FlowPtContainer::addPtProfile(const char* name, int observableOrder) -{ - if (!fCorrList || !name || !name[0] || observableOrder < 1 || observableOrder > mpar) { - LOGF(error, "Cannot add pT profile %s for order %d", name ? name : "(null)", observableOrder); - return false; - } - const std::string profileName{name}; - if (fCorrList->FindObject(profileName.c_str())) { - LOGF(error, "pT profile %s already exists", profileName.c_str()); - return false; - } - auto* original = dynamic_cast(fCorrList->At(observableOrder - 1)); - const auto* axis = original->GetXaxis(); - BootstrapProfile* profile = nullptr; - if (axis->GetXbins()->GetSize()) { - profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXbins()->GetArray()); - } else { - profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXmin(), axis->GetXmax()); - } - if (original->fListOfEntries) { - profile->InitializeSubsamples(original->fListOfEntries->GetEntries()); - } - fCorrList->Add(profile); - return true; -} -bool FlowPtContainer::fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn) -{ - if (!fCorrList || !name || observableOrder < 1 || observableOrder > mpar || - static_cast(observableOrder) >= corrDen.size() || corrDen[observableOrder] == 0. || eventWeight == 0.) { - return false; - } - auto* profile = dynamic_cast(fCorrList->FindObject(name)); - if (!profile) { - LOGF(error, "pT profile %s has not been booked", name); - return false; - } - profile->FillProfile(mult, corrNum[observableOrder] / corrDen[observableOrder], eventWeight, rn); - return true; } void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const double& rn) { @@ -758,10 +706,10 @@ void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const doubl if (corrDenSub[subIndex][m] == 0) { valid = false; break; - } else { - val *= corrNumSub[subIndex][m] / corrDenSub[subIndex][m]; - dn *= corrDenSub[subIndex][m]; } + val *= corrNumSub[subIndex][m] / corrDenSub[subIndex][m]; + dn *= corrDenSub[subIndex][m]; + ++subIndex; } if (valid) { @@ -769,15 +717,14 @@ void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const doubl } ++histCounter; } - return; } void FlowPtContainer::fillVnPtCorrProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) { - if (!mask) { + if (mask == 0u) { return; } for (auto m(1); m <= mpar; ++m) { - if (!(mask & (1 << (m - 1)))) { + if ((mask & (1 << (m - 1))) == 0) { continue; } if (corrDen[m] != 0) { @@ -785,16 +732,16 @@ void FlowPtContainer::fillVnPtCorrProfiles(const double& centmult, const double& } ++fillCounter; } - return; } void FlowPtContainer::fillVnDeltaPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) { - if (!mask) { + if (mask == 0u) { return; } for (auto m(1); m <= mpar; ++m) { - if (!(mask & (1 << (m - 1)))) + if ((mask & (1 << (m - 1))) == 0) { continue; + } for (auto i = 0; i <= m; ++i) { if (cmDen[m] != 0) { dynamic_cast(fCovList->At(fillCounter))->FillProfile(centmult, flowval * ((i == m) ? cmVal[0] : cmVal[m * (m - 1) / 2 + i + 1]), (fEventWeight == UnityWeight) ? 1.0 : flowtuples * cmDen[m], rn); @@ -802,16 +749,15 @@ void FlowPtContainer::fillVnDeltaPtProfiles(const double& centmult, const double ++fillCounter; } } - return; } void FlowPtContainer::fillVnPtCorrProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) { - if (!mask) { + if (mask == 0u) { return; } int startIndex = fCovFirstIndex[configIndex]; for (auto m(1); m <= mpar; ++m) { - if (!(mask & (1 << (m - 1)))) { + if ((mask & (1 << (m - 1))) == 0) { continue; } if (corrDen[m] != 0) { @@ -819,11 +765,10 @@ void FlowPtContainer::fillVnPtCorrProfiles(const int configIndex, const double& } ++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) { + if (mask == 0u) { return; } @@ -833,8 +778,9 @@ void FlowPtContainer::fillVnDeltaPtProfiles(const int configIndex, const double& } int profileIndex = fCovFirstIndex[configIndex]; for (auto m(1); m <= mpar; ++m) { - if (!(mask & (1 << (m - 1)))) + if ((mask & (1 << (m - 1))) == 0) { continue; + } for (auto i = 0; i <= m; ++i, ++profileIndex) { const size_t cmIndex = (i == m) ? 0u : static_cast(m * (m - 1) / 2 + i + 1); @@ -856,92 +802,113 @@ void FlowPtContainer::fillVnDeltaPtProfiles(const int configIndex, const double& profile->FillProfile(centmult, flowval * cmVal[cmIndex], (fEventWeight == UnityWeight) ? 1.0 : flowtuples * cmDen[m], rn); } } - return; } void FlowPtContainer::fillVnPtCorrStdProfiles(const double& centmult, const double& rn) { double wAABBCC = getStdAABBCC(warr); - if (wAABBCC != 0) + if (wAABBCC != 0) { dynamic_cast(fCovList->At(0))->FillProfile(centmult, getStdAABBCC(arr) / wAABBCC, (fEventWeight == UnityWeight) ? 1.0 : wAABBCC, rn); + } double wAABBC = getStdAABBC(warr); - if (wAABBC != 0) + if (wAABBC != 0) { dynamic_cast(fCovList->At(1))->FillProfile(centmult, getStdAABBCC(arr) / wAABBC, (fEventWeight == UnityWeight) ? 1.0 : wAABBC, rn); + } double wABCC = getStdAABBC(warr); - if (wABCC != 0) + if (wABCC != 0) { dynamic_cast(fCovList->At(2))->FillProfile(centmult, getStdABCC(arr) / wABCC, (fEventWeight == UnityWeight) ? 1.0 : wABCC, rn); + } double wABC = getStdABC(warr); - if (wABC != 0) + if (wABC != 0) { dynamic_cast(fCovList->At(3))->FillProfile(centmult, getStdABC(arr) / wABC, (fEventWeight == UnityWeight) ? 1.0 : wABC, rn); - return; + } } void FlowPtContainer::fillVnDeltaPtStdProfiles(const double& centmult, const double& rn) { double wAABBCC = getStdAABBCC(warr); - if (wAABBCC != 0) + if (wAABBCC != 0) { dynamic_cast(fCovList->At(0))->FillProfile(centmult, getStdAABBCC(arr) / wAABBCC, (fEventWeight == UnityWeight) ? 1.0 : wAABBCC, rn); + } double wAABBCD = getStdAABBCD(warr); - if (wAABBCD != 0) + if (wAABBCD != 0) { dynamic_cast(fCovList->At(1))->FillProfile(centmult, getStdAABBCD(arr) / wAABBCD, (fEventWeight == UnityWeight) ? 1.0 : wAABBCD, rn); + } double wAABBDD = getStdAABBDD(warr); - if (wAABBDD != 0) + if (wAABBDD != 0) { dynamic_cast(fCovList->At(2))->FillProfile(centmult, getStdAABBDD(arr) / wAABBDD, (fEventWeight == UnityWeight) ? 1.0 : wAABBDD, rn); + } double wAABBC = getStdAABBC(warr); - if (wAABBC != 0) + if (wAABBC != 0) { dynamic_cast(fCovList->At(3))->FillProfile(centmult, getStdAABBC(arr) / wAABBC, (fEventWeight == UnityWeight) ? 1.0 : wAABBC, rn); + } double wAABBD = getStdAABBD(warr); - if (wAABBD != 0) + if (wAABBD != 0) { dynamic_cast(fCovList->At(4))->FillProfile(centmult, getStdAABBD(arr) / wAABBD, (fEventWeight == UnityWeight) ? 1.0 : wAABBD, rn); + } double wABCC = getStdABCC(warr); - if (wABCC != 0) + if (wABCC != 0) { dynamic_cast(fCovList->At(5))->FillProfile(centmult, getStdABCC(arr) / wABCC, (fEventWeight == UnityWeight) ? 1.0 : wABCC, rn); + } double wABCD = getStdABCD(warr); - if (wABCD != 0) + if (wABCD != 0) { dynamic_cast(fCovList->At(6))->FillProfile(centmult, getStdABCD(arr) / wABCD, (fEventWeight == UnityWeight) ? 1.0 : wABCD, rn); + } double wABDD = getStdABDD(warr); - if (wABDD != 0) + if (wABDD != 0) { dynamic_cast(fCovList->At(7))->FillProfile(centmult, getStdABDD(arr) / wABDD, (fEventWeight == UnityWeight) ? 1.0 : wABDD, rn); + } double wABC = getStdABC(warr); - if (wABC != 0) + if (wABC != 0) { dynamic_cast(fCovList->At(8))->FillProfile(centmult, getStdABC(arr) / wABC, (fEventWeight == UnityWeight) ? 1.0 : wABC, rn); + } double wABD = getStdABD(warr); - if (wABD != 0) + if (wABD != 0) { dynamic_cast(fCovList->At(9))->FillProfile(centmult, getStdABD(arr) / wABD, (fEventWeight == UnityWeight) ? 1.0 : wABD, rn); + } double wABCCCC = getStdABCCCC(warr); - if (wABCCCC != 0.) + if (wABCCCC != 0.) { dynamic_cast(fCovList->At(14))->FillProfile(centmult, getStdABCCCC(arr) / wABCCCC, (fEventWeight == UnityWeight) ? 1. : wABCCCC, rn); + } double wABCCCD = getStdABCCCD(warr); - if (wABCCCD != 0.) + if (wABCCCD != 0.) { dynamic_cast(fCovList->At(15))->FillProfile(centmult, getStdABCCCD(arr) / wABCCCD, (fEventWeight == UnityWeight) ? 1. : wABCCCD, rn); + } double wABCCDD = getStdABCCDD(warr); - if (wABCCDD != 0.) + if (wABCCDD != 0.) { dynamic_cast(fCovList->At(16))->FillProfile(centmult, getStdABCCDD(arr) / wABCCDD, (fEventWeight == UnityWeight) ? 1. : wABCCDD, rn); + } double wABCDDD = getStdABCDDD(warr); - if (wABCDDD != 0.) + if (wABCDDD != 0.) { dynamic_cast(fCovList->At(17))->FillProfile(centmult, getStdABCDDD(arr) / wABCDDD, (fEventWeight == UnityWeight) ? 1. : wABCDDD, rn); + } double wABDDDD = getStdABDDDD(warr); - if (wABDDDD != 0.) + if (wABDDDD != 0.) { dynamic_cast(fCovList->At(18))->FillProfile(centmult, getStdABDDDD(arr) / wABDDDD, (fEventWeight == UnityWeight) ? 1. : wABDDDD, rn); + } double wABCCC = getStdABCCC(warr); - if (wABCCC != 0.) + if (wABCCC != 0.) { dynamic_cast(fCovList->At(10))->FillProfile(centmult, getStdABCCC(arr) / wABCCC, (fEventWeight == UnityWeight) ? 1. : wABCCC, rn); + } double wABCCD = getStdABCCD(warr); - if (wABCCD != 0.) + if (wABCCD != 0.) { dynamic_cast(fCovList->At(11))->FillProfile(centmult, getStdABCCD(arr) / wABCCD, (fEventWeight == UnityWeight) ? 1. : wABCCD, rn); + } double wABCDD = getStdABCDD(warr); - if (wABCDD != 0.) + if (wABCDD != 0.) { dynamic_cast(fCovList->At(12))->FillProfile(centmult, getStdABCDD(arr) / wABCDD, (fEventWeight == UnityWeight) ? 1. : wABCDD, rn); + } double wABDDD = getStdABDDD(warr); - if (wABDDD != 0.) + if (wABDDD != 0.) { dynamic_cast(fCovList->At(13))->FillProfile(centmult, getStdABDDD(arr) / wABDDD, (fEventWeight == UnityWeight) ? 1. : wABDDD, rn); - return; + } } void FlowPtContainer::fillCMProfiles(const double& centmult, const double& rn) { - if (sumP[getVectorIndex(0, 0)] == 0) + if (sumP[getVectorIndex(0, 0)] == 0) { return; + } // 0th order correlation cmDen.push_back(1.); cmVal.push_back(1.); @@ -950,26 +917,30 @@ void FlowPtContainer::fillCMProfiles(const double& centmult, const double& rn) cmDen.push_back(sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - sumP[getVectorIndex(2, 0)]); cmDen.push_back(sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(1, 0)] + 2 * sumP[getVectorIndex(3, 0)]); cmDen.push_back(sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 6 * sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] + 8 * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(3, 0)] + 3 * sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(2, 0)] - 6 * sumP[getVectorIndex(4, 0)]); - if (mpar < 1 || cmDen[1] == 0) + if (mpar < 1 || cmDen[1] == 0) { return; + } cmVal.push_back(sumP[getVectorIndex(1, 1)] / cmDen[1]); dynamic_cast(fCMTermList->At(0))->FillProfile(centmult, cmVal[1], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[1], rn); - if (mpar < 2 || sumP[getVectorIndex(2, 0)] == 0 || cmDen[2] == 0) // o2-linter: disable=magic-number (less than order 2) + if (mpar < 2 || sumP[getVectorIndex(2, 0)] == 0 || cmDen[2] == 0) { // o2-linter: disable=magic-number (less than order 2) return; + } cmVal.push_back(1 / cmDen[2] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] - sumP[getVectorIndex(2, 2)])); dynamic_cast(fCMTermList->At(1))->FillProfile(centmult, cmVal[2], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn); cmVal.push_back(-2 * 1 / cmDen[2] * (sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 1)] - sumP[getVectorIndex(2, 1)])); dynamic_cast(fCMTermList->At(2))->FillProfile(centmult, cmVal[3], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[2], rn); - if (mpar < 3 || sumP[getVectorIndex(3, 0)] == 0 || cmDen[3] == 0) // o2-linter: disable=magic-number (less than order 3) + if (mpar < 3 || sumP[getVectorIndex(3, 0)] == 0 || cmDen[3] == 0) { // o2-linter: disable=magic-number (less than order 3) return; + } cmVal.push_back(1 / cmDen[3] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] - 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 1)] + 2 * sumP[getVectorIndex(3, 3)])); dynamic_cast(fCMTermList->At(3))->FillProfile(centmult, cmVal[4], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn); cmVal.push_back(-3 * 1 / cmDen[3] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] - 2 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 1)] + 2 * sumP[getVectorIndex(3, 2)] - sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 0)])); dynamic_cast(fCMTermList->At(4))->FillProfile(centmult, cmVal[5], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn); cmVal.push_back(3 * 1 / cmDen[3] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 2 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 0)] + 2 * sumP[getVectorIndex(3, 1)] - sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(2, 0)])); dynamic_cast(fCMTermList->At(5))->FillProfile(centmult, cmVal[6], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[3], rn); - if (mpar < 4 || sumP[getVectorIndex(4, 0)] == 0 || cmDen[4] == 0) // o2-linter: disable=magic-number (less than order 4) + if (mpar < 4 || sumP[getVectorIndex(4, 0)] == 0 || cmDen[4] == 0) { // o2-linter: disable=magic-number (less than order 4) return; + } cmVal.push_back(1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] - 6 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] + 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(2, 2)] + 8 * sumP[getVectorIndex(3, 3)] * sumP[getVectorIndex(1, 1)] - 6 * sumP[getVectorIndex(4, 4)])); dynamic_cast(fCMTermList->At(6))->FillProfile(centmult, cmVal[7], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn); cmVal.push_back(-4 * 1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(2, 1)] + 3 * sumP[getVectorIndex(2, 2)] * sumP[getVectorIndex(2, 1)] + 2 * sumP[getVectorIndex(3, 3)] * sumP[getVectorIndex(1, 0)] + 6 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(3, 2)] - 6 * sumP[getVectorIndex(4, 3)])); @@ -978,16 +949,17 @@ void FlowPtContainer::fillCMProfiles(const double& centmult, const double& rn) dynamic_cast(fCMTermList->At(8))->FillProfile(centmult, cmVal[9], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn); cmVal.push_back(-4 * 1 / cmDen[4] * (sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(1, 0)] * sumP[getVectorIndex(1, 0)] - 3 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(2, 0)] * sumP[getVectorIndex(1, 0)] + 3 * sumP[getVectorIndex(2, 1)] * sumP[getVectorIndex(2, 0)] + 2 * sumP[getVectorIndex(1, 1)] * sumP[getVectorIndex(3, 0)] + 6 * sumP[getVectorIndex(3, 1)] * sumP[getVectorIndex(1, 0)] - 6 * sumP[getVectorIndex(4, 1)])); dynamic_cast(fCMTermList->At(9))->FillProfile(centmult, cmVal[10], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDen[4], rn); - return; } void FlowPtContainer::fillCMSubeventProfiles(const double& centmult, const double& rn) { // do I need to add an extra return statement here to match fillCMProfiles? - if (mpar < 1) + if (mpar < 1) { return; + } const int minSubevents = 2; - if (nSubevents < minSubevents) + if (nSubevents < minSubevents) { return; + } int indOffset = 0; for (int im = 1; im <= mpar; im++) { @@ -1033,7 +1005,7 @@ void FlowPtContainer::fillCMSubeventProfiles(const double& centmult, const doubl cmValSub[nSubevents - 1].push_back(1 / cmDenSub[nSubevents - 1][2] * (insub[nSubevents - 1][getVectorIndex(1, 0)] * insub[nSubevents - 1][getVectorIndex(1, 1)] - insub[nSubevents - 1][getVectorIndex(2, 1)])); dynamic_cast(fSubCMList->At(indOffset + 2))->FillProfile(centmult, cmValSub[nSubevents - 1][3], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDenSub[nSubevents - 1][2], rn); } - validMpar[0] = true; + validMpar[0] = 1; } if (mpar >= 3) { // o2-linter: disable=magic-number (greater than order 3) @@ -1053,7 +1025,7 @@ void FlowPtContainer::fillCMSubeventProfiles(const double& centmult, const doubl cmValSub[nSubevents - 1].push_back(1 / cmDenSub[nSubevents - 1][3] * (insub[nSubevents - 1][getVectorIndex(1, 1)] * insub[nSubevents - 1][getVectorIndex(1, 0)] * insub[nSubevents - 1][getVectorIndex(1, 0)] - 2 * insub[nSubevents - 1][getVectorIndex(2, 1)] * insub[nSubevents - 1][getVectorIndex(1, 0)] + 2 * insub[nSubevents - 1][getVectorIndex(3, 1)] - insub[nSubevents - 1][getVectorIndex(1, 1)] * insub[nSubevents - 1][getVectorIndex(2, 0)])); dynamic_cast(fSubCMList->At(indOffset + 5))->FillProfile(centmult, cmValSub[nSubevents - 1][6], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDenSub[nSubevents - 1][3], rn); } - validMpar[1] = true; + validMpar[1] = 1; } if (mpar >= 4) { // o2-linter: disable=magic-number (greater than order 4) if (insub[0][getVectorIndex(4, 0)] != 0 && cmDenSub[0][4] != 0) { @@ -1076,20 +1048,23 @@ void FlowPtContainer::fillCMSubeventProfiles(const double& centmult, const doubl cmValSub[nSubevents - 1].push_back(1 / cmDenSub[nSubevents - 1][4] * (insub[nSubevents - 1][getVectorIndex(1, 1)] * insub[nSubevents - 1][getVectorIndex(1, 0)] * insub[nSubevents - 1][getVectorIndex(1, 0)] * insub[nSubevents - 1][getVectorIndex(1, 0)] - 3 * insub[nSubevents - 1][getVectorIndex(2, 1)] * insub[nSubevents - 1][getVectorIndex(1, 0)] * insub[nSubevents - 1][getVectorIndex(1, 0)] - 3 * insub[nSubevents - 1][getVectorIndex(1, 1)] * insub[nSubevents - 1][getVectorIndex(2, 0)] * insub[nSubevents - 1][getVectorIndex(1, 0)] + 3 * insub[nSubevents - 1][getVectorIndex(2, 1)] * insub[nSubevents - 1][getVectorIndex(2, 0)] + 2 * insub[nSubevents - 1][getVectorIndex(1, 1)] * insub[nSubevents - 1][getVectorIndex(3, 0)] + 6 * insub[nSubevents - 1][getVectorIndex(3, 1)] * insub[nSubevents - 1][getVectorIndex(1, 0)] - 6 * insub[nSubevents - 1][getVectorIndex(4, 1)])); dynamic_cast(fSubCMList->At(indOffset + 9))->FillProfile(centmult, cmValSub[nSubevents - 1][10], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDenSub[nSubevents - 1][4], rn); } - validMpar[2] = true; + validMpar[2] = 1; } // Fill cross terms for (int m = 2; m <= centralMomentMaxOrder; ++m) { - if (!validMpar[m - 2]) + if (validMpar[m - 2] == 0) { continue; + } for (int first = 1; first < m; ++first) { for (int second = first; second < m; ++second) { - if (first > second) + if (first > second) { continue; + } int fourth = m - second; for (int third = 1; third < m; ++third) { - if (third > fourth) + if (third > fourth) { continue; + } if (insub[0][getVectorIndex(m, 0)] != 0 && insub[nSubevents - 1][getVectorIndex(m, 0)] != 0 && cmDenSub[0][m] * cmDenSub[nSubevents - 1][m] != 0) { dynamic_cast(fSubCMList->FindObject(Form("cm%i_%i%isub1_%i%isub2", m, first, second, third, fourth)))->FillProfile(centmult, cmValSub[0][second * (second - 1) / 2 + second - first + 1] * cmValSub[nSubevents - 1][fourth * (fourth - 1) / 2 + fourth - third + 1], (fEventWeight == EventWeight::UnityWeight) ? 1.0 : cmDenSub[0][m] * cmDenSub[nSubevents - 1][m], rn); } @@ -1097,7 +1072,6 @@ void FlowPtContainer::fillCMSubeventProfiles(const double& centmult, const doubl } } } - return; } void FlowPtContainer::fillArray(FillType a, FillType b, double c, double d) { @@ -1115,7 +1089,6 @@ void FlowPtContainer::fillArray(FillType a, FillType b, double c, double d) LOGF(error, "FillType variant should hold same type for a and b during single function c"); } } - return; } template double FlowPtContainer::getStdAABBCC(T& inarr) @@ -1742,50 +1715,58 @@ double FlowPtContainer::orderedAddition(std::vector vec) void FlowPtContainer::rebinMulti(int nbins) { if (fCMTermList) { - for (int i = 0; i < fCMTermList->GetEntries(); i++) + for (int i = 0; i < fCMTermList->GetEntries(); i++) { dynamic_cast(fCMTermList->At(i))->RebinMulti(nbins); + } } if (fCorrList) { - for (int i = 0; i < fCorrList->GetEntries(); i++) + for (int i = 0; i < fCorrList->GetEntries(); i++) { dynamic_cast(fCorrList->At(i))->RebinMulti(nbins); + } } if (fCovList) { - for (int i = 0; i < fCovList->GetEntries(); i++) + for (int i = 0; i < fCovList->GetEntries(); i++) { dynamic_cast(fCovList->At(i))->RebinMulti(nbins); + } } if (fSubList) { - for (int i = 0; i < fSubList->GetEntries(); i++) + for (int i = 0; i < fSubList->GetEntries(); i++) { dynamic_cast(fSubList->At(i))->RebinMulti(nbins); + } } if (fSubCMList) { - for (int i = 0; i < fSubCMList->GetEntries(); i++) + for (int i = 0; i < fSubCMList->GetEntries(); i++) { dynamic_cast(fSubCMList->At(i))->RebinMulti(nbins); + } } - return; } void FlowPtContainer::rebinMulti(int nbins, double* binedges) { if (fCMTermList) { - for (int i = 0; i < fCMTermList->GetEntries(); i++) + for (int i = 0; i < fCMTermList->GetEntries(); i++) { dynamic_cast(fCMTermList->At(i))->RebinMulti(nbins, binedges); + } } if (fCorrList) { - for (int i = 0; i < fCorrList->GetEntries(); i++) + for (int i = 0; i < fCorrList->GetEntries(); i++) { dynamic_cast(fCorrList->At(i))->RebinMulti(nbins, binedges); + } } if (fCovList) { - for (int i = 0; i < fCovList->GetEntries(); i++) + for (int i = 0; i < fCovList->GetEntries(); i++) { dynamic_cast(fCovList->At(i))->RebinMulti(nbins, binedges); + } } if (fSubList) { - for (int i = 0; i < fSubList->GetEntries(); i++) + for (int i = 0; i < fSubList->GetEntries(); i++) { dynamic_cast(fSubList->At(i))->RebinMulti(nbins, binedges); + } } if (fSubCMList) { - for (int i = 0; i < fSubCMList->GetEntries(); i++) + for (int i = 0; i < fSubCMList->GetEntries(); i++) { dynamic_cast(fSubCMList->At(i))->RebinMulti(nbins, binedges); + } } - return; } TH1* FlowPtContainer::getCorrHist(int ind, int m) { @@ -1793,73 +1774,74 @@ TH1* FlowPtContainer::getCorrHist(int ind, int m) } TH1* FlowPtContainer::getCentralMomentHist(int ind, int m) { - if (!fCentralMomentList) + if (!fCentralMomentList) { createCentralMomentList(); - if (!fCentralMomentList) - return 0; - if (ind + 1 < fCentralMomentList->GetEntries()) + } + if (!fCentralMomentList) { + return nullptr; + } + if (ind + 1 < fCentralMomentList->GetEntries()) { return dynamic_cast(fCentralMomentList->FindObject(Form("cm%i_%i", m, ind))); - return 0; + } + return nullptr; } void FlowPtContainer::createCentralMomentList() { - if (fCentralMomentList) - delete fCentralMomentList; + delete fCentralMomentList; fCentralMomentList = new TList(); fCentralMomentList->SetOwner(); for (auto m(1); m <= centralMomentMaxOrder; ++m) { - for (int i = -1; i < reinterpret_cast(fCMTermList->At(0))->getNSubs(); ++i) { - TH1* hMpt = reinterpret_cast(fCMTermList->At(0))->getHist(i); + for (int i = -1; i < dynamic_cast(fCMTermList->At(0))->getNSubs(); ++i) { + TH1* hMpt = dynamic_cast(fCMTermList->At(0))->getHist(i); std::vector hTs; for (int j = 0; j < m; ++j) { dynamic_cast(fCMTermList->FindObject(Form("cm%i_Mpt%i", m, j)))->SetErrorOption("g"); - hTs.push_back(reinterpret_cast(fCMTermList->FindObject(Form("cm%i_Mpt%i", m, j)))->getHist(i)); + hTs.push_back(dynamic_cast(fCMTermList->FindObject(Form("cm%i_Mpt%i", m, j)))->getHist(i)); } calculateCentralMomentHists(hTs, i, m, hMpt); } } - return; } void FlowPtContainer::calculateCentralMomentHists(std::vector inh, int ind, int m, TH1* hMpt) { - TH1* reth = reinterpret_cast(inh[0]->Clone(Form("cm%i_%i", m, ind))); + TH1* reth = dynamic_cast(inh[0]->Clone(Form("cm%i_%i", m, ind))); for (auto i(1); i < m; ++i) { TH1* mptPow = raiseHistToPower(hMpt, i); inh[i]->Multiply(mptPow); reth->Add(inh[i]); } TH1* mptLast = raiseHistToPower(hMpt, m); - reth->Add(mptLast, (m % 2) ? (-1) : 1); + reth->Add(mptLast, ((m % 2) != 0) ? (-1) : 1); fCentralMomentList->Add(reth); - return; } TH1* FlowPtContainer::getCumulantHist(int ind, int m) { - if (!fCumulantList) + if (!fCumulantList) { createCumulantList(); - if (!fCumulantList) - return 0; - if (ind + 1 < fCumulantList->GetEntries()) - return reinterpret_cast(fCumulantList->At((ind + 1) * mpar + m - 1)); - return 0; + } + if (!fCumulantList) { + return nullptr; + } + if (ind + 1 < fCumulantList->GetEntries()) { + return dynamic_cast(fCumulantList->At((ind + 1) * mpar + m - 1)); + } + return nullptr; } void FlowPtContainer::createCumulantList() { - if (fCumulantList) - delete fCumulantList; + delete fCumulantList; fCumulantList = new TList(); fCumulantList->SetOwner(); //((BootstrapProfile*)fCorrList->At(0))->PresetWeights((BootstrapProfile*)fCorrList->At(mpar-1)); - for (int i = -1; i < reinterpret_cast(fCorrList->At(0))->getNSubs(); ++i) { + for (int i = -1; i < dynamic_cast(fCorrList->At(0))->getNSubs(); ++i) { std::vector hTs; for (int j = 0; j < mpar; ++j) { dynamic_cast(fCorrList->FindObject(Form("mpt%i", j + 1)))->SetErrorOption("g"); - hTs.push_back(reinterpret_cast(fCorrList->FindObject(Form("mpt%i", j + 1)))->getHist(i)); + hTs.push_back(dynamic_cast(fCorrList->FindObject(Form("mpt%i", j + 1)))->getHist(i)); } calculateCumulantHists(hTs, i); } //((BootstrapProfile*)fCorrList->At(0))->PresetWeights(0); - return; } void FlowPtContainer::calculateCumulantHists(std::vector inh, int ind) { @@ -1878,15 +1860,15 @@ void FlowPtContainer::calculateCumulantHists(std::vector inh, int ind) // delete hWeights; fCumulantList->Add(dynamic_cast(reth->Clone(Form("kappa%i_%i", m, ind)))); } - return; } Long64_t FlowPtContainer::Merge(TCollection* collist) // o2-linter: disable=name/function-variable (Keep name consistent with ROOT streamer merging) { - if (!fCorrList || !fCMTermList) + if (!fCorrList || !fCMTermList) { return 0; + } Long64_t nmerged = 0; TIter allPTC(collist); - FlowPtContainer* lPTC = 0; + FlowPtContainer* lPTC = nullptr; while ((lPTC = dynamic_cast(allPTC()))) { TList* tCMTerm = lPTC->fCMTermList; TList* tCorr = lPTC->fCorrList; @@ -1896,47 +1878,54 @@ Long64_t FlowPtContainer::Merge(TCollection* collist) // o2-linter: disable=name TList* tCum = lPTC->fCumulantList; TList* tCM = lPTC->fCentralMomentList; if (tCMTerm) { - if (!fCMTermList) + if (!fCMTermList) { fCMTermList = dynamic_cast(tCMTerm->Clone()); - else + } else { mergeBSLists(fCMTermList, tCMTerm); + } nmerged++; } if (tCorr) { - if (!fCorrList) + if (!fCorrList) { fCorrList = dynamic_cast(tCorr->Clone()); - else + } else { mergeBSLists(fCorrList, tCorr); + } } if (tCov) { - if (!fCovList) + if (!fCovList) { fCovList = dynamic_cast(tCov->Clone()); - else + } else { mergeBSLists(fCovList, tCov); + } } if (tCum) { - if (!fCumulantList) + if (!fCumulantList) { fCumulantList = dynamic_cast(tCum->Clone()); - else + } else { mergeBSLists(fCumulantList, tCum); + } } if (tCM) { - if (!fCentralMomentList) + if (!fCentralMomentList) { fCentralMomentList = dynamic_cast(tCM->Clone()); - else + } else { mergeBSLists(fCentralMomentList, tCM); + } } if (tSub) { - if (!fSubList) + if (!fSubList) { fSubList = dynamic_cast(tSub->Clone()); - else + } else { mergeBSLists(fSubList, tSub); + } } if (tSubCM) { - if (!fSubCMList) + if (!fSubCMList) { fSubCMList = dynamic_cast(tSubCM->Clone()); - else + } else { mergeBSLists(fSubCMList, tSubCM); + } } } return nmerged; @@ -1948,8 +1937,8 @@ void FlowPtContainer::mergeBSLists(TList* source, TList* target) return; } for (int i = 0; i < source->GetEntries(); i++) { - BootstrapProfile* lObj = dynamic_cast(source->At(i)); - BootstrapProfile* tObj = dynamic_cast(target->At(i)); + auto* lObj = dynamic_cast(source->At(i)); + auto* tObj = dynamic_cast(target->At(i)); lObj->MergeBS(tObj); } } diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.h b/PWGCF/GenericFramework/Core/FlowPtContainer.h index 8616b4c85aa..c781a57d25a 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.h +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.h @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -47,13 +48,13 @@ class FlowPtContainer : public TNamed using FillType = std::variant, double>; FlowPtContainer(); explicit FlowPtContainer(const char* name); - ~FlowPtContainer(); + ~FlowPtContainer() override; FlowPtContainer(const char* name, const char* title); - void initialise(const o2::framework::AxisSpec axis, const int& maxOrder, const o2::analysis::genericframework::GFWCorrConfigs& configs, const int& nsub = 10); + void initialise(const o2::framework::AxisSpec& axis, const int& maxOrder, const o2::analysis::genericframework::GFWCorrConfigs& configs, const int& nsub = 10); void initialise(int nbinsx, double* xbins, const int& maxOrder, const o2::analysis::genericframework::GFWCorrConfigs& configs, const int& nsub = 10); void initialise(int nbinsx, double xlow, double xhigh, const int& maxOrder, const o2::analysis::genericframework::GFWCorrConfigs& configs, const int& nsub = 10); // initial pt-pt correlations with two subevents - void initialiseSubevent(const o2::framework::AxisSpec axis, const int& maxOrder, const int& nsubev = 2, const int& nsub = 10); + void initialiseSubevent(const o2::framework::AxisSpec& axis, const int& maxOrder, const int& nsubev = 2, const int& nsub = 10); void initialiseSubevent(int nbinsx, double* xbins, const int& maxOrder, const int& nsubev = 2, const int& nsub = 10); void initialiseSubevent(int nbinsx, double xlow, double xhigh, const int& maxOrder, const int& nsubev = 2, const int& nsub = 10); void fill(const double& w, const double& pt); @@ -66,36 +67,34 @@ class FlowPtContainer : public TNamed void calculateCorrelations(); void calculateSubeventCorrelations(); void calculateCMTerms(); - void fillPtProfiles(const double& lMult, const double& rn); - // Book and fill a separate pT observable with a weight calculated by the task. - // The task can supply a separate event weight for the same observable. - bool addPtProfile(const char* name, int observableOrder); - bool fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn); - void fillSubeventPtProfiles(const double& lMult, const double& rn); - void fillVnPtCorrProfiles(const double& lMult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); + void fillPtProfiles(const double& centmult, const double& rn); + void fillSubeventPtProfiles(const double& centmult, const double& rn); + void fillVnPtCorrProfiles(const double& centmult, 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 fillVnPtCorrProfiles(const int configIndex, const double& centmult, 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) { - if (fUseCentralMoments) + if (fUseCentralMoments) { fillVnDeltaPtProfiles(centmult, flowval, flowtuples, rn, mask); - else + } 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) + if (fUseCentralMoments) { fillVnDeltaPtProfiles(configIndex, centmult, flowval, flowtuples, rn, mask); - else + } 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)))) { + if ((mask & (1 << (m - 1))) == 0) { continue; } if (fUseCentralMoments) { @@ -106,17 +105,17 @@ class FlowPtContainer : public TNamed ++fillCounter; } } - return; } void fillVnPtStdProfiles(const double& centmult, const double& rn) { - if (fUseCentralMoments) + if (fUseCentralMoments) { fillVnDeltaPtStdProfiles(centmult, rn); - else + } else { fillVnPtCorrStdProfiles(centmult, rn); + } } - void fillCMProfiles(const double& lMult, const double& rn); - void fillCMSubeventProfiles(const double& lMult, const double& rn); + void fillCMProfiles(const double& centmult, const double& rn); + void fillCMSubeventProfiles(const double& centmult, const double& rn); TList* getCorrList() { return fCorrList; } TList* getCMTermList() { return fCMTermList; } TList* getCovList() { return fCovList; } @@ -228,8 +227,8 @@ class FlowPtContainer : public TNamed static const int centralMomentMaxOrder = 4; std::vector> subevents; void getSubevents(int k, int n, std::vector& current, std::vector>& subevents); - static constexpr float FactorialArray[9] = {1., 1., 2., 6., 24., 120., 720., 5040., 40320.}; - static constexpr int SignArray[9] = {1, -1, 1, -1, 1, -1, 1, -1, 1}; + static constexpr std::array FactorialArray = {1., 1., 2., 6., 24., 120., 720., 5040., 40320.}; + static constexpr std::array SignArray = {1, -1, 1, -1, 1, -1, 1, -1, 1}; ClassDef(FlowPtContainer, 2); }; #endif // PWGCF_GENERICFRAMEWORK_CORE_FLOWPTCONTAINER_H_ From d6524c80fbec26e27d77fed0ff93f7ff275abf53 Mon Sep 17 00:00:00 2001 From: Emil Gorm Nielsen Date: Thu, 17 Sep 2026 20:40:04 +0200 Subject: [PATCH 8/8] restore features removed by branch-related shenanigans --- .../GenericFramework/Core/FlowPtContainer.cxx | 44 ++++++++++++++++--- PWGCF/GenericFramework/Core/FlowPtContainer.h | 4 ++ .../Tasks/flowGenericFramework.cxx | 10 ++++- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx index aae48349f8a..d2d5a1740f6 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx @@ -398,7 +398,6 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, co LOGF(warning, "Multiplicity axis does not exist"); return; } - delete fSubList; fSubList = new TList(); fSubList->SetOwner(kTRUE); @@ -426,7 +425,6 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, co for (const auto& name : histnames) { fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nMultiBins, multiBins.data())); } - delete fSubCMList; fSubCMList = new TList(); fSubCMList->SetOwner(kTRUE); @@ -475,7 +473,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m if (mpar == 0) { mpar = maxOrder; } - delete fSubList; fSubList = new TList(); fSubList->SetOwner(kTRUE); @@ -503,7 +500,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m for (const auto& name : histnames) { fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nbinsx, xbins)); } - delete fSubCMList; fSubCMList = new TList(); fSubCMList->SetOwner(kTRUE); @@ -579,7 +575,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh, for (const auto& name : histnames) { fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nbinsx, xlow, xhigh)); } - delete fSubCMList; fSubCMList = new TList(); fSubCMList->SetOwner(kTRUE); @@ -694,6 +689,45 @@ void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn) } } } +bool FlowPtContainer::addPtProfile(const char* name, int observableOrder) +{ + if (!fCorrList || !name || (name[0] == 0) || observableOrder < 1 || observableOrder > mpar) { + LOGF(error, "Cannot add pT profile %s for order %d", name ? name : "(null)", observableOrder); + return false; + } + const std::string profileName{name}; + if (fCorrList->FindObject(profileName.c_str())) { + LOGF(error, "pT profile %s already exists", profileName.c_str()); + return false; + } + auto* original = dynamic_cast(fCorrList->At(observableOrder - 1)); + const auto* axis = original->GetXaxis(); + BootstrapProfile* profile = nullptr; + if (axis->GetXbins()->GetSize() != 0) { + profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXbins()->GetArray()); + } else { + profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXmin(), axis->GetXmax()); + } + if (original->fListOfEntries) { + profile->InitializeSubsamples(original->fListOfEntries->GetEntries()); + } + fCorrList->Add(profile); + return true; +} +bool FlowPtContainer::fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn) +{ + if (!fCorrList || !name || observableOrder < 1 || observableOrder > mpar || + static_cast(observableOrder) >= corrDen.size() || corrDen[observableOrder] == 0. || eventWeight == 0.) { + return false; + } + auto* profile = dynamic_cast(fCorrList->FindObject(name)); + if (!profile) { + LOGF(error, "pT profile %s has not been booked", name); + return false; + } + profile->FillProfile(mult, corrNum[observableOrder] / corrDen[observableOrder], eventWeight, rn); + return true; +} void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const double& rn) { int histCounter = 0; diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.h b/PWGCF/GenericFramework/Core/FlowPtContainer.h index c781a57d25a..96ada820053 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.h +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.h @@ -68,6 +68,10 @@ class FlowPtContainer : public TNamed void calculateSubeventCorrelations(); void calculateCMTerms(); void fillPtProfiles(const double& centmult, const double& rn); + // Book and fill a separate pT observable with a weight calculated by the task. + // The task can supply a separate event weight for the same observable. + bool addPtProfile(const char* name, int observableOrder); + bool fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn); void fillSubeventPtProfiles(const double& centmult, const double& rn); void fillVnPtCorrProfiles(const double& centmult, 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); diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index b1a40206e07..91e05af2fe7 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -878,7 +878,7 @@ struct FlowGenericFramework { if (resonance ? !cfgFill.cfgAnalyseK0Lambda : !cfgFill.cfgAnalyseChargedHadrons) { continue; } - const std::string target = source + (source.rfind("npt_v02_", 0) == 0 ? "_w3pc" : "_w2pc"); + const std::string target = source + (source.starts_with("npt_v02_") ? "_w3pc" : "_w2pc"); if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) { registry.addClone(source, target); } @@ -1685,6 +1685,8 @@ struct FlowGenericFramework { case 5: fillFractionProfile
(HIST("npt_v02_Lambda_sb2_w3pc"), HIST("MCGen/npt_v02_Lambda_sb2_w3pc"), pt, centmult, fraction, weight); break; + default: + return; } } else { switch (index) { @@ -1700,6 +1702,8 @@ struct FlowGenericFramework { case 3: fillFractionProfile
(HIST("npt_v02_pr_w3pc"), HIST("MCGen/npt_v02_pr_w3pc"), pt, centmult, fraction, weight); break; + default: + return; } } } else { @@ -1723,6 +1727,8 @@ struct FlowGenericFramework { case 5: fillFractionProfile
(HIST("npt_v0_Lambda_sb2_w2pc"), HIST("MCGen/npt_v0_Lambda_sb2_w2pc"), pt, centmult, fraction, weight); break; + default: + return; } } else { switch (index) { @@ -1738,6 +1744,8 @@ struct FlowGenericFramework { case 3: fillFractionProfile
(HIST("npt_v0_pr_w2pc"), HIST("MCGen/npt_v0_pr_w2pc"), pt, centmult, fraction, weight); break; + default: + return; } } }