From 24171a97f06ce9a98148f6b0c69db2beb5f209fa Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Fri, 21 Aug 2026 13:00:30 +0530 Subject: [PATCH 01/13] PWGCF: add multiplicity and pT fluctuations task --- PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt | 6 + .../Tasks/multandptFluctuations.cxx | 218 ++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx diff --git a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt index 25d872112b4..b7198ae6813 100644 --- a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt +++ b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt @@ -88,3 +88,9 @@ o2physics_add_dpl_workflow(strongly-intensive-corr SOURCES stronglyIntensiveCorr.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(multandpt-fluctuations + SOURCES multandptFluctuations.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore + COMPONENT_NAME Analysis) + diff --git a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx new file mode 100644 index 00000000000..cddb082b3de --- /dev/null +++ b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx @@ -0,0 +1,218 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file multandptFluctuations.cxx +/// \brief Calculate multiplicity and transverse momentum fluctuations using strongly intensive observables +/// \author Omama Rubza +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod; +using namespace o2::framework::expressions; + +struct MultandptFluctuations { + + // ------ Histogram binning + + Configurable nBinsPt{"nBinsPt", 100, "pT bins"}; + Configurable ndcaXY{"ndcaXY", 100, "DCAxy bins"}; + Configurable ndcaZ{"ndcaZ", 100, "DCAz bins"}; + Configurable nCentBins{"nCentBins", 100, "Number of centrality bins"}; + + // ------ Event Cuts + Configurable vtxZcut{"vtxZcut", 10.0f, "vertex Z"}; + Configurable cfgNoSameBunchPileup{"cfgNoSameBunchPileup", true, "kNoSameBunchPileup"}; + Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV", true, "Good Zvtx FT0 vs PV"}; + Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Good ITS Layers"}; + + // ----- Centrality estimator + Configurable cFT0M{"cFT0M", false, "FT0M centrality"}; // for pp + Configurable cFT0C{"cFT0C", true, "Use FT0C centrality"}; + + // ------ Track cuts + Configurable ptMinCut{"ptMinCut", 0.2f, "Minimum pT"}; + Configurable ptMaxCut{"ptMaxCut", 5.0f, "Maximum pT"}; + Configurable etaCut{"etaCut", 0.8f, "Maximum |eta|"}; + Configurable itsNClsCut{"itsNClsCut", 4, "Minimum ITS clusters"}; + Configurable tpcCrossCut{"tpcCrossCut", 70.0f, "TPC crossed rows"}; + Configurable crossedRowsOverFindableCut{"crossedRowsOverFindableCut", 0.8f, "TPC crossed rows over findable"}; + Configurable dcaZCut{"dcaZCut", 2.0f, "Maximum DCAz"}; + Configurable dcaXYCut{"dcaXYCut", 0.2f, "Maximum DCAxy"}; + Configurable tpcChiCut{"tpcChiCut", 4.0f, "TPC chi2/NCls"}; + Configurable itsChiCut{"itsChiCut", 36.0f, "ITS chi2/NCls"}; + Configurable requireITS{"requireITS", true, "Require ITS hit"}; + Configurable requireTPC{"requireTPC", true, "Require TPC hit"}; + Configurable requireInnerITS{"requireInnerITS", true, "At least one hit in ITS layers 0,1,2"}; + + //----- Histogram Registry + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + void init(InitContext const&) + { + const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; + const AxisSpec axisPt{nBinsPt, 0.15, 10.0, "p_{T}"}; + const AxisSpec axisVtxz{80, -20, 20, "V_{Z} (cm)"}; + const AxisSpec axisPhi{40, -1, 7, "#phi"}; + const AxisSpec axisdcaXY{ndcaXY, -0.3, 0.3, "DCAxy"}; + const AxisSpec axisdcaZ{ndcaZ, -3.0, 3.0, "DCAz"}; + const AxisSpec axisNch{500, 0, 500, "Nch"}; + const AxisSpec axisCent{nCentBins, 0.0, 100.0, "Centrality (%)"}; // ------------- centrality bins + histos.add("QA/BeforeCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); + histos.add("QA/AfterCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); + histos.add("QA/BeforeCut/Cent", "Centrality", kTH1F, {axisCent}); + histos.add("QA/AfterCut/Cent", "Centrality", kTH1F, {axisCent}); + histos.add("QA/BeforeCut/Eta", "Eta", kTH1F, {axisEta}); + histos.add("QA/AfterCut/Eta", "Eta", kTH1F, {axisEta}); + histos.add("QA/BeforeCut/Pt", "Pt", kTH1F, {axisPt}); + histos.add("QA/AfterCut/Pt", "Pt", kTH1F, {axisPt}); + histos.add("QA/BeforeCut/Phi", "Phi", kTH1F, {axisPhi}); + histos.add("QA/AfterCut/Phi", "Phi", kTH1F, {axisPhi}); + histos.add("QA/BeforeCut/DcaXY", "DCAxy", kTH1F, {axisdcaXY}); + histos.add("QA/AfterCut/DcaXY", "DCAxy", kTH1F, {axisdcaXY}); + histos.add("QA/BeforeCut/DcaZ", "DCAz", kTH1F, {axisdcaZ}); + histos.add("QA/AfterCut/DcaZ", "DCAz", kTH1F, {axisdcaZ}); + histos.add("hNch", "Nch", kTH1F, {axisNch}); + histos.add("h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisdcaZ}}); + histos.add("h2_DcaXY", "DCA_{XY}", kTH2D, {{axisPt}, {axisdcaXY}}); + histos.add("hEventCounter", "Number of events vs centrality", kTH1F, {axisCent}); + histos.add("p_a", " vs centrality", kTProfile, {axisCent}); + histos.add("p_b", " vs centrality", kTProfile, {axisCent}); + histos.add("p_a2", " vs centrality", kTProfile, {axisCent}); + histos.add("p_b2", " vs centrality", kTProfile, {axisCent}); + histos.add("p_ab", " vs centrality", kTProfile, {axisCent}); + histos.add("p_asumb", " vs centrality", kTProfile, {axisCent}); + } + + //---------- Filters + Filter ptFilter = (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut); + Filter etaFilter = nabs(aod::track::eta) < etaCut; + Filter posZFilter = nabs(aod::collision::posZ) < vtxZcut; + + using MyColsData = soa::Join; + using MyTracksData = soa::Join; + using MyFilteredTracksData = soa::Filtered; + + void process(MyColsData::iterator const& col, MyFilteredTracksData const& tracks) + { + histos.fill(HIST("QA/BeforeCut/VtxZ"), col.posZ()); + float cent = -1.0f; + if (cFT0M) { + cent = col.centFT0M(); + } + if (cFT0C) { + cent = col.centFT0C(); + // if (!track.isGlobalTrack()) continue; + } + if (cent < 0) { + return; + } + + histos.fill(HIST("QA/BeforeCut/Cent"), cent); + if (!col.sel8()) + return; + if (std::abs(col.posZ()) > vtxZcut) + return; + if (cfgNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + if (cfgEvSelUseGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; + if (cfgUseGoodITSLayerAllCut && !col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) + return; + + histos.fill(HIST("hEventCounter"), cent); + histos.fill(HIST("QA/AfterCut/VtxZ"), col.posZ()); + histos.fill(HIST("QA/AfterCut/Cent"), cent); + + double a = 0.0; + double b = 0.0; + + // if (!track.isGlobalTrack()) continue; + for (const auto& track : tracks) { + + histos.fill(HIST("QA/BeforeCut/Eta"), track.eta()); + histos.fill(HIST("QA/BeforeCut/Pt"), track.pt()); + histos.fill(HIST("QA/BeforeCut/Phi"), track.phi()); + histos.fill(HIST("QA/BeforeCut/DcaXY"), track.dcaXY()); + histos.fill(HIST("QA/BeforeCut/DcaZ"), track.dcaZ()); + + // Track quality cuts + + if (requireITS && !track.hasITS()) + continue; + if (requireTPC && !track.hasTPC()) + continue; + if (track.itsNCls() < itsNClsCut) + continue; + if (track.tpcNClsCrossedRows() < tpcCrossCut) + continue; + if (track.tpcCrossedRowsOverFindableCls() < crossedRowsOverFindableCut) + continue; + if (std::abs(track.dcaZ()) > dcaZCut) + continue; + if (std::abs(track.dcaXY()) > dcaXYCut) + continue; + if (track.tpcChi2NCl() > tpcChiCut) + continue; + if (track.itsChi2NCl() > itsChiCut) + continue; + if (std::abs(track.eta()) > etaCut) + continue; + if (requireInnerITS) { + auto itsMap = track.itsClusterMap(); + if (!(itsMap & (1 << 0)) && + !(itsMap & (1 << 1)) && + !(itsMap & (1 << 2))) { + continue; + } + } + + // After cuts QA + histos.fill(HIST("QA/AfterCut/Eta"), track.eta()); + histos.fill(HIST("QA/AfterCut/Pt"), track.pt()); + histos.fill(HIST("QA/AfterCut/Phi"), track.phi()); + histos.fill(HIST("QA/AfterCut/DcaXY"), track.dcaXY()); + histos.fill(HIST("QA/AfterCut/DcaZ"), track.dcaZ()); + histos.fill(HIST("h2_DcaZ"), track.pt(), track.dcaZ()); + histos.fill(HIST("h2_DcaXY"), track.pt(), track.dcaXY()); + a++; // A-nch, B =pt + b += track.pt(); + } + + // ---- Fill TProfiles (once per event) + histos.fill(HIST("p_a"), cent, a); + histos.fill(HIST("p_b"), cent, b); + histos.fill(HIST("p_a2"), cent, a * a); + histos.fill(HIST("p_b2"), cent, b * b); + histos.fill(HIST("p_ab"), cent, a * b); + histos.fill(HIST("p_asumb"), cent, a + b); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From b9a9bcb6ae3ff0e894976c3f00e36517d4d4bad6 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Wed, 26 Aug 2026 11:54:09 +0530 Subject: [PATCH 02/13] corrections --- PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx index cddb082b3de..a8b2c769143 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx @@ -18,6 +18,7 @@ #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/CCDB/EventSelectionParams.h" #include #include @@ -25,6 +26,11 @@ #include #include #include +#include +#include +#include +#include +#include #include From 08923b7e6f8047da8124e87c4510dc8edbed29e3 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Thu, 27 Aug 2026 10:48:40 +0530 Subject: [PATCH 03/13] update header files --- .../Tasks/multandptFluctuations.cxx | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx index a8b2c769143..b39560943b4 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx @@ -12,29 +12,26 @@ /// \file multandptFluctuations.cxx /// \brief Calculate multiplicity and transverse momentum fluctuations using strongly intensive observables /// \author Omama Rubza -#include "Common/Core/TrackSelection.h" +#include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/CCDB/EventSelectionParams.h" -#include +#include #include #include #include #include -#include #include #include -#include #include #include #include #include +#include using namespace o2; using namespace o2::framework; @@ -138,16 +135,21 @@ struct MultandptFluctuations { } histos.fill(HIST("QA/BeforeCut/Cent"), cent); - if (!col.sel8()) + if (!col.sel8()) { return; - if (std::abs(col.posZ()) > vtxZcut) + } + if (std::abs(col.posZ()) > vtxZcut) { return; - if (cfgNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + } + if (cfgNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; - if (cfgEvSelUseGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + } + if (cfgEvSelUseGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; - if (cfgUseGoodITSLayerAllCut && !col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) + } + if (cfgUseGoodITSLayerAllCut && !col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { return; + } histos.fill(HIST("hEventCounter"), cent); histos.fill(HIST("QA/AfterCut/VtxZ"), col.posZ()); @@ -167,31 +169,41 @@ struct MultandptFluctuations { // Track quality cuts - if (requireITS && !track.hasITS()) + if (requireITS && !track.hasITS()) { continue; - if (requireTPC && !track.hasTPC()) + } + if (requireTPC && !track.hasTPC()) { continue; - if (track.itsNCls() < itsNClsCut) + } + if (track.itsNCls() < itsNClsCut) { continue; - if (track.tpcNClsCrossedRows() < tpcCrossCut) + } + if (track.tpcNClsCrossedRows() < tpcCrossCut) { continue; - if (track.tpcCrossedRowsOverFindableCls() < crossedRowsOverFindableCut) + } + if (track.tpcCrossedRowsOverFindableCls() < crossedRowsOverFindableCut) { continue; - if (std::abs(track.dcaZ()) > dcaZCut) + } + if (std::abs(track.dcaZ()) > dcaZCut) { continue; - if (std::abs(track.dcaXY()) > dcaXYCut) + } + if (std::abs(track.dcaXY()) > dcaXYCut) { continue; - if (track.tpcChi2NCl() > tpcChiCut) + } + if (track.tpcChi2NCl() > tpcChiCut) { continue; - if (track.itsChi2NCl() > itsChiCut) + } + if (track.itsChi2NCl() > itsChiCut) { continue; - if (std::abs(track.eta()) > etaCut) + } + if (std::abs(track.eta()) > etaCut) { continue; + } if (requireInnerITS) { auto itsMap = track.itsClusterMap(); - if (!(itsMap & (1 << 0)) && - !(itsMap & (1 << 1)) && - !(itsMap & (1 << 2))) { + if (((itsMap & (1 << 0)) == 0) && + ((itsMap & (1 << 1)) == 0) && + ((itsMap & (1 << 2)) == 0)) { continue; } } From abafe6af18c4430e2d1cf7778585c0a950c3ab77 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Thu, 27 Aug 2026 11:03:23 +0530 Subject: [PATCH 04/13] Fix formatting --- PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx index b39560943b4..3f4d722d190 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx @@ -18,20 +18,20 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include #include +#include #include +#include #include #include -#include #include #include #include #include -#include #include +#include using namespace o2; using namespace o2::framework; From a25588f27b1532a2939030e06f316d3777ae551f Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Mon, 7 Sep 2026 15:04:23 +0530 Subject: [PATCH 05/13] Rename multandptFluctuations workflow --- PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt | 4 ++-- ...{multandptFluctuations.cxx => multAndPtFluctuations.cxx} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename PWGCF/EbyEFluctuations/Tasks/{multandptFluctuations.cxx => multAndPtFluctuations.cxx} (98%) diff --git a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt index b7198ae6813..efcb32c5efe 100644 --- a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt +++ b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt @@ -89,8 +89,8 @@ o2physics_add_dpl_workflow(strongly-intensive-corr PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(multandpt-fluctuations - SOURCES multandptFluctuations.cxx +o2physics_add_dpl_workflow(mult-and-pt-fluctuations + SOURCES multAndPtFluctuations.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) diff --git a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx similarity index 98% rename from PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx rename to PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index 3f4d722d190..d27f9b0ca72 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multandptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file multandptFluctuations.cxx +/// \file multAndPtFluctuations.cxx /// \brief Calculate multiplicity and transverse momentum fluctuations using strongly intensive observables /// \author Omama Rubza #include "Common/CCDB/EventSelectionParams.h" @@ -38,7 +38,7 @@ using namespace o2::framework; using namespace o2::aod; using namespace o2::framework::expressions; -struct MultandptFluctuations { +struct MultAndPtFluctuations { // ------ Histogram binning @@ -232,5 +232,5 @@ struct MultandptFluctuations { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 971851631f4d21d67b7eb65c45fa75be02b1a9b8 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Mon, 7 Sep 2026 16:59:20 +0530 Subject: [PATCH 06/13] Remove unused includes --- PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index d27f9b0ca72..2032d0e252a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -15,11 +15,9 @@ #include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" #include -#include #include #include #include @@ -28,8 +26,6 @@ #include #include -#include - #include #include From f4707775ee4d58bec1aa593d41a1b547282320b4 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Fri, 20 Nov 2026 22:17:47 +0530 Subject: [PATCH 07/13] Update mult task --- .../Tasks/multAndPtFluctuations.cxx | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index 2032d0e252a..35a1906f914 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -42,6 +42,7 @@ struct MultAndPtFluctuations { Configurable ndcaXY{"ndcaXY", 100, "DCAxy bins"}; Configurable ndcaZ{"ndcaZ", 100, "DCAz bins"}; Configurable nCentBins{"nCentBins", 100, "Number of centrality bins"}; + ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality bining"};//varying binning // ------ Event Cuts Configurable vtxZcut{"vtxZcut", 10.0f, "vertex Z"}; @@ -49,6 +50,9 @@ struct MultAndPtFluctuations { Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV", true, "Good Zvtx FT0 vs PV"}; Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Good ITS Layers"}; + // --------------- Subsample configuration + Configurable cfgNSubsample{"cfgNSubsample", 30, "No of Subsamples"}; + // ----- Centrality estimator Configurable cFT0M{"cFT0M", false, "FT0M centrality"}; // for pp Configurable cFT0C{"cFT0C", true, "Use FT0C centrality"}; @@ -80,6 +84,11 @@ struct MultAndPtFluctuations { const AxisSpec axisdcaZ{ndcaZ, -3.0, 3.0, "DCAz"}; const AxisSpec axisNch{500, 0, 500, "Nch"}; const AxisSpec axisCent{nCentBins, 0.0, 100.0, "Centrality (%)"}; // ------------- centrality bins + + //--------------- Subsample Axes + const int nSubsamples = static_cast(cfgNSubsample); + const AxisSpec subsampleAxis{cfgNSubsample, 0.0, static_cast(nSubsamples), "Subsample"}; + histos.add("QA/BeforeCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); histos.add("QA/AfterCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); histos.add("QA/BeforeCut/Cent", "Centrality", kTH1F, {axisCent}); @@ -96,14 +105,52 @@ struct MultAndPtFluctuations { histos.add("QA/AfterCut/DcaZ", "DCAz", kTH1F, {axisdcaZ}); histos.add("hNch", "Nch", kTH1F, {axisNch}); histos.add("h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisdcaZ}}); + histos.add("Nch/hNch", "Nch", kTH1F, {axisNch}); + histos.add("Nch/hNch_0_10", "Nch (0-10%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_10_20", "Nch (10-20%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_20_30", "Nch (20-30%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_30_40", "Nch (30-40%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_40_50", "Nch (40-50%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_50_60", "Nch (50-60%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_60_70", "Nch (60-70%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_70_80", "Nch (70-80%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_80_90", "Nch (80-90%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_90_100", "Nch (90-100%)", kTH1F, {axisNch}); histos.add("h2_DcaXY", "DCA_{XY}", kTH2D, {{axisPt}, {axisdcaXY}}); histos.add("hEventCounter", "Number of events vs centrality", kTH1F, {axisCent}); + + //---------- Data TProfiles----------------------------------- histos.add("p_a", " vs centrality", kTProfile, {axisCent}); histos.add("p_b", " vs centrality", kTProfile, {axisCent}); histos.add("p_a2", " vs centrality", kTProfile, {axisCent}); histos.add("p_b2", " vs centrality", kTProfile, {axisCent}); histos.add("p_ab", " vs centrality", kTProfile, {axisCent}); histos.add("p_asumb", " vs centrality", kTProfile, {axisCent}); + + // For varying binning + histos.add("Data/p_a_custom", " vs custom centrality", kTProfile, {centBining}); + histos.add("Data/p_b_custom", " vs custom centrality", kTProfile, {centBining}); + histos.add("Data/p_a2_custom", " vs custom centrality", kTProfile, {centBining}); + histos.add("Data/p_b2_custom", " vs custom centrality", kTProfile, {centBining}); + histos.add("Data/p_ab_custom", " vs custom centrality", kTProfile, {centBining}); + histos.add("Data/p_asumb_custom", " vs custom centrality", kTProfile, {centBining}); + + //------- subsample TProfile + histos.add("Data/subsample/p_a", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_b", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_a2", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_b2", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_ab", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_asumb", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); + + //---------- subsample custom TProfile + histos.add("Data/subsample/p_a_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); + histos.add("Data/subsample/p_b_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); + histos.add("Data/subsample/p_a2_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); + histos.add("Data/subsample/p_b2_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); + histos.add("Data/subsample/p_ab_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); + histos.add("Data/subsample/p_asumb_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); + } //---------- Filters @@ -215,6 +262,18 @@ struct MultAndPtFluctuations { a++; // A-nch, B =pt b += track.pt(); } + static constexpr float cent10 = 10.f; + histos.fill(HIST("Nch/hNch"), a); + if (cent < cent10) histos.fill(HIST("Nch/hNch_0_10"), a); + else if (cent < cent10*2) histos.fill(HIST("Nch/hNch_10_20"), a); + else if (cent < cent10*3) histos.fill(HIST("Nch/hNch_20_30"), a); + else if (cent < cent10*4) histos.fill(HIST("Nch/hNch_30_40"), a); + else if (cent < cent10*5) histos.fill(HIST("Nch/hNch_40_50"), a); + else if (cent < cent10*6) histos.fill(HIST("Nch/hNch_50_60"), a); + else if (cent < cent10*7) histos.fill(HIST("Nch/hNch_60_70"), a); + else if (cent < cent10*8) histos.fill(HIST("Nch/hNch_70_80"), a); + else if (cent < cent10*9) histos.fill(HIST("Nch/hNch_80_90"), a); + else if (cent < cent10*10) histos.fill(HIST("Nch/hNch_90_100"), a); // ---- Fill TProfiles (once per event) histos.fill(HIST("p_a"), cent, a); @@ -223,6 +282,29 @@ struct MultAndPtFluctuations { histos.fill(HIST("p_b2"), cent, b * b); histos.fill(HIST("p_ab"), cent, a * b); histos.fill(HIST("p_asumb"), cent, a + b); + + histos.fill(HIST("Data/p_a_custom"), cent, a); + histos.fill(HIST("Data/p_b_custom"), cent, b); + histos.fill(HIST("Data/p_a2_custom"), cent, a*a); + histos.fill(HIST("Data/p_b2_custom"), cent, b*b); + histos.fill(HIST("Data/p_ab_custom"), cent, a*b); + histos.fill(HIST("Data/p_asumb_custom"), cent, a+b); + + const int nSub = std::max(1, static_cast(cfgNSubsample)); + const int subsample = static_cast(col.globalIndex() % static_cast(nSub)); + + histos.fill(HIST("Data/subsample/p_a"), cent, subsample, a); + histos.fill(HIST("Data/subsample/p_b"), cent, subsample, b); + histos.fill(HIST("Data/subsample/p_a2"), cent, subsample, a*a); + histos.fill(HIST("Data/subsample/p_b2"), cent, subsample, b*b); + histos.fill(HIST("Data/subsample/p_ab"), cent, subsample, a*b); + histos.fill(HIST("Data/subsample/p_asumb"), cent, subsample, a+b); + histos.fill(HIST("Data/subsample/p_a_custom"), cent, subsample, a); + histos.fill(HIST("Data/subsample/p_b_custom"), cent, subsample, b); + histos.fill(HIST("Data/subsample/p_a2_custom"), cent, subsample, a*a); + histos.fill(HIST("Data/subsample/p_b2_custom"), cent, subsample, b*b); + histos.fill(HIST("Data/subsample/p_ab_custom"), cent, subsample, a*b); + histos.fill(HIST("Data/subsample/p_asumb_custom"), cent, subsample, a+b); } }; From bf9bc5e443a004c45c4c4ec56322794841a9d479 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Sat, 21 Nov 2026 10:52:15 +0530 Subject: [PATCH 08/13] Fix Formatting issues --- .../Tasks/multAndPtFluctuations.cxx | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index 35a1906f914..9d9c1d33346 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -26,7 +26,9 @@ #include #include +#include #include +#include #include using namespace o2; @@ -262,19 +264,30 @@ struct MultAndPtFluctuations { a++; // A-nch, B =pt b += track.pt(); } - static constexpr float cent10 = 10.f; + static constexpr float Cent10 = 10.f; histos.fill(HIST("Nch/hNch"), a); - if (cent < cent10) histos.fill(HIST("Nch/hNch_0_10"), a); - else if (cent < cent10*2) histos.fill(HIST("Nch/hNch_10_20"), a); - else if (cent < cent10*3) histos.fill(HIST("Nch/hNch_20_30"), a); - else if (cent < cent10*4) histos.fill(HIST("Nch/hNch_30_40"), a); - else if (cent < cent10*5) histos.fill(HIST("Nch/hNch_40_50"), a); - else if (cent < cent10*6) histos.fill(HIST("Nch/hNch_50_60"), a); - else if (cent < cent10*7) histos.fill(HIST("Nch/hNch_60_70"), a); - else if (cent < cent10*8) histos.fill(HIST("Nch/hNch_70_80"), a); - else if (cent < cent10*9) histos.fill(HIST("Nch/hNch_80_90"), a); - else if (cent < cent10*10) histos.fill(HIST("Nch/hNch_90_100"), a); + if (cent < Cent10) { + histos.fill(HIST("Nch/hNch_0_10"), a); + } else if (cent < Cent10 * 2) { + histos.fill(HIST("Nch/hNch_10_20"), a); + } else if (cent < Cent10 * 3) { + histos.fill(HIST("Nch/hNch_20_30"), a); + } else if (cent < Cent10 * 4) { + histos.fill(HIST("Nch/hNch_30_40"), a); + } else if (cent < Cent10 * 5) { + histos.fill(HIST("Nch/hNch_40_50"), a); + } else if (cent < Cent10 * 6) { + histos.fill(HIST("Nch/hNch_50_60"), a); + } else if (cent < Cent10 * 7) { + histos.fill(HIST("Nch/hNch_60_70"), a); + } else if (cent < Cent10 * 8) { + histos.fill(HIST("Nch/hNch_70_80"), a); + } else if (cent < Cent10 * 9) { + histos.fill(HIST("Nch/hNch_80_90"), a); + } else if (cent < Cent10 * 10) { + histos.fill(HIST("Nch/hNch_90_100"), a); + } // ---- Fill TProfiles (once per event) histos.fill(HIST("p_a"), cent, a); histos.fill(HIST("p_b"), cent, b); From 57075fecea81cddd860a30e4a2e64cc2a04b0f2e Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Sat, 21 Nov 2026 11:31:00 +0530 Subject: [PATCH 09/13] apply clang-format corrections --- .../Tasks/multAndPtFluctuations.cxx | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index 9d9c1d33346..c337e410107 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -44,7 +44,7 @@ struct MultAndPtFluctuations { Configurable ndcaXY{"ndcaXY", 100, "DCAxy bins"}; Configurable ndcaZ{"ndcaZ", 100, "DCAz bins"}; Configurable nCentBins{"nCentBins", 100, "Number of centrality bins"}; - ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality bining"};//varying binning + ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality bining"}; // varying binning // ------ Event Cuts Configurable vtxZcut{"vtxZcut", 10.0f, "vertex Z"}; @@ -85,7 +85,7 @@ struct MultAndPtFluctuations { const AxisSpec axisdcaXY{ndcaXY, -0.3, 0.3, "DCAxy"}; const AxisSpec axisdcaZ{ndcaZ, -3.0, 3.0, "DCAz"}; const AxisSpec axisNch{500, 0, 500, "Nch"}; - const AxisSpec axisCent{nCentBins, 0.0, 100.0, "Centrality (%)"}; // ------------- centrality bins + const AxisSpec axisCent{nCentBins, 0.0, 100.0, "Centrality (%)"}; //------------- centrality bins //--------------- Subsample Axes const int nSubsamples = static_cast(cfgNSubsample); @@ -108,7 +108,7 @@ struct MultAndPtFluctuations { histos.add("hNch", "Nch", kTH1F, {axisNch}); histos.add("h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisdcaZ}}); histos.add("Nch/hNch", "Nch", kTH1F, {axisNch}); - histos.add("Nch/hNch_0_10", "Nch (0-10%)", kTH1F, {axisNch}); + histos.add("Nch/hNch_0_10", "Nch (0-10%)", kTH1F, {axisNch}); histos.add("Nch/hNch_10_20", "Nch (10-20%)", kTH1F, {axisNch}); histos.add("Nch/hNch_20_30", "Nch (20-30%)", kTH1F, {axisNch}); histos.add("Nch/hNch_30_40", "Nch (30-40%)", kTH1F, {axisNch}); @@ -152,7 +152,6 @@ struct MultAndPtFluctuations { histos.add("Data/subsample/p_b2_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); histos.add("Data/subsample/p_ab_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); histos.add("Data/subsample/p_asumb_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - } //---------- Filters @@ -298,26 +297,26 @@ struct MultAndPtFluctuations { histos.fill(HIST("Data/p_a_custom"), cent, a); histos.fill(HIST("Data/p_b_custom"), cent, b); - histos.fill(HIST("Data/p_a2_custom"), cent, a*a); - histos.fill(HIST("Data/p_b2_custom"), cent, b*b); - histos.fill(HIST("Data/p_ab_custom"), cent, a*b); - histos.fill(HIST("Data/p_asumb_custom"), cent, a+b); + histos.fill(HIST("Data/p_a2_custom"), cent, a * a); + histos.fill(HIST("Data/p_b2_custom"), cent, b * b); + histos.fill(HIST("Data/p_ab_custom"), cent, a * b); + histos.fill(HIST("Data/p_asumb_custom"), cent, a + b); const int nSub = std::max(1, static_cast(cfgNSubsample)); const int subsample = static_cast(col.globalIndex() % static_cast(nSub)); histos.fill(HIST("Data/subsample/p_a"), cent, subsample, a); histos.fill(HIST("Data/subsample/p_b"), cent, subsample, b); - histos.fill(HIST("Data/subsample/p_a2"), cent, subsample, a*a); - histos.fill(HIST("Data/subsample/p_b2"), cent, subsample, b*b); - histos.fill(HIST("Data/subsample/p_ab"), cent, subsample, a*b); - histos.fill(HIST("Data/subsample/p_asumb"), cent, subsample, a+b); + histos.fill(HIST("Data/subsample/p_a2"), cent, subsample, a * a); + histos.fill(HIST("Data/subsample/p_b2"), cent, subsample, b * b); + histos.fill(HIST("Data/subsample/p_ab"), cent, subsample, a * b); + histos.fill(HIST("Data/subsample/p_asumb"), cent, subsample, a + b); histos.fill(HIST("Data/subsample/p_a_custom"), cent, subsample, a); histos.fill(HIST("Data/subsample/p_b_custom"), cent, subsample, b); - histos.fill(HIST("Data/subsample/p_a2_custom"), cent, subsample, a*a); - histos.fill(HIST("Data/subsample/p_b2_custom"), cent, subsample, b*b); - histos.fill(HIST("Data/subsample/p_ab_custom"), cent, subsample, a*b); - histos.fill(HIST("Data/subsample/p_asumb_custom"), cent, subsample, a+b); + histos.fill(HIST("Data/subsample/p_a2_custom"), cent, subsample, a * a); + histos.fill(HIST("Data/subsample/p_b2_custom"), cent, subsample, b * b); + histos.fill(HIST("Data/subsample/p_ab_custom"), cent, subsample, a * b); + histos.fill(HIST("Data/subsample/p_asumb_custom"), cent, subsample, a + b); } }; From 996cab79ebd0990fdb801815faa76ec091a58e87 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Tue, 1 Dec 2026 13:34:12 +0530 Subject: [PATCH 10/13] Update multiplicity and transverse momentum fluctuations task --- .../Tasks/multAndPtFluctuations.cxx | 1153 +++++++++++++---- 1 file changed, 929 insertions(+), 224 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index c337e410107..c1278404adc 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -12,102 +12,205 @@ /// \file multAndPtFluctuations.cxx /// \brief Calculate multiplicity and transverse momentum fluctuations using strongly intensive observables /// \author Omama Rubza +#include "PWGCF/Core/CorrelationContainer.h" + #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" +#include #include +#include #include #include #include #include #include +#include #include #include -#include -#include +#include +#include +#include +#include + +#include #include +#include #include using namespace o2; using namespace o2::framework; -using namespace o2::aod; +using namespace o2::framework::expressions; +using namespace std; +using namespace o2::constants::physics; + +using namespace o2; +using namespace o2::framework; using namespace o2::framework::expressions; struct MultAndPtFluctuations { + static constexpr float CentMin = 0.f; + static constexpr float Cent10 = 10.f; + static constexpr float CentMax = 100.f; + // PDG charge tolerance + static constexpr double ChargeTolerance = 1.e-6; - // ------ Histogram binning + Service pdgService; - Configurable nBinsPt{"nBinsPt", 100, "pT bins"}; - Configurable ndcaXY{"ndcaXY", 100, "DCAxy bins"}; - Configurable ndcaZ{"ndcaZ", 100, "DCAz bins"}; - Configurable nCentBins{"nCentBins", 100, "Number of centrality bins"}; - ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality bining"}; // varying binning + // -------------------------------------------------- + // Configurables + // -------------------------------------------------- - // ------ Event Cuts - Configurable vtxZcut{"vtxZcut", 10.0f, "vertex Z"}; - Configurable cfgNoSameBunchPileup{"cfgNoSameBunchPileup", true, "kNoSameBunchPileup"}; - Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV", true, "Good Zvtx FT0 vs PV"}; - Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Good ITS Layers"}; + Configurable cFT0M{"cFT0M", false, "Use FT0M centrality"}; + Configurable cFT0C{"cFT0C", true, "Use FT0C centrality"}; - // --------------- Subsample configuration - Configurable cfgNSubsample{"cfgNSubsample", 30, "No of Subsamples"}; + Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z cut"}; + Configurable cSel8Trig{"cSel8Trig", true, "Require sel8"}; - // ----- Centrality estimator - Configurable cFT0M{"cFT0M", false, "FT0M centrality"}; // for pp - Configurable cFT0C{"cFT0C", true, "Use FT0C centrality"}; + Configurable cPileupReject{"cPileupReject", false, "Reject same-bunch pileup"}; + Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Require good ITS layers"}; + Configurable cTFBorder{"cTFBorder", false, "Reject timeframe border"}; + Configurable cNoItsROBorder{"cNoItsROBorder", false, "Reject ITS readout-frame border"}; + Configurable cItsTpcVtx{"cItsTpcVtx", false, "Require ITS-TPC vertex"}; + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "Require good FT0-PV vertex difference"}; - // ------ Track cuts + Configurable etaCut{"etaCut", 0.8f, "Pseudorapidity cut"}; Configurable ptMinCut{"ptMinCut", 0.2f, "Minimum pT"}; - Configurable ptMaxCut{"ptMaxCut", 5.0f, "Maximum pT"}; - Configurable etaCut{"etaCut", 0.8f, "Maximum |eta|"}; - Configurable itsNClsCut{"itsNClsCut", 4, "Minimum ITS clusters"}; - Configurable tpcCrossCut{"tpcCrossCut", 70.0f, "TPC crossed rows"}; - Configurable crossedRowsOverFindableCut{"crossedRowsOverFindableCut", 0.8f, "TPC crossed rows over findable"}; - Configurable dcaZCut{"dcaZCut", 2.0f, "Maximum DCAz"}; - Configurable dcaXYCut{"dcaXYCut", 0.2f, "Maximum DCAxy"}; - Configurable tpcChiCut{"tpcChiCut", 4.0f, "TPC chi2/NCls"}; - Configurable itsChiCut{"itsChiCut", 36.0f, "ITS chi2/NCls"}; - Configurable requireITS{"requireITS", true, "Require ITS hit"}; - Configurable requireTPC{"requireTPC", true, "Require TPC hit"}; - Configurable requireInnerITS{"requireInnerITS", true, "At least one hit in ITS layers 0,1,2"}; - - //----- Histogram Registry - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable ptMaxCut{"ptMaxCut", 5.f, "Maximum pT"}; + + Configurable dcaXYCut{"dcaXYCut", 0.2f, "DCAxy cut"}; + Configurable dcaZCut{"dcaZCut", 2.f, "DCAz cut"}; + Configurable tpcCrossCut{"tpcCrossCut", 70.f, "Minimum TPC crossed rows"}; + Configurable itsChiCut{"itsChiCut", 36.f, "Maximum ITS chi2 per cluster"}; + Configurable tpcChiCut{"tpcChiCut", 4.f, "Maximum TPC chi2 per cluster"}; + + Configurable cPVcont{"cPVcont", false, "Require primary vertex contributor"}; + Configurable cDcaXy{"cDcaXy", true, "Apply DCAxy cut"}; + Configurable cDcaZ{"cDcaZ", true, "Apply DCAz cut"}; + Configurable cTpcCr{"cTpcCr", true, "Apply TPC crossed-rows cut"}; + Configurable cItsChi{"cItsChi", true, "Apply ITS chi2 cut"}; + Configurable cTpcChi{"cTpcChi", true, "Apply TPC chi2 cut"}; + + Configurable cfgNSubsample{"cfgNSubsample", 30, "Number of subsamples"}; + + ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Custom centrality binning"}; + + Configurable nCentBins{"nCentBins", 100, "Number of standard centrality bins"}; + + Configurable cfgEvSelMultCorrelation{"cfgEvSelMultCorrelation", true, "Enable multiplicity-correlation rejection"}; + + // -------------------------------------------------- + // Multiplicity-correlation cut configurables + // -------------------------------------------------- + + struct : ConfigurableGroup { + + Configurable cfgMultPVT0CCutEnabled{"cfgMultPVT0CCutEnabled", true, "Enable PV multiplicity vs FT0C cut"}; + + Configurable cfgMultGlobalFT0CCutEnabled{"cfgMultGlobalFT0CCutEnabled", true, "Enable global tracks vs FT0C cut"}; + + Configurable cfgMultGlobalPVCutEnabled{"cfgMultGlobalPVCutEnabled", true, "Enable global tracks vs PV multiplicity cut"}; + + Configurable cfgMultCutNSigma{"cfgMultCutNSigma", 3.5f, "Number of sigma for multiplicity-correlation cuts"}; + + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{30.434, -0.917137, 0.0185032, -0.000198425, 7.94381e-07, 13.7406, -0.282656, 0.00556147, -6.32766e-05, 2.51648e-07}, "PV multiplicity vs FT0C cut parameters"}; + + Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", std::vector{18.9628, -0.576466, 0.0117324, -0.000126086, 5.05365e-07, 8.99921, -0.188022, 0.0037089, -4.20275e-05, 1.68234e-07}, "Global tracks vs FT0C cut parameters"}; + + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{0.148031, 0.616699, 0.603083, 0.112751, -0.0013846, 8.38211e-06}, "Global tracks vs PV multiplicity cut parameters"}; + + std::vector multPVT0CCutPars; + std::vector multGlobalFT0CPars; + std::vector multGlobalPVCutPars; + + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + + TF1* fMultGlobalFT0CCutLow = nullptr; + TF1* fMultGlobalFT0CCutHigh = nullptr; + + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + + } cfgFunCoeff; + + // ---------------Filters and table definitions + Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && requireGlobalTrackInFilter(); + + using MyCollisions = soa::Join; + using MyCollision = MyCollisions::iterator; + + using MyTracks = soa::Filtered>; + + using MyMCCollisions = soa::Join; + using MyMCCollision = MyMCCollisions::iterator; + + using MyMCTracks = soa::Filtered>; + using MyMCTrack = MyMCTracks::iterator; + + // -----------------Histogram registry + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // ------------------Initialization void init(InitContext const&) { - const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; - const AxisSpec axisPt{nBinsPt, 0.15, 10.0, "p_{T}"}; - const AxisSpec axisVtxz{80, -20, 20, "V_{Z} (cm)"}; - const AxisSpec axisPhi{40, -1, 7, "#phi"}; - const AxisSpec axisdcaXY{ndcaXY, -0.3, 0.3, "DCAxy"}; - const AxisSpec axisdcaZ{ndcaZ, -3.0, 3.0, "DCAz"}; - const AxisSpec axisNch{500, 0, 500, "Nch"}; - const AxisSpec axisCent{nCentBins, 0.0, 100.0, "Centrality (%)"}; //------------- centrality bins - - //--------------- Subsample Axes - const int nSubsamples = static_cast(cfgNSubsample); - const AxisSpec subsampleAxis{cfgNSubsample, 0.0, static_cast(nSubsamples), "Subsample"}; - - histos.add("QA/BeforeCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); - histos.add("QA/AfterCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); - histos.add("QA/BeforeCut/Cent", "Centrality", kTH1F, {axisCent}); - histos.add("QA/AfterCut/Cent", "Centrality", kTH1F, {axisCent}); - histos.add("QA/BeforeCut/Eta", "Eta", kTH1F, {axisEta}); - histos.add("QA/AfterCut/Eta", "Eta", kTH1F, {axisEta}); - histos.add("QA/BeforeCut/Pt", "Pt", kTH1F, {axisPt}); - histos.add("QA/AfterCut/Pt", "Pt", kTH1F, {axisPt}); - histos.add("QA/BeforeCut/Phi", "Phi", kTH1F, {axisPhi}); - histos.add("QA/AfterCut/Phi", "Phi", kTH1F, {axisPhi}); - histos.add("QA/BeforeCut/DcaXY", "DCAxy", kTH1F, {axisdcaXY}); - histos.add("QA/AfterCut/DcaXY", "DCAxy", kTH1F, {axisdcaXY}); - histos.add("QA/BeforeCut/DcaZ", "DCAz", kTH1F, {axisdcaZ}); - histos.add("QA/AfterCut/DcaZ", "DCAz", kTH1F, {axisdcaZ}); - histos.add("hNch", "Nch", kTH1F, {axisNch}); - histos.add("h2_DcaZ", "DCA_{Z}", kTH2D, {{axisPt}, {axisdcaZ}}); - histos.add("Nch/hNch", "Nch", kTH1F, {axisNch}); + const AxisSpec vtxzAxis{800, -20., 20., "V_{Z} (cm)"}; + const AxisSpec dcaAxis{1000, -0.5, 0.5, "DCA_{xy} (cm)"}; + const AxisSpec dcazAxis{600, -3., 3., "DCA_{z} (cm)"}; + const AxisSpec phiAxis{70, 0., 7., "#phi"}; + const AxisSpec ptAxis{70, 0., 7., "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec etaAxis{20, -1., 1., "#eta"}; + const AxisSpec centAxis{100, 0., 100., "Centrality (%)"}; + const AxisSpec axisCent{nCentBins, 0., 100., "Centrality (%)"}; + const AxisSpec cent1Axis{centBining, "Centrality (%)"}; + const AxisSpec axisNch{2000, 0., 2000., "N_{ch}"}; + const AxisSpec tpcChiAxis{700, 0., 7., "TPC #chi^{2}/N_{cls}"}; + const AxisSpec itsChiAxis{400, 0., 40., "ITS #chi^{2}/N_{cls}"}; + const AxisSpec crossedRowAxis{1600, 0., 160., "TPC crossed rows"}; + + const int nSub = std::max(1, static_cast(cfgNSubsample)); + const AxisSpec subsampleAxis{nSub, 0., static_cast(nSub), "Subsample"}; + + // -----------Track QA: before manual track selection----------- + histos.add("QA/Before/VtxZ", "Vertex Z before event selection", kTH1F, {vtxzAxis}); + histos.add("QA/Before/DcaXY", "DCAxy before track selection", kTH1F, {dcaAxis}); + histos.add("QA/Before/DcaZ", "DCAz before track selection", kTH1F, {dcazAxis}); + histos.add("QA/Before/TPCchi2perCluster", "TPC chi2 before track selection", kTH1D, {tpcChiAxis}); + histos.add("QA/Before/ITSchi2perCluster", "ITS chi2 before track selection", kTH1D, {itsChiAxis}); + histos.add("QA/Before/TPCCrossedrows", "TPC crossed rows before track selection", kTH1D, {crossedRowAxis}); + histos.add("QA/Before/PtDcaXY_before", "pT vs DCAxy before track selection", kTH2D, {ptAxis, dcaAxis}); + histos.add("QA/Before/PtDcaZ_before", "pT vs DCAz before track selection", kTH2D, {ptAxis, dcazAxis}); + + // ----------Track QA: after manual track selection------------- + histos.add("QA/phi", "Azimuthal angle", kTH1F, {phiAxis}); + + histos.add("QA/After/VtxZ", "Vertex Z after event selection", kTH1F, {vtxzAxis}); + histos.add("QA/After/DcaXY", "DCAxy after track selection", kTH1F, {dcaAxis}); + histos.add("QA/After/DcaZ", "DCAz after track selection", kTH1F, {dcazAxis}); + histos.add("QA/After/TPCchi2perCluster", "TPC chi2 after track selection", kTH1D, {tpcChiAxis}); + histos.add("QA/After/ITSchi2perCluster", "ITS chi2 after track selection", kTH1D, {itsChiAxis}); + histos.add("QA/After/TPCCrossedrows", "TPC crossed rows after track selection", kTH1D, {crossedRowAxis}); + histos.add("QA/After/PtDcaXY", "pT vs DCAxy after track selection", kTH2D, {ptAxis, dcaAxis}); + histos.add("QA/After/PtDcaZ", "pT vs DCAz after track selection", kTH2D, {ptAxis, dcazAxis}); + + histos.add("QA/After/Eta", "Eta after track selection", kTH1F, {etaAxis}); + histos.add("QA/After/Pt", "pT after track selection", kTH1F, {ptAxis}); + histos.add("QA/After/Pt_eta", "pT vs eta", kTH2F, {ptAxis, etaAxis}); + histos.add("QA/After/cent_hEta", "Centrality vs eta", kTH2F, {cent1Axis, etaAxis}); + histos.add("QA/After/cent_hPt", "Centrality vs pT", kTH2F, {cent1Axis, ptAxis}); + histos.add("QA/After/Centrality", "Accepted-event centrality", kTH1F, {centAxis}); + histos.add("QA/After/Multiplicity", "Global track multiplicity", kTH1F, {axisNch}); + + // ------------------------------------------------ + // Nch histograms + // ------------------------------------------------ + + histos.add("Nch/hNch", "Event-wise Nch", kTH1F, {axisNch}); histos.add("Nch/hNch_0_10", "Nch (0-10%)", kTH1F, {axisNch}); histos.add("Nch/hNch_10_20", "Nch (10-20%)", kTH1F, {axisNch}); histos.add("Nch/hNch_20_30", "Nch (20-30%)", kTH1F, {axisNch}); @@ -118,209 +221,811 @@ struct MultAndPtFluctuations { histos.add("Nch/hNch_70_80", "Nch (70-80%)", kTH1F, {axisNch}); histos.add("Nch/hNch_80_90", "Nch (80-90%)", kTH1F, {axisNch}); histos.add("Nch/hNch_90_100", "Nch (90-100%)", kTH1F, {axisNch}); - histos.add("h2_DcaXY", "DCA_{XY}", kTH2D, {{axisPt}, {axisdcaXY}}); - histos.add("hEventCounter", "Number of events vs centrality", kTH1F, {axisCent}); - - //---------- Data TProfiles----------------------------------- - histos.add("p_a", " vs centrality", kTProfile, {axisCent}); - histos.add("p_b", " vs centrality", kTProfile, {axisCent}); - histos.add("p_a2", " vs centrality", kTProfile, {axisCent}); - histos.add("p_b2", " vs centrality", kTProfile, {axisCent}); - histos.add("p_ab", " vs centrality", kTProfile, {axisCent}); - histos.add("p_asumb", " vs centrality", kTProfile, {axisCent}); - - // For varying binning - histos.add("Data/p_a_custom", " vs custom centrality", kTProfile, {centBining}); - histos.add("Data/p_b_custom", " vs custom centrality", kTProfile, {centBining}); - histos.add("Data/p_a2_custom", " vs custom centrality", kTProfile, {centBining}); - histos.add("Data/p_b2_custom", " vs custom centrality", kTProfile, {centBining}); - histos.add("Data/p_ab_custom", " vs custom centrality", kTProfile, {centBining}); - histos.add("Data/p_asumb_custom", " vs custom centrality", kTProfile, {centBining}); - - //------- subsample TProfile - histos.add("Data/subsample/p_a", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); - histos.add("Data/subsample/p_b", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); - histos.add("Data/subsample/p_a2", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); - histos.add("Data/subsample/p_b2", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); - histos.add("Data/subsample/p_ab", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); - histos.add("Data/subsample/p_asumb", " vs cent & subsample", kTProfile2D, {axisCent, subsampleAxis}); - - //---------- subsample custom TProfile - histos.add("Data/subsample/p_a_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - histos.add("Data/subsample/p_b_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - histos.add("Data/subsample/p_a2_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - histos.add("Data/subsample/p_b2_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - histos.add("Data/subsample/p_ab_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - histos.add("Data/subsample/p_asumb_custom", " vs cent & subsample custom", kTProfile2D, {centBining, subsampleAxis}); - } - //---------- Filters - Filter ptFilter = (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut); - Filter etaFilter = nabs(aod::track::eta) < etaCut; - Filter posZFilter = nabs(aod::collision::posZ) < vtxZcut; + // ------------------------------------------------ + // Multiplicity QA and correlation plots + // ------------------------------------------------ + + histos.add("QA/hCentFT0C", "Centrality", kTH1F, {centAxis}); + histos.add("QA/hNchGlobal", "Global track multiplicity", kTH1F, {axisNch}); + histos.add("QA/hNchPV", "PV track multiplicity", kTH1F, {axisNch}); + + histos.add("MultCorrelationPlots/globalTracks_PV_bef", "PV tracks (x) vs global tracks (y) before rejection", kTH2D, {axisNch, axisNch}); + histos.add("MultCorrelationPlots/globalTracks_FT0C_bef", "FT0C centrality (x) vs global tracks (y) before rejection", kTH2D, {centAxis, axisNch}); + histos.add("MultCorrelationPlots/PV_FT0C_bef", "FT0C centrality (x) vs PV tracks (y) before rejection", kTH2D, {centAxis, axisNch}); + + histos.add("MultCorrelationPlots/globalTracks_PV_aft", "PV tracks (x) vs global tracks (y) after rejection", kTH2D, {axisNch, axisNch}); + histos.add("MultCorrelationPlots/globalTracks_FT0C_aft", "FT0C centrality (x) vs global tracks (y) after rejection", kTH2D, {centAxis, axisNch}); + histos.add("MultCorrelationPlots/PV_FT0C_aft", "FT0C centrality (x) vs PV tracks (y) after rejection", kTH2D, {centAxis, axisNch}); + + // ------------------------------------------------ + // DATA profiles + // ------------------------------------------------ + + histos.add("Data/p_a", " vs centrality", kTProfile, {axisCent}); + histos.add("Data/p_b", " vs centrality", kTProfile, {axisCent}); + histos.add("Data/p_a2", " vs centrality", kTProfile, {axisCent}); + histos.add("Data/p_b2", " vs centrality", kTProfile, {axisCent}); + histos.add("Data/p_ab", " vs centrality", kTProfile, {axisCent}); + histos.add("Data/p_asumb", " vs centrality", kTProfile, {axisCent}); + + histos.add("Data/p_a_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("Data/p_b_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("Data/p_a2_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("Data/p_b2_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("Data/p_ab_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("Data/p_asumb_custom", " vs custom centrality", kTProfile, {cent1Axis}); + + // DATA standard subsample profiles + histos.add("Data/subsample/p_a", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_b", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_a2", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_b2", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_ab", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("Data/subsample/p_asumb", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + + // DATA custom subsample profiles + histos.add("Data/subsample/p_a_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("Data/subsample/p_b_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("Data/subsample/p_a2_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("Data/subsample/p_b2_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("Data/subsample/p_ab_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("Data/subsample/p_asumb_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + + // ------------------------------------------------ + // MC RECONSTRUCTED profiles + // ------------------------------------------------ + + histos.add("MCRec/p_a", " vs centrality", kTProfile, {axisCent}); + histos.add("MCRec/p_b", " vs centrality", kTProfile, {axisCent}); + histos.add("MCRec/p_a2", " vs centrality", kTProfile, {axisCent}); + histos.add("MCRec/p_b2", " vs centrality", kTProfile, {axisCent}); + histos.add("MCRec/p_ab", " vs centrality", kTProfile, {axisCent}); + histos.add("MCRec/p_asumb", " vs centrality", kTProfile, {axisCent}); + + histos.add("MCRec/p_a_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCRec/p_b_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCRec/p_a2_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCRec/p_b2_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCRec/p_ab_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCRec/p_asumb_custom", " vs custom centrality", kTProfile, {cent1Axis}); + + // MC reconstructed inclusive pT moments + histos.add("MCRec/pT_inclusive", " vs centrality", kTProfile, {axisCent}); + histos.add("MCRec/pT2_inclusive", " vs centrality", kTProfile, {axisCent}); + + // MC reconstructed standard subsample profiles + histos.add("MCRec/subsample/p_a", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCRec/subsample/p_b", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCRec/subsample/p_a2", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCRec/subsample/p_b2", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCRec/subsample/p_ab", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCRec/subsample/p_asumb", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + + // MC reconstructed custom subsample profiles + histos.add("MCRec/subsample/p_a_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCRec/subsample/p_b_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCRec/subsample/p_a2_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCRec/subsample/p_b2_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCRec/subsample/p_ab_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCRec/subsample/p_asumb_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + + // ------------------------------------------------ + // MC GENERATED profiles + // ------------------------------------------------ + + histos.add("MCGen/p_a", " vs centrality", kTProfile, {axisCent}); + histos.add("MCGen/p_b", " vs centrality", kTProfile, {axisCent}); + histos.add("MCGen/p_a2", " vs centrality", kTProfile, {axisCent}); + histos.add("MCGen/p_b2", " vs centrality", kTProfile, {axisCent}); + histos.add("MCGen/p_ab", " vs centrality", kTProfile, {axisCent}); + histos.add("MCGen/p_asumb", " vs centrality", kTProfile, {axisCent}); + + histos.add("MCGen/p_a_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCGen/p_b_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCGen/p_a2_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCGen/p_b2_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCGen/p_ab_custom", " vs custom centrality", kTProfile, {cent1Axis}); + histos.add("MCGen/p_asumb_custom", " vs custom centrality", kTProfile, {cent1Axis}); + + // MC generated inclusive pT moments + histos.add("MCGen/pT_inclusive", " vs centrality", kTProfile, {axisCent}); + histos.add("MCGen/pT2_inclusive", " vs centrality", kTProfile, {axisCent}); + + // MC generated standard subsample profiles + histos.add("MCGen/subsample/p_a", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCGen/subsample/p_b", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCGen/subsample/p_a2", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCGen/subsample/p_b2", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCGen/subsample/p_ab", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + histos.add("MCGen/subsample/p_asumb", " vs centrality and subsample", kTProfile2D, {axisCent, subsampleAxis}); + + // MC generated custom subsample profiles + histos.add("MCGen/subsample/p_a_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCGen/subsample/p_b_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCGen/subsample/p_a2_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCGen/subsample/p_b2_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCGen/subsample/p_ab_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + histos.add("MCGen/subsample/p_asumb_custom", " vs custom centrality and subsample", kTProfile2D, {cent1Axis, subsampleAxis}); + + // MC reconstructed QA: vertex and track kinematics + histos.add("MCRec/QA/Before/VtxZ", "Reconstructed MC vertex Z before event selection", kTH1F, {vtxzAxis}); + histos.add("MCRec/QA/After/VtxZ", "Reconstructed MC vertex Z after event selection", kTH1F, {vtxzAxis}); + histos.add("MCRec/QA/Before/Pt", "Reconstructed track pT before manual track selection", kTH1F, {ptAxis}); + histos.add("MCRec/QA/Before/Eta", "Reconstructed track eta before manual track selection", kTH1F, {etaAxis}); + histos.add("MCRec/QA/Before/PtEta", "Reconstructed track pT vs eta before manual track selection", kTH2D, {ptAxis, etaAxis}); + histos.add("MCRec/QA/After/Pt", "Reconstructed track pT after manual track selection", kTH1F, {ptAxis}); + histos.add("MCRec/QA/After/Eta", "Reconstructed track eta after manual track selection", kTH1F, {etaAxis}); + histos.add("MCRec/QA/After/PtEta", "Reconstructed track pT vs eta after manual track selection", kTH2D, {ptAxis, etaAxis}); + histos.add("MCRec/QA/Centrality", "Reconstructed MC centrality", kTH1F, {centAxis}); + histos.add("MCRec/QA/GlobalNch", "Reconstructed MC global-track multiplicity", kTH1F, {axisNch}); + histos.add("MCRec/QA/PVNch", "Reconstructed MC PV-track multiplicity", kTH1F, {axisNch}); + + // MC reconstructed multiplicity correlations + histos.add("MCRec/MultCorrelationPlots/globalTracks_PV_bef", "PV tracks (x) vs global tracks (y) before rejection", kTH2D, {axisNch, axisNch}); + histos.add("MCRec/MultCorrelationPlots/globalTracks_FT0C_bef", "FT0C centrality (x) vs global tracks (y) before rejection", kTH2D, {centAxis, axisNch}); + histos.add("MCRec/MultCorrelationPlots/PV_FT0C_bef", "FT0C centrality (x) vs PV tracks (y) before rejection", kTH2D, {centAxis, axisNch}); + histos.add("MCRec/MultCorrelationPlots/globalTracks_PV_aft", "PV tracks (x) vs global tracks (y) after rejection", kTH2D, {axisNch, axisNch}); + histos.add("MCRec/MultCorrelationPlots/globalTracks_FT0C_aft", "FT0C centrality (x) vs global tracks (y) after rejection", kTH2D, {centAxis, axisNch}); + histos.add("MCRec/MultCorrelationPlots/PV_FT0C_aft", "FT0C centrality (x) vs PV tracks (y) after rejection", kTH2D, {centAxis, axisNch}); + + // MC generated QA: collision vertex and particle kinematics + histos.add("MCGen/QA/Before/VtxZ", "Generated MC vertex Z before vertex selection", kTH1F, {vtxzAxis}); + histos.add("MCGen/QA/After/VtxZ", "Generated MC vertex Z after vertex selection", kTH1F, {vtxzAxis}); + histos.add("MCGen/QA/Before/Pt", "Generated-particle pT before particle selection", kTH1F, {ptAxis}); + histos.add("MCGen/QA/Before/Eta", "Generated-particle eta before particle selection", kTH1F, {etaAxis}); + histos.add("MCGen/QA/Before/PtEta", "Generated-particle pT vs eta before particle selection", kTH2D, {ptAxis, etaAxis}); + histos.add("MCGen/QA/After/Pt", "Generated-particle pT after particle selection", kTH1F, {ptAxis}); + histos.add("MCGen/QA/After/Eta", "Generated-particle eta after particle selection", kTH1F, {etaAxis}); + histos.add("MCGen/QA/After/PtEta", "Generated-particle pT vs eta after particle selection", kTH2D, {ptAxis, etaAxis}); + histos.add("MCGen/QA/GeneratedNch", "Generated charged-particle multiplicity", kTH1F, {axisNch}); + histos.add("MCGen/QA/Centrality", "Reconstructed centrality for generated MC sample", kTH1F, {centAxis}); + histos.add("MCGen/QA/GlobalNch", "Reconstructed global-track multiplicity for generated MC sample", kTH1F, {axisNch}); + histos.add("MCGen/QA/PVNch", "Reconstructed PV-track multiplicity for generated MC sample", kTH1F, {axisNch}); + + // ------------------------------------------------ + // Initialize multiplicity-correlation functions + // ------------------------------------------------ + + const float nSigma = cfgFunCoeff.cfgMultCutNSigma; - using MyColsData = soa::Join; - using MyTracksData = soa::Join; - using MyFilteredTracksData = soa::Filtered; + cfgFunCoeff.multPVT0CCutPars = cfgFunCoeff.cfgMultPVT0CCutPars; + cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; + cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; - void process(MyColsData::iterator const& col, MyFilteredTracksData const& tracks) + cfgFunCoeff.fMultPVT0CCutLow = new TF1( + "fMultPVT0CCutLow", + Form("[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x-%f*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", nSigma), + 0., 100.); + cfgFunCoeff.fMultPVT0CCutLow->SetParameters(cfgFunCoeff.multPVT0CCutPars.data()); + + cfgFunCoeff.fMultPVT0CCutHigh = new TF1( + "fMultPVT0CCutHigh", + Form("[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+%f*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", nSigma), + 0., 100.); + cfgFunCoeff.fMultPVT0CCutHigh->SetParameters(cfgFunCoeff.multPVT0CCutPars.data()); + + cfgFunCoeff.fMultGlobalFT0CCutLow = new TF1( + "fMultGlobalFT0CCutLow", + Form("[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x-%f*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", nSigma), + 0., 100.); + cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(cfgFunCoeff.multGlobalFT0CPars.data()); + + cfgFunCoeff.fMultGlobalFT0CCutHigh = new TF1( + "fMultGlobalFT0CCutHigh", + Form("[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+%f*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", nSigma), + 0., 100.); + cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(cfgFunCoeff.multGlobalFT0CPars.data()); + + cfgFunCoeff.fMultGlobalPVCutLow = new TF1( + "fMultGlobalPVCutLow", + Form("[0]+[1]*x-%f*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", nSigma), + 0., 100000.); + cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(cfgFunCoeff.multGlobalPVCutPars.data()); + + cfgFunCoeff.fMultGlobalPVCutHigh = new TF1( + "fMultGlobalPVCutHigh", + Form("[0]+[1]*x+%f*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", nSigma), + 0., 100000.); + cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(cfgFunCoeff.multGlobalPVCutPars.data()); + } + + // -------------------------------------------------- + // Event selection + // -------------------------------------------------- + + template + bool selCollision(C const& coll, float& cent) { - histos.fill(HIST("QA/BeforeCut/VtxZ"), col.posZ()); - float cent = -1.0f; + cent = -1.f; + if (cFT0M) { - cent = col.centFT0M(); + cent = coll.centFT0M(); + } else if (cFT0C) { + cent = coll.centFT0C(); + } else { + return false; } - if (cFT0C) { - cent = col.centFT0C(); - // if (!track.isGlobalTrack()) continue; + + if (cent < CentMin || cent >= CentMax) { + return false; } - if (cent < 0) { - return; + + if (std::abs(coll.posZ()) >= vertexZcut) { + return false; } - histos.fill(HIST("QA/BeforeCut/Cent"), cent); - if (!col.sel8()) { - return; + if (cSel8Trig && !coll.sel8()) { + return false; } - if (std::abs(col.posZ()) > vtxZcut) { - return; + + if (cNoItsROBorder && + !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; } - if (cfgNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; + + if (cTFBorder && + !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return false; } - if (cfgEvSelUseGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; + + if (cPileupReject && + !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; } - if (cfgUseGoodITSLayerAllCut && !col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { - return; + + if (cZVtxTimeDiff && + !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; } - histos.fill(HIST("hEventCounter"), cent); - histos.fill(HIST("QA/AfterCut/VtxZ"), col.posZ()); - histos.fill(HIST("QA/AfterCut/Cent"), cent); + if (cItsTpcVtx && + !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + return false; + } - double a = 0.0; - double b = 0.0; + if (cfgUseGoodItsLayerAllCut && + !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { + return false; + } - // if (!track.isGlobalTrack()) continue; - for (const auto& track : tracks) { + return true; + } - histos.fill(HIST("QA/BeforeCut/Eta"), track.eta()); - histos.fill(HIST("QA/BeforeCut/Pt"), track.pt()); - histos.fill(HIST("QA/BeforeCut/Phi"), track.phi()); - histos.fill(HIST("QA/BeforeCut/DcaXY"), track.dcaXY()); - histos.fill(HIST("QA/BeforeCut/DcaZ"), track.dcaZ()); + // -------------------------------------------------- + // Track selection + // -------------------------------------------------- - // Track quality cuts + template + bool selTrack(T const& track) + { + if (!track.isGlobalTrack()) { + return false; + } - if (requireITS && !track.hasITS()) { - continue; + if (cPVcont && !track.isPVContributor()) { + return false; + } + + if (std::abs(track.eta()) >= etaCut) { + return false; + } + + if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) { + return false; + } + + if (cDcaXy && std::abs(track.dcaXY()) >= dcaXYCut) { + return false; + } + + if (cDcaZ && std::abs(track.dcaZ()) >= dcaZCut) { + return false; + } + + if (cTpcCr && track.tpcNClsCrossedRows() <= tpcCrossCut) { + return false; + } + + if (cItsChi && track.itsChi2NCl() >= itsChiCut) { + return false; + } + + if (cTpcChi && track.tpcChi2NCl() >= tpcChiCut) { + return false; + } + + return true; + } + + // -------------------------------------------------- + // Before-selection track QA + // -------------------------------------------------- + + template + void fillBeforeQA(T const& track) + { + histos.fill(HIST("QA/Before/TPCchi2perCluster"), track.tpcChi2NCl()); + histos.fill(HIST("QA/Before/ITSchi2perCluster"), track.itsChi2NCl()); + histos.fill(HIST("QA/Before/TPCCrossedrows"), track.tpcNClsCrossedRows()); + histos.fill(HIST("QA/Before/DcaXY"), track.dcaXY()); + histos.fill(HIST("QA/Before/DcaZ"), track.dcaZ()); + histos.fill(HIST("QA/Before/PtDcaXY_before"), track.pt(), track.dcaXY()); + histos.fill(HIST("QA/Before/PtDcaZ_before"), track.pt(), track.dcaZ()); + } + + // -------------------------------------------------- + // After-selection track QA + // -------------------------------------------------- + + template + void fillAfterQA(T const& track, float cent) + { + histos.fill(HIST("QA/phi"), track.phi()); + + histos.fill(HIST("QA/After/DcaXY"), track.dcaXY()); + histos.fill(HIST("QA/After/DcaZ"), track.dcaZ()); + histos.fill(HIST("QA/After/TPCchi2perCluster"), track.tpcChi2NCl()); + histos.fill(HIST("QA/After/ITSchi2perCluster"), track.itsChi2NCl()); + histos.fill(HIST("QA/After/TPCCrossedrows"), track.tpcNClsCrossedRows()); + + histos.fill(HIST("QA/After/PtDcaXY"), track.pt(), track.dcaXY()); + histos.fill(HIST("QA/After/PtDcaZ"), track.pt(), track.dcaZ()); + + histos.fill(HIST("QA/After/Pt"), track.pt()); + histos.fill(HIST("QA/After/Eta"), track.eta()); + histos.fill(HIST("QA/After/Pt_eta"), track.pt(), track.eta()); + histos.fill(HIST("QA/After/cent_hPt"), cent, track.pt()); + histos.fill(HIST("QA/After/cent_hEta"), cent, track.eta()); + } + + // -------------------------------------------------- + // Multiplicity-correlation event selection + // -------------------------------------------------- + + bool eventSelected(float globalNch, float pvTrack, float centrality) + { + if (cfgFunCoeff.cfgMultPVT0CCutEnabled) { + if (pvTrack < cfgFunCoeff.fMultPVT0CCutLow->Eval(centrality) || + pvTrack > cfgFunCoeff.fMultPVT0CCutHigh->Eval(centrality)) { + return false; } - if (requireTPC && !track.hasTPC()) { - continue; + } + + if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { + if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality) || + globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) { + return false; } - if (track.itsNCls() < itsNClsCut) { - continue; + } + + if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { + if (globalNch < cfgFunCoeff.fMultGlobalPVCutLow->Eval(pvTrack) || + globalNch > cfgFunCoeff.fMultGlobalPVCutHigh->Eval(pvTrack)) { + return false; } - if (track.tpcNClsCrossedRows() < tpcCrossCut) { + } + + return true; + } + + // -------------------------------------------------- + // Fill event-wise moments and profiles + // -------------------------------------------------- + + void fillHistograms(float nch, float cent, float sumPt, int subsample) + { + const float nch2 = nch * nch; + const float sumPt2 = sumPt * sumPt; + const float nchSumPt = nch * sumPt; + const float nchPlusSumPt = nch + sumPt; + + // Event-wise Nch distributions + histos.fill(HIST("Nch/hNch"), nch); + + if (cent < Cent10) { + histos.fill(HIST("Nch/hNch_0_10"), nch); + } else if (cent < Cent10 * 2) { + histos.fill(HIST("Nch/hNch_10_20"), nch); + } else if (cent < Cent10 * 3) { + histos.fill(HIST("Nch/hNch_20_30"), nch); + } else if (cent < Cent10 * 4) { + histos.fill(HIST("Nch/hNch_30_40"), nch); + } else if (cent < Cent10 * 5) { + histos.fill(HIST("Nch/hNch_40_50"), nch); + } else if (cent < Cent10 * 6) { + histos.fill(HIST("Nch/hNch_50_60"), nch); + } else if (cent < Cent10 * 7) { + histos.fill(HIST("Nch/hNch_60_70"), nch); + } else if (cent < Cent10 * 8) { + histos.fill(HIST("Nch/hNch_70_80"), nch); + } else if (cent < Cent10 * 9) { + histos.fill(HIST("Nch/hNch_80_90"), nch); + } else if (cent < Cent10 * 10) { + histos.fill(HIST("Nch/hNch_90_100"), nch); + } + + // Standard centrality profiles + histos.fill(HIST("Data/p_a"), cent, nch); + histos.fill(HIST("Data/p_b"), cent, sumPt); + histos.fill(HIST("Data/p_a2"), cent, nch2); + histos.fill(HIST("Data/p_b2"), cent, sumPt2); + histos.fill(HIST("Data/p_ab"), cent, nchSumPt); + histos.fill(HIST("Data/p_asumb"), cent, nchPlusSumPt); + + // Custom centrality profiles + histos.fill(HIST("Data/p_a_custom"), cent, nch); + histos.fill(HIST("Data/p_b_custom"), cent, sumPt); + histos.fill(HIST("Data/p_a2_custom"), cent, nch2); + histos.fill(HIST("Data/p_b2_custom"), cent, sumPt2); + histos.fill(HIST("Data/p_ab_custom"), cent, nchSumPt); + histos.fill(HIST("Data/p_asumb_custom"), cent, nchPlusSumPt); + + // Standard centrality subsample profiles + histos.fill(HIST("Data/subsample/p_a"), cent, subsample, nch); + histos.fill(HIST("Data/subsample/p_b"), cent, subsample, sumPt); + histos.fill(HIST("Data/subsample/p_a2"), cent, subsample, nch2); + histos.fill(HIST("Data/subsample/p_b2"), cent, subsample, sumPt2); + histos.fill(HIST("Data/subsample/p_ab"), cent, subsample, nchSumPt); + histos.fill(HIST("Data/subsample/p_asumb"), cent, subsample, nchPlusSumPt); + + // Custom centrality subsample profiles + histos.fill(HIST("Data/subsample/p_a_custom"), cent, subsample, nch); + histos.fill(HIST("Data/subsample/p_b_custom"), cent, subsample, sumPt); + histos.fill(HIST("Data/subsample/p_a2_custom"), cent, subsample, nch2); + histos.fill(HIST("Data/subsample/p_b2_custom"), cent, subsample, sumPt2); + histos.fill(HIST("Data/subsample/p_ab_custom"), cent, subsample, nchSumPt); + histos.fill(HIST("Data/subsample/p_asumb_custom"), cent, subsample, nchPlusSumPt); + } + + // -------------------------------------------------- + // DATA calculation + // -------------------------------------------------- + + template + void calculationData(C const& coll, T const& inputTracks) + { + float cent = -1.f; + + // QA before event selection + histos.fill(HIST("QA/Before/VtxZ"), coll.posZ()); + + if (!selCollision(coll, cent)) { + return; + } + + const float pvTrack = coll.multNTracksPV(); + + // Count collision-associated tracks in the filtered track table. + float globalNch = 0.f; + for (const auto& track : inputTracks) { + if (track.collisionId() != coll.globalIndex()) { continue; } - if (track.tpcCrossedRowsOverFindableCls() < crossedRowsOverFindableCut) { + globalNch += 1.f; + } + + // Multiplicity QA before correlation rejection + histos.fill(HIST("QA/hCentFT0C"), cent); + histos.fill(HIST("QA/hNchGlobal"), globalNch); + histos.fill(HIST("QA/hNchPV"), pvTrack); + + histos.fill(HIST("MultCorrelationPlots/globalTracks_PV_bef"), pvTrack, globalNch); + histos.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_bef"), cent, globalNch); + histos.fill(HIST("MultCorrelationPlots/PV_FT0C_bef"), cent, pvTrack); + + // Multiplicity-correlation rejection + if (cfgEvSelMultCorrelation && + !eventSelected(globalNch, pvTrack, cent)) { + return; + } + + // Multiplicity QA after correlation rejection + histos.fill(HIST("MultCorrelationPlots/globalTracks_PV_aft"), pvTrack, globalNch); + histos.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_aft"), cent, globalNch); + histos.fill(HIST("MultCorrelationPlots/PV_FT0C_aft"), cent, pvTrack); + + histos.fill(HIST("QA/After/VtxZ"), coll.posZ()); + histos.fill(HIST("QA/After/Centrality"), cent); + histos.fill(HIST("QA/After/Multiplicity"), globalNch); + + // Event-wise analysis quantities + float nch = 0.f; + float sumPt = 0.f; + + for (const auto& track : inputTracks) { + if (track.collisionId() != coll.globalIndex()) { continue; } - if (std::abs(track.dcaZ()) > dcaZCut) { + + fillBeforeQA(track); + if (!selTrack(track)) { continue; } - if (std::abs(track.dcaXY()) > dcaXYCut) { - continue; + + fillAfterQA(track, cent); + + // A = Nch + nch += 1.f; + + // B = sum of pT + sumPt += track.pt(); + } + + // subsample assignment + const int nSub = std::max(1, static_cast(cfgNSubsample)); + const int subsample = static_cast(coll.globalIndex() % nSub); + + // Fill all event-wise moments + fillHistograms(nch, cent, sumPt, subsample); + } + + // -------------------------------------------------- + // DATA process + // -------------------------------------------------- + + void processData(MyCollision const& coll, MyTracks const& tracks) + { + calculationData(coll, tracks); + } + + PROCESS_SWITCH(MultAndPtFluctuations, processData, "Process for DATA", true); + + // -------------------------------------------------- + // MC processing: RECONSTRUCTED + GENERATED + // -------------------------------------------------- + + SliceCache cache; + Preslice perMcCollision = aod::mcparticle::mcCollisionId; + void processMC(MyMCCollision const& coll, MyMCTracks const& tracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + { + (void)mcCollisions; + + // MC RECONSTRUCTED + [&]() { + float cent = -1.f; + // Vertex QA before event selection. + histos.fill(HIST("MCRec/QA/Before/VtxZ"), coll.posZ()); + + if (!selCollision(coll, cent)) { + return; + } + + const float pvTrack = coll.multNTracksPV(); + + float globalNch = 0.f; + + for (const auto& track : tracks) { + if (track.collisionId() != coll.globalIndex()) { + continue; + } + + globalNch += 1.f; + } + // QA and correlations before multiplicity-correlation rejection. + histos.fill(HIST("MCRec/QA/Centrality"), cent); + histos.fill(HIST("MCRec/QA/GlobalNch"), globalNch); + histos.fill(HIST("MCRec/QA/PVNch"), pvTrack); + + histos.fill(HIST("MCRec/MultCorrelationPlots/globalTracks_PV_bef"), pvTrack, globalNch); + histos.fill(HIST("MCRec/MultCorrelationPlots/globalTracks_FT0C_bef"), cent, globalNch); + histos.fill(HIST("MCRec/MultCorrelationPlots/PV_FT0C_bef"), cent, pvTrack); + + // Apply multiplicity-correlation rejection. + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; } - if (track.tpcChi2NCl() > tpcChiCut) { + + // QA and correlations after event selection. + histos.fill(HIST("MCRec/QA/After/VtxZ"), coll.posZ()); + histos.fill(HIST("MCRec/MultCorrelationPlots/globalTracks_PV_aft"), pvTrack, globalNch); + histos.fill(HIST("MCRec/MultCorrelationPlots/globalTracks_FT0C_aft"), cent, globalNch); + histos.fill(HIST("MCRec/MultCorrelationPlots/PV_FT0C_aft"), cent, pvTrack); + + // Reconstructed event-wise quantities. + float nch = 0.f; + float sumPt = 0.f; + + for (const auto& track : tracks) { + if (track.collisionId() != coll.globalIndex()) { + continue; + } + + // Track QA before additional manual track cuts. + histos.fill(HIST("MCRec/QA/Before/Pt"), track.pt()); + histos.fill(HIST("MCRec/QA/Before/Eta"), track.eta()); + histos.fill(HIST("MCRec/QA/Before/PtEta"), track.pt(), track.eta()); + + if (!selTrack(track)) { + continue; + } + // Inclusive pT moments for reconstructed MC + histos.fill(HIST("MCRec/pT_inclusive"), cent, track.pt()); + histos.fill(HIST("MCRec/pT2_inclusive"), cent, track.pt() * track.pt()); + // Track QA after manual selection. + histos.fill(HIST("MCRec/QA/After/Pt"), track.pt()); + histos.fill(HIST("MCRec/QA/After/Eta"), track.eta()); + histos.fill(HIST("MCRec/QA/After/PtEta"), track.pt(), track.eta()); + + nch += 1.f; + sumPt += track.pt(); + } + const float nch2 = nch * nch; + const float sumPt2 = sumPt * sumPt; + const float nchSumPt = nch * sumPt; + const float nchPlusSumPt = nch + sumPt; + + const int nSub = std::max(1, static_cast(cfgNSubsample)); + const int subsample = static_cast(coll.globalIndex() % nSub); + + // Standard centrality profiles. + histos.fill(HIST("MCRec/p_a"), cent, nch); + histos.fill(HIST("MCRec/p_b"), cent, sumPt); + histos.fill(HIST("MCRec/p_a2"), cent, nch2); + histos.fill(HIST("MCRec/p_b2"), cent, sumPt2); + histos.fill(HIST("MCRec/p_ab"), cent, nchSumPt); + histos.fill(HIST("MCRec/p_asumb"), cent, nchPlusSumPt); + + // Custom centrality profiles. + histos.fill(HIST("MCRec/p_a_custom"), cent, nch); + histos.fill(HIST("MCRec/p_b_custom"), cent, sumPt); + histos.fill(HIST("MCRec/p_a2_custom"), cent, nch2); + histos.fill(HIST("MCRec/p_b2_custom"), cent, sumPt2); + histos.fill(HIST("MCRec/p_ab_custom"), cent, nchSumPt); + histos.fill(HIST("MCRec/p_asumb_custom"), cent, nchPlusSumPt); + + // Standard centrality subsample profiles. + histos.fill(HIST("MCRec/subsample/p_a"), cent, subsample, nch); + histos.fill(HIST("MCRec/subsample/p_b"), cent, subsample, sumPt); + histos.fill(HIST("MCRec/subsample/p_a2"), cent, subsample, nch2); + histos.fill(HIST("MCRec/subsample/p_b2"), cent, subsample, sumPt2); + histos.fill(HIST("MCRec/subsample/p_ab"), cent, subsample, nchSumPt); + histos.fill(HIST("MCRec/subsample/p_asumb"), cent, subsample, nchPlusSumPt); + + // Custom centrality subsample profiles. + histos.fill(HIST("MCRec/subsample/p_a_custom"), cent, subsample, nch); + histos.fill(HIST("MCRec/subsample/p_b_custom"), cent, subsample, sumPt); + histos.fill(HIST("MCRec/subsample/p_a2_custom"), cent, subsample, nch2); + histos.fill(HIST("MCRec/subsample/p_b2_custom"), cent, subsample, sumPt2); + histos.fill(HIST("MCRec/subsample/p_ab_custom"), cent, subsample, nchSumPt); + histos.fill(HIST("MCRec/subsample/p_asumb_custom"), cent, subsample, nchPlusSumPt); + }(); // mc reconstructed calculation + + //------------ MC GENERATED + + if (!coll.has_mcCollision()) { + return; + } + + const auto mcCollision = coll.mcCollision(); + + // Generated-collision vertex QA before and after vertex cut. + histos.fill(HIST("MCGen/QA/Before/VtxZ"), mcCollision.posZ()); + + if (std::abs(mcCollision.posZ()) >= vertexZcut) { + return; + } + + histos.fill(HIST("MCGen/QA/After/VtxZ"), mcCollision.posZ()); + + // Slice generated particles belonging to this MC collision. + const auto& generatedParticles = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + + float nch = 0.f; + float sumPt = 0.f; + + // Use centrality from the matched reconstructed collision. + float cent = -1.f; + + if (!selCollision(coll, cent)) { + return; + } + + const float pvTrack = coll.multNTracksPV(); + + for (const auto& particle : generatedParticles) { + // Before-selection QA. + histos.fill(HIST("MCGen/QA/Before/Pt"), particle.pt()); + histos.fill(HIST("MCGen/QA/Before/Eta"), particle.eta()); + histos.fill(HIST("MCGen/QA/Before/PtEta"), particle.pt(), particle.eta()); + + if (!particle.isPhysicalPrimary()) { continue; } - if (track.itsChi2NCl() > itsChiCut) { + + auto* pdgParticle = pdgService->GetParticle(particle.pdgCode()); + + if (pdgParticle == nullptr || std::abs(pdgParticle->Charge()) < ChargeTolerance) { continue; } - if (std::abs(track.eta()) > etaCut) { + + if (std::abs(particle.eta()) >= etaCut) { continue; } - if (requireInnerITS) { - auto itsMap = track.itsClusterMap(); - if (((itsMap & (1 << 0)) == 0) && - ((itsMap & (1 << 1)) == 0) && - ((itsMap & (1 << 2)) == 0)) { - continue; - } + + if (particle.pt() <= ptMinCut || particle.pt() >= ptMaxCut) { + continue; } - // After cuts QA - histos.fill(HIST("QA/AfterCut/Eta"), track.eta()); - histos.fill(HIST("QA/AfterCut/Pt"), track.pt()); - histos.fill(HIST("QA/AfterCut/Phi"), track.phi()); - histos.fill(HIST("QA/AfterCut/DcaXY"), track.dcaXY()); - histos.fill(HIST("QA/AfterCut/DcaZ"), track.dcaZ()); - histos.fill(HIST("h2_DcaZ"), track.pt(), track.dcaZ()); - histos.fill(HIST("h2_DcaXY"), track.pt(), track.dcaXY()); - a++; // A-nch, B =pt - b += track.pt(); + // After-selection QA. + histos.fill(HIST("MCGen/QA/After/Pt"), particle.pt()); + histos.fill(HIST("MCGen/QA/After/Eta"), particle.eta()); + histos.fill(HIST("MCGen/QA/After/PtEta"), particle.pt(), particle.eta()); + + // Inclusive pT distributions. + histos.fill(HIST("MCGen/pT_inclusive"), cent, particle.pt()); + histos.fill(HIST("MCGen/pT2_inclusive"), cent, particle.pt() * particle.pt()); + + nch += 1.f; + sumPt += particle.pt(); } - static constexpr float Cent10 = 10.f; - histos.fill(HIST("Nch/hNch"), a); + histos.fill(HIST("MCGen/QA/GeneratedNch"), nch); - if (cent < Cent10) { - histos.fill(HIST("Nch/hNch_0_10"), a); - } else if (cent < Cent10 * 2) { - histos.fill(HIST("Nch/hNch_10_20"), a); - } else if (cent < Cent10 * 3) { - histos.fill(HIST("Nch/hNch_20_30"), a); - } else if (cent < Cent10 * 4) { - histos.fill(HIST("Nch/hNch_30_40"), a); - } else if (cent < Cent10 * 5) { - histos.fill(HIST("Nch/hNch_40_50"), a); - } else if (cent < Cent10 * 6) { - histos.fill(HIST("Nch/hNch_50_60"), a); - } else if (cent < Cent10 * 7) { - histos.fill(HIST("Nch/hNch_60_70"), a); - } else if (cent < Cent10 * 8) { - histos.fill(HIST("Nch/hNch_70_80"), a); - } else if (cent < Cent10 * 9) { - histos.fill(HIST("Nch/hNch_80_90"), a); - } else if (cent < Cent10 * 10) { - histos.fill(HIST("Nch/hNch_90_100"), a); - } - // ---- Fill TProfiles (once per event) - histos.fill(HIST("p_a"), cent, a); - histos.fill(HIST("p_b"), cent, b); - histos.fill(HIST("p_a2"), cent, a * a); - histos.fill(HIST("p_b2"), cent, b * b); - histos.fill(HIST("p_ab"), cent, a * b); - histos.fill(HIST("p_asumb"), cent, a + b); - - histos.fill(HIST("Data/p_a_custom"), cent, a); - histos.fill(HIST("Data/p_b_custom"), cent, b); - histos.fill(HIST("Data/p_a2_custom"), cent, a * a); - histos.fill(HIST("Data/p_b2_custom"), cent, b * b); - histos.fill(HIST("Data/p_ab_custom"), cent, a * b); - histos.fill(HIST("Data/p_asumb_custom"), cent, a + b); + // Reconstructed multiplicity for the matched collision. + float globalNch = 0.f; + + for (const auto& track : tracks) { + if (track.collisionId() != coll.globalIndex()) { + continue; + } + globalNch += 1.f; + } + // Correlation QA before multiplicity-correlation rejection. + histos.fill(HIST("MCGen/QA/Centrality"), cent); + histos.fill(HIST("MCGen/QA/GlobalNch"), globalNch); + histos.fill(HIST("MCGen/QA/PVNch"), pvTrack); + + // Generated event-wise quantities. + const float nch2 = nch * nch; + const float sumPt2 = sumPt * sumPt; + const float nchSumPt = nch * sumPt; + const float nchPlusSumPt = nch + sumPt; const int nSub = std::max(1, static_cast(cfgNSubsample)); - const int subsample = static_cast(col.globalIndex() % static_cast(nSub)); - - histos.fill(HIST("Data/subsample/p_a"), cent, subsample, a); - histos.fill(HIST("Data/subsample/p_b"), cent, subsample, b); - histos.fill(HIST("Data/subsample/p_a2"), cent, subsample, a * a); - histos.fill(HIST("Data/subsample/p_b2"), cent, subsample, b * b); - histos.fill(HIST("Data/subsample/p_ab"), cent, subsample, a * b); - histos.fill(HIST("Data/subsample/p_asumb"), cent, subsample, a + b); - histos.fill(HIST("Data/subsample/p_a_custom"), cent, subsample, a); - histos.fill(HIST("Data/subsample/p_b_custom"), cent, subsample, b); - histos.fill(HIST("Data/subsample/p_a2_custom"), cent, subsample, a * a); - histos.fill(HIST("Data/subsample/p_b2_custom"), cent, subsample, b * b); - histos.fill(HIST("Data/subsample/p_ab_custom"), cent, subsample, a * b); - histos.fill(HIST("Data/subsample/p_asumb_custom"), cent, subsample, a + b); + const int subsample = static_cast(mcCollision.globalIndex() % nSub); + + // Standard centrality profiles. + histos.fill(HIST("MCGen/p_a"), cent, nch); + histos.fill(HIST("MCGen/p_b"), cent, sumPt); + histos.fill(HIST("MCGen/p_a2"), cent, nch2); + histos.fill(HIST("MCGen/p_b2"), cent, sumPt2); + histos.fill(HIST("MCGen/p_ab"), cent, nchSumPt); + histos.fill(HIST("MCGen/p_asumb"), cent, nchPlusSumPt); + + // Custom centrality profiles. + histos.fill(HIST("MCGen/p_a_custom"), cent, nch); + histos.fill(HIST("MCGen/p_b_custom"), cent, sumPt); + histos.fill(HIST("MCGen/p_a2_custom"), cent, nch2); + histos.fill(HIST("MCGen/p_b2_custom"), cent, sumPt2); + histos.fill(HIST("MCGen/p_ab_custom"), cent, nchSumPt); + histos.fill(HIST("MCGen/p_asumb_custom"), cent, nchPlusSumPt); + + // Standard centrality subsample profiles. + histos.fill(HIST("MCGen/subsample/p_a"), cent, subsample, nch); + histos.fill(HIST("MCGen/subsample/p_b"), cent, subsample, sumPt); + histos.fill(HIST("MCGen/subsample/p_a2"), cent, subsample, nch2); + histos.fill(HIST("MCGen/subsample/p_b2"), cent, subsample, sumPt2); + histos.fill(HIST("MCGen/subsample/p_ab"), cent, subsample, nchSumPt); + histos.fill(HIST("MCGen/subsample/p_asumb"), cent, subsample, nchPlusSumPt); + + // Custom centrality subsample profiles. + histos.fill(HIST("MCGen/subsample/p_a_custom"), cent, subsample, nch); + histos.fill(HIST("MCGen/subsample/p_b_custom"), cent, subsample, sumPt); + histos.fill(HIST("MCGen/subsample/p_a2_custom"), cent, subsample, nch2); + histos.fill(HIST("MCGen/subsample/p_b2_custom"), cent, subsample, sumPt2); + histos.fill(HIST("MCGen/subsample/p_ab_custom"), cent, subsample, nchSumPt); + histos.fill(HIST("MCGen/subsample/p_asumb_custom"), cent, subsample, nchPlusSumPt); } -}; + + PROCESS_SWITCH(MultAndPtFluctuations, processMC, "Process reconstructed and generated MC", false); +}; // close structure + +// ---------------------------------------------------- +// Workflow +// ---------------------------------------------------- WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; } From 9d28a7a454bb0a2a914f5157a9cc8e4c52f59aaf Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Tue, 1 Dec 2026 13:57:22 +0530 Subject: [PATCH 11/13] Add header --- PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index c1278404adc..7fe4ac487c0 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include #include From 965fa0a9c4e396278cd329114fce0195e1a8852d Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Tue, 1 Dec 2026 14:51:03 +0530 Subject: [PATCH 12/13] Fix header --- .../EbyEFluctuations/Tasks/multAndPtFluctuations.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index 7fe4ac487c0..b38160305ea 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -12,16 +12,12 @@ /// \file multAndPtFluctuations.cxx /// \brief Calculate multiplicity and transverse momentum fluctuations using strongly intensive observables /// \author Omama Rubza -#include "PWGCF/Core/CorrelationContainer.h" - #include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include #include #include #include @@ -33,14 +29,11 @@ #include #include +#include "TString.h" #include -#include #include -#include #include -#include -#include #include #include @@ -61,7 +54,7 @@ struct MultAndPtFluctuations { // PDG charge tolerance static constexpr double ChargeTolerance = 1.e-6; - Service pdgService; + Service pdgService{}; // -------------------------------------------------- // Configurables From e20269779a0ce3fa32f4f593e5c23fcb3b5bfb07 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Tue, 1 Dec 2026 15:06:12 +0530 Subject: [PATCH 13/13] Fix include ordering --- PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx index b38160305ea..76b2768eaf8 100644 --- a/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/multAndPtFluctuations.cxx @@ -29,9 +29,9 @@ #include #include -#include "TString.h" #include #include +#include #include #include