From 168b850b370047caee945b983ade0656be550334 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Wed, 8 Jul 2026 16:09:35 +0530 Subject: [PATCH 1/5] multandpt --- PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt | 5 + .../Tasks/MultandPtFluctuations.cxx | 276 ++++++++++++++++++ 2 files changed, 281 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..f17be4f5601 100644 --- a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt +++ b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt @@ -88,3 +88,8 @@ 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..cdd9872ce25 --- /dev/null +++ b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx @@ -0,0 +1,276 @@ +// 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 "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "TProfile.h" +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod; +using namespace o2::framework::expressions; + + +struct myExampleTask { + + // ------ 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{"vertexZcut", 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 (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; + } + } + + + /* if (eta >= 0.6 && eta < 0.8) + nf++; + else if (eta > -0.8 && eta <= -0.6)Sigma_pTN_OO_NeNe.C + nb++;*/ + + // 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(); + + } + // LOG(info) << "Nch = " << nch; + /* histos.fill(HIST("hNch"),nch); + eventNch(col, nch);*/ + + + // ---- 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 b88ead33bd8afecab5494f27456e2e5f2b11dc24 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Sat, 11 Jul 2026 12:48:13 +0530 Subject: [PATCH 2/5] Fix workflow naming --- PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx index cdd9872ce25..89005a3cba3 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx @@ -38,7 +38,7 @@ using namespace o2::aod; using namespace o2::framework::expressions; -struct myExampleTask { +struct MultandptFluctuations { // ------ Histogram binning @@ -267,7 +267,7 @@ struct myExampleTask { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc) + adaptAnalysisTask(cfgc) }; } From 8fca7117b6067d3c784c4ef05a4f7f761cba1197 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Sat, 11 Jul 2026 13:01:05 +0530 Subject: [PATCH 3/5] Remove trailing whitespace --- .../Tasks/MultandPtFluctuations.cxx | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx index 89005a3cba3..36d8bce5135 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx @@ -49,15 +49,13 @@ struct MultandptFluctuations { // ------ Event Cuts - Configurable vtxZcut{"vertexZcut", 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 + // ----- Centrality estimator Configurable cFT0M{"cFT0M", false, "FT0M centrality"}; // for pp Configurable cFT0C{"cFT0C", true, "Use FT0C centrality"}; @@ -77,16 +75,13 @@ struct MultandptFluctuations { 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"}; @@ -98,34 +93,25 @@ struct MultandptFluctuations { 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("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}); @@ -135,12 +121,10 @@ struct MultandptFluctuations { } - //---------- Filters - + //---------- 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; @@ -152,8 +136,7 @@ struct MultandptFluctuations { float cent = -1.0f; - if (cFT0M) { - cent = col.centFT0M(); + if (cFT0M) { cent = col.centFT0M(); } if (cFT0C) { @@ -166,13 +149,13 @@ struct MultandptFluctuations { } 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; @@ -181,10 +164,10 @@ struct MultandptFluctuations { histos.fill(HIST("QA/AfterCut/VtxZ"), col.posZ()); histos.fill(HIST("QA/AfterCut/Cent"), cent); - + double A = 0.0; - double B = 0.0; - + double B = 0.0; + // if (!track.isGlobalTrack()) continue; for (auto& track : tracks) { @@ -195,7 +178,7 @@ struct MultandptFluctuations { histos.fill(HIST("QA/BeforeCut/DcaZ"), track.dcaZ()); // Track quality cuts - + if (requireITS && !track.hasITS()) continue; if (requireTPC && !track.hasTPC()) continue; @@ -222,7 +205,7 @@ struct MultandptFluctuations { continue; } } - + /* if (eta >= 0.6 && eta < 0.8) nf++; @@ -239,10 +222,10 @@ struct MultandptFluctuations { 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(); - + } // LOG(info) << "Nch = " << nch; /* histos.fill(HIST("hNch"),nch); From eb9aa24ef10830045a7c3dd9f5eb7ccebf3bfb8e Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Sat, 11 Jul 2026 13:14:25 +0530 Subject: [PATCH 4/5] Other Correction --- .../Tasks/MultandPtFluctuations.cxx | 41 +++++-------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx index 36d8bce5135..9146a7c9134 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx @@ -169,7 +169,7 @@ struct MultandptFluctuations { double B = 0.0; // if (!track.isGlobalTrack()) continue; - for (auto& track : tracks) { + for (const auto& track : tracks) { histos.fill(HIST("QA/BeforeCut/Eta"), track.eta()); histos.fill(HIST("QA/BeforeCut/Pt"), track.pt()); @@ -206,14 +206,7 @@ struct MultandptFluctuations { } } - - /* if (eta >= 0.6 && eta < 0.8) - nf++; - else if (eta > -0.8 && eta <= -0.6)Sigma_pTN_OO_NeNe.C - nb++;*/ - // 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()); @@ -223,37 +216,23 @@ struct MultandptFluctuations { 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(); + A++; //A-nch, B =pt + B += track.pt(); } - // LOG(info) << "Nch = " << nch; - /* histos.fill(HIST("hNch"),nch); - eventNch(col, nch);*/ - - - // ---- 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); - - + // ---- 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 657091342f337c569ae369ac16e74c82563f6069 Mon Sep 17 00:00:00 2001 From: Omama Rubza Date: Sat, 11 Jul 2026 14:02:25 +0530 Subject: [PATCH 5/5] Fix O2 linter issues --- .../Tasks/MultandPtFluctuations.cxx | 237 +++++++++--------- 1 file changed, 123 insertions(+), 114 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx index 9146a7c9134..6736eaa667c 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MultandPtFluctuations.cxx @@ -10,26 +10,26 @@ // or submit itself to any jurisdiction. /// - /// \file MultandPtFluctuations.cxx /// \brief Calculate multiplicity and transverse momentum fluctuations using strongly intensive observables /// \author Omama Rubza -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/HistogramSpec.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" - +#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/Centrality.h" -#include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" +#include "Framework/runDataProcessing.h" + #include "TProfile.h" + #include using namespace o2; @@ -37,8 +37,7 @@ using namespace o2::framework; using namespace o2::aod; using namespace o2::framework::expressions; - -struct MultandptFluctuations { +struct MultandPtFluctuations { // ------ Histogram binning @@ -47,40 +46,37 @@ struct MultandptFluctuations { Configurable ndcaZ{"ndcaZ", 100, "DCAz bins"}; Configurable nCentBins{"nCentBins", 100, "Number of centrality bins"}; - // ------ Event Cuts - Configurable vtxZcut{"vertexZcut", 10.0f, "Vertex Z"}; + Configurable vtxZcut{"vtxZcut", 10.0f, "vertex Z"}; Configurable cfgNoSameBunchPileup{"cfgNoSameBunchPileup", true, "kNoSameBunchPileup"}; - Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV",true, "Good Zvtx FT0 vs PV"}; + 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"}; - + 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 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 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 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"}; - + Configurable requireInnerITS{"requireInnerITS", true, "At least one hit in ITS layers 0,1,2"}; //----- Histogram Registry HistogramRegistry histos{ - "histos", {}, OutputObjHandlingPolicy::AnalysisObject - }; + "histos", + {}, + OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext const&) { @@ -88,61 +84,60 @@ struct MultandptFluctuations { 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 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 histos.add("QA/BeforeCut/VtxZ", "Vertex Z", kTH1F, {axisVtxz}); - histos.add("QA/AfterCut/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/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("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}); - + 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; + //---------- 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 myColsData = soa::Join; using myTracksData = soa::Join; using myFilteredTracksData = soa::Filtered; - void process(myColsData::iterator const& col, myFilteredTracksData const& tracks) + 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 (cFT0M) { + cent = col.centFT0M(); } if (cFT0C) { - cent = col.centFT0C(); - // if (!track.isGlobalTrack()) continue; - } + cent = col.centFT0C(); + // if (!track.isGlobalTrack()) continue; + } if (cent < 0) { return; @@ -150,89 +145,103 @@ struct MultandptFluctuations { histos.fill(HIST("QA/BeforeCut/Cent"), cent); - if (!col.sel8()) return; + if (!col.sel8()) + return; - if (std::abs(col.posZ()) > vtxZcut) return; + if (std::abs(col.posZ()) > vtxZcut) + return; - if (cfgNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) return; + if (cfgNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; - if (cfgEvSelUseGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return; + if (cfgEvSelUseGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; - if (cfgUseGoodITSLayerAllCut && !col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) 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; + double a = 0.0; + double b = 0.0; - // if (!track.isGlobalTrack()) continue; - for (const auto& track : tracks) { + // 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()); + 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 + // Track quality cuts - if (requireITS && !track.hasITS()) continue; - if (requireTPC && !track.hasTPC()) continue; + if (requireITS && !track.hasITS()) + continue; + if (requireTPC && !track.hasTPC()) + continue; - if (track.itsNCls() < itsNClsCut) continue; - if (track.tpcNClsCrossedRows() < tpcCrossCut) continue; + if (track.itsNCls() < itsNClsCut) + continue; + if (track.tpcNClsCrossedRows() < tpcCrossCut) + continue; - if (track.tpcCrossedRowsOverFindableCls() < crossedRowsOverFindableCut) continue; + if (track.tpcCrossedRowsOverFindableCls() < crossedRowsOverFindableCut) + continue; - if (std::abs(track.dcaZ()) > dcaZCut) continue; - if (std::abs(track.dcaXY()) > dcaXYCut) 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 (track.tpcChi2NCl() > tpcChiCut) + continue; + if (track.itsChi2NCl() > itsChiCut) + continue; - if (std::abs(track.eta()) > etaCut) continue; + if (std::abs(track.eta()) > etaCut) + continue; - if (requireInnerITS) { + if (requireInnerITS) { - auto itsMap = track.itsClusterMap(); + auto itsMap = track.itsClusterMap(); - if (!(itsMap & (1 << 0)) && - !(itsMap & (1 << 1)) && - !(itsMap & (1 << 2))) { - continue; - } - } + 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()); + // 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(); + 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); + + // ---- 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) - }; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; }