From 9633f8e6254531309301ce4c1c9b292b9527b305 Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Wed, 18 Nov 2026 17:56:46 +0100 Subject: [PATCH 1/8] first commit of task to measure charged particles spectra in ultracentral collisions --- .../GlobalEventProperties/CMakeLists.txt | 5 + .../GlobalEventProperties/heatcapacity.cxx | 385 ++++++++++++++++++ 2 files changed, 390 insertions(+) create mode 100644 PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index ed3beadecc5..439e670dd8f 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -48,3 +48,8 @@ o2physics_add_dpl_workflow(dndeta-hi SOURCES dndetaHi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::Framework COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(heatcap-task + SOURCES heatcapacity.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx new file mode 100644 index 00000000000..d5c28d17439 --- /dev/null +++ b/PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx @@ -0,0 +1,385 @@ +// 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. +/// +/// \brief +/// \author everyone + +#include // tpcNClsCrossedRows +#include // +#include // +#include +#include +#include +#include +#include +#include + +#include // TracksDCA +#include // ft0cOccupancyInTimeRange,trackOccupancyInTimeRange +#include // +#include // multNTracksPVeta1, multNTracksGlobal + +#include "Common/CCDB/EventSelectionParams.h" //kIsTriggerTVX, kNoSameBunchPileup, kIsGoodZvtxFT0vsPV + +#include +#include +#include + + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using CollisionCandidates = soa::Join; +using TrackCandidates = soa::Join; + +struct CentralityClassificationPbPb +{ + + struct EventSelections : ConfigurableGroup { + std::string prefix = "EventSelections-Configurations"; // JSON group name + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC (Run 3 only)"}; + Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference (Run 3 only)"}; + Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", true, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; + + Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + Configurable maxCent{"maxCent", 100.0f, "max centrality percentil"}; + Configurable minCent{"minCent", 0.0f, "min centrality percentil"}; + + } eventSelections; + + + struct TrackSelections : ConfigurableGroup { + std::string prefix = "TrackSelections-Configurations"; // JSON group name + Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; + + Configurable requireTPCRefit{"RequireTPCRefit", true, "Require TPC Refit"}; + Configurable requireITSRefit{"RequireITSRefit", true, "Require ITS Refit"}; + Configurable requireITSibAny{"requireITSibAny", true, "Require ITS inner barrel (ib) any hits"}; + + //Configurable dcaZpos{"dcaZpos", 0.2, "DCA Pos To PV (cm)"}; + Configurable dcaZconst{"dcaZconst", 0.0028f, "Constant term for DCAz cut (cm)"}; + Configurable dcaZpt{"dcaZpt", 0.0175f, "pT-dependent coefficient for DCAz cut (cm)"}; + Configurable dcaZexp{"dcaZexp", -0.88f, "Exponent for DCAz cut"}; + Configurable dcaXYconst{"dcaXYconst", 0.0035f, "Constant term for DCAxy cut (cm)"}; + Configurable dcaXYpt{"dcaXYpt", 0.0145f, "pT-dependent coefficient for DCAxy cut (cm)"}; + Configurable dcaXYexp{"dcaXYexp", 0.91f, "Exponent for DCAxy cut"}; + Configurable maxeta{"maxeta", 2.0f, "pseudorapidity cut"}; + Configurable minpT{"minpT", 0.15f, "Min pT cut"}; + Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "Max Chi2 per cluster TPC "}; + Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "Max Chi2 per cluster ITS "}; + Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; + } trackSelections; + + + struct AxisConfigurations : ConfigurableGroup { + std::string prefix = "axis-Configurations"; // JSON group name + //ConfigurableAxis axisPt{"axispT", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis axisEta{"axisEta", {100, -2.0f, 2.0f}, "Eta"}; + ConfigurableAxis axisPhi{"axisPhi", {100, 0, 2 * M_PI}, " Phi"}; + ConfigurableAxis axispT{"axispT", {100, 0.15f, 10}, " pT"}; + ConfigurableAxis axisdcaZ{"axisdcaZ",{2000, -3.0f, 3.0f}, "dcaZ"}; + ConfigurableAxis axisdcaXY{"axisdcaXY",{2000, -1.0f, 1.0f}, "dcaXY"}; + ConfigurableAxis axisEvSelection{"axisEvSelection",{10, 0.5f, 10.5f}, ""}; + ConfigurableAxis axisTrackSelection{"axisTrackSelection",{8, 0.5f, 8.5f}, ""}; + ConfigurableAxis axisCent{"axisCent",{100, 0, 100}, ""}; + //ConfigurableAxis axisUltCent{"axisUltCent",{VARIABLE_WIDTH, 0.0, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0}, ""}; + ConfigurableAxis axisMult{"axisMult",{500, 0.0f, 5000.0f}, "Multiplicity"}; + //ConfigurableAxis axisAmplitude{"axisAmplitude", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140,160, 180, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000,2500, 3000, 3500,4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 16000, 18000, 20000, 25000, 30000, 35000, 40000, 45000, 50000,60000, 70000}, "FT0C Amplitude"}; + ConfigurableAxis axisAmplitude{"axisAmplitude",{1400, 0.0f, 70000.0f},"FT0C Amplitude"}; + ConfigurableAxis axisVz{"axisVz", {200, -10.0f, 10.0f}, "V_{z} (cm)"}; //nuevo + } axisConfigurations; + + + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + + void init(InitContext const&) + { + histos.add("hEventSelection", "hEventSelection", kTH1D, {axisConfigurations.axisEvSelection}); + histos.add("hTrackSelection", "hTrackSelection", kTH1D, {axisConfigurations.axisTrackSelection}); + + histos.add("hEventNchCorrelationBefCuts", "hEventNchCorrelationBefCuts", kTH2F, {{5000, 0, 5000}, {2500, 0, 2500}}); + histos.add("hEventNchCorrelation", "hEventNchCorrelation", kTH2F, {{5000, 0, 5000}, {2500, 0, 2500}}); + + histos.add("hEventPVcontributorsVsCentralityBefCuts", "hEventPVcontributorsVsCentralityBefCuts", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); + histos.add("hEventPVcontributorsVsCentrality", "hEventPVcontributorsVsCentrality", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); + + histos.add("hEventGlobalTracksVsCentralityBefCuts", "hEventGlobalTracksVsCentralityBefCuts", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); + histos.add("hEventGlobalTracksVsCentrality", "hEventGlobalTracksVsCentrality", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); + + histos.add("hNTracksVSetaBefCuts", "hNTracksVSetaBefCuts", kTH1D, {axisConfigurations.axisEta}); + histos.add("hNTracksVSeta", "hNTracksVSeta", kTH1D, {axisConfigurations.axisEta}); + + histos.add("hNTracksVSphiBefCuts", "hNTracksVSphiBefCuts", kTH1D, {axisConfigurations.axisPhi}); + histos.add("hNTracksVSphi", "hNTracksVSphi", kTH1D, {axisConfigurations.axisPhi}); + + histos.add("hdcaZVSptBefCuts", "hdcaZVSptBefCuts", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispT}); + histos.add("hdcaZVSpt", "hdcaZVSpt", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispT}); + + histos.add("hdcaXYVSptBefCuts", "hdcaXYVSptBefCut", kTH2F, {axisConfigurations.axisdcaXY, axisConfigurations.axispT}); + histos.add("hdcaXYVSpt", "hdcaXYVSpt", kTH2F, {axisConfigurations.axisdcaXY, axisConfigurations.axispT}); + + histos.add("hFT0CAmplitude", "hFT0CAmplitude", kTH1D, {axisConfigurations.axisAmplitude}); + //histos.add("hUltCent", "hUltCent", kTH1F, {axisConfigurations.axisUltCent}); + histos.add("hFT0CAmplitudeVSMult", "hFT0CAmplitudeVSMult", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisMult}); + histos.add("hFT0CAmplitudeVSpT", "hFT0CAmplitudeVSpT", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axispT}); + histos.add("hFT0CAmplitudeVsVz", "hFT0CAmplitudeVsVz", kTH2F, {axisConfigurations.axisVz, axisConfigurations.axisAmplitude}); + + histos.add("hMultSelectedTracks", "Multiplicity of selected tracks;N_{tracks};Events", kTH1D, {axisConfigurations.axisMult}); + histos.add("hMultGlobalTracks", "Global tracks multiplicity;multNTracksGlobal;Events", kTH1D, {axisConfigurations.axisMult}); + histos.add("hMultPVeta1", "PV contributors (|#eta| < 1);multNTracksPVeta1;Events", kTH1D, {axisConfigurations.axisMult}); + + + auto hEvSelCount = histos.get(HIST("hEventSelection")); + hEvSelCount->GetXaxis()->SetBinLabel(1, "All events"); + hEvSelCount->GetXaxis()->SetBinLabel(2, "sel8"); + hEvSelCount->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); + hEvSelCount->GetXaxis()->SetBinLabel(4, "Vertex Z position"); + hEvSelCount->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); + hEvSelCount->GetXaxis()->SetBinLabel(6, "kNoSameBunchPileup"); + hEvSelCount->GetXaxis()->SetBinLabel(7, "Below min occup."); + hEvSelCount->GetXaxis()->SetBinLabel(8, "Above max occup."); + hEvSelCount->GetXaxis()->SetBinLabel(9, "Centrality"); + hEvSelCount->GetXaxis()->SetBinLabel(10, "Selected events"); + + auto hTrackSelCount = histos.get(HIST("hTrackSelection")); + hTrackSelCount->GetXaxis()->SetBinLabel(1, "All tracks"); + hTrackSelCount->GetXaxis()->SetBinLabel(2, "TPC tracks"); + hTrackSelCount->GetXaxis()->SetBinLabel(3, "ITS tracks"); + hTrackSelCount->GetXaxis()->SetBinLabel(4, "eta selection"); + hTrackSelCount->GetXaxis()->SetBinLabel(5, "min pT selection"); + hTrackSelCount->GetXaxis()->SetBinLabel(6, "dcaXY"); + hTrackSelCount->GetXaxis()->SetBinLabel(7, "dcaZ"); + hTrackSelCount->GetXaxis()->SetBinLabel(8, "Selected tracks"); + + } + + template + bool isEventAccepted(const TCollision& collision, bool fillHists) + { + if (fillHists) { + histos.fill(HIST("hEventSelection"), 1); + histos.fill(HIST("hEventNchCorrelationBefCuts"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentralityBefCuts"), collision.centFT0C(), collision.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentralityBefCuts"), collision.centFT0C(), collision.multNTracksGlobal()); + } + + if (eventSelections.requireSel8 && !collision.sel8()) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 2); + } + + if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 3 ); + } + + if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 4); + } + + if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 5 ); + } + + if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 6); + } + + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 7); + } + + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 8); + } + /* PONER CONFIGURABLES */ + if (collision.centFT0C() < eventSelections.minCent || collision.centFT0C() > eventSelections.maxCent) { + return false; + } + if (fillHists) { + histos.fill(HIST("hEventSelection"), 9); + } + + + if (fillHists) { + //Arfer Event Selection + histos.fill(HIST("hEventSelection"), 10); + histos.fill(HIST("hEventNchCorrelation"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentrality"), collision.centFT0C(), collision.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); + } + + return true; + } + + + template + bool IsTrackSelected(CheckTrack const& track, bool fillHists) + { + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 1); + } + + //TPC cuts + if (trackSelections.requireTPCRefit && !track.hasTPC()) { + return false; + } + if (track.hasTPC() && (track.tpcNClsCrossedRows() < trackSelections.minTPCrows || track.tpcChi2NCl() > trackSelections.maxChi2TPC || track.tpcCrossedRowsOverFindableCls() < trackSelections.minNCrossedRowsOverFindableClustersTPC)) { + return false; + } + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 2); + } + + //ITS cuts + if (trackSelections.requireITSRefit && !track.hasITS()) { + return false; + } + if (trackSelections.requireITSibAny && !(track.itsClusterMap() & 0x7)) { + return false; + } + if (track.hasITS() && track.itsChi2NCl() > trackSelections.maxChi2ITS) { + return false; + } + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 3); + } + + // eta cut + if(fabs(track.eta()) > trackSelections.maxeta){ + return false; + } + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 4); + } + + // pT cut + if(track.pt() < trackSelections.minpT){ + return false; + } + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 5); + } + + // dcaXY cut + float maxDCAxy = trackSelections.dcaXYconst + trackSelections.dcaXYpt * std::pow(track.pt(), trackSelections.dcaXYexp); + if(fabs(track.dcaXY()) > maxDCAxy){ + return false; + } + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 6); + } + + //dcaZ VS pt before max dcaZ=0.2 selection, but after dcaXY + if (fillHists) { + histos.fill(HIST("hdcaZVSptBefCuts"), track.dcaZ(), track.pt()); + } + + // dcaZ cut + float maxDCAz = trackSelections.dcaZconst + trackSelections.dcaZpt * std::pow(track.pt(), trackSelections.dcaZexp); + if(fabs(track.dcaZ()) > maxDCAz){ + return false; + } + if (fillHists) { + histos.fill(HIST("hTrackSelection"), 7); + } + + //dcaZ VS pt after max dcaZ=0.2 selection + if (fillHists) { + histos.fill(HIST("hdcaZVSpt"), track.dcaZ(), track.pt()); + histos.fill(HIST("hTrackSelection"), 8); + } + + return true; + } + + + void process(CollisionCandidates::iterator const& collision, TrackCandidates const& tracks, aod::FT0s const& ) + { + + if (!isEventAccepted(collision, true)) { + return; + } + + //Looping over tracks before selection + for (int i = 0; i < tracks.size(); i++) { + auto track = tracks.iteratorAt(i); + histos.fill(HIST("hNTracksVSetaBefCuts"), track.eta()); + histos.fill(HIST("hNTracksVSphiBefCuts"), track.phi()); + histos.fill(HIST("hdcaXYVSptBefCuts"), track.dcaXY(), track.pt()); + } + //Collision selection level + if (!collision.has_foundFT0()) { + return; + } + const auto& ft0 = collision.foundFT0(); + float ft0cAmp = ft0.sumAmpC(); + int multiplicity = collision.multNTracksPVeta1(); + histos.fill(HIST("hFT0CAmplitude"),ft0cAmp); + histos.fill(HIST("hFT0CAmplitudeVsVz"), collision.posZ(), ft0cAmp); + histos.fill(HIST("hFT0CAmplitudeVSMult"), ft0cAmp, multiplicity); + + + //Looping over selected tracks + int nSelTracks = 0; + for (int i = 0; i < tracks.size(); i++) { + auto track = tracks.iteratorAt(i); + if (!IsTrackSelected(track, true)) { + continue; + } + nSelTracks++; + histos.fill(HIST("hNTracksVSeta"), track.eta()); + histos.fill(HIST("hNTracksVSphi"), track.phi()); + histos.fill(HIST("hdcaXYVSpt"), track.dcaXY(), track.pt()); + histos.fill(HIST("hFT0CAmplitudeVSpT"), ft0cAmp, track.pt()); + } + + //histograms for mult + histos.fill(HIST("hMultSelectedTracks"), nSelTracks); + histos.fill(HIST("hMultGlobalTracks"), collision.multNTracksGlobal()); + histos.fill(HIST("hMultPVeta1"), collision.multNTracksPVeta1()); + + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc) + }; +} From 3c80c2747622f668c0675c07688ce9d1d237c67a Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Thu, 19 Nov 2026 14:12:23 +0100 Subject: [PATCH 2/8] changing name by convention, and removed all trailing spaces --- .../GlobalEventProperties/CMakeLists.txt | 2 +- .../{heatcapacity.cxx => heatCapacity.cxx} | 23 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) rename PWGLF/Tasks/GlobalEventProperties/{heatcapacity.cxx => heatCapacity.cxx} (97%) diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index 439e670dd8f..9dac474785d 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -49,7 +49,7 @@ o2physics_add_dpl_workflow(dndeta-hi PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::Framework COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(heatcap-task +o2physics_add_dpl_workflow(heat-capacity SOURCES heatcapacity.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx similarity index 97% rename from PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx rename to PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx index d5c28d17439..5d355859e4c 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heatcapacity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx @@ -9,12 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// -/// \brief -/// \author everyone +/// \brief Task to measure charged particles spectra in ultracentral collisions +/// \author Diana Rosales Herrera (diana.rosales.herrera@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) #include // tpcNClsCrossedRows -#include // -#include // +#include +#include #include #include #include @@ -24,7 +25,7 @@ #include // TracksDCA #include // ft0cOccupancyInTimeRange,trackOccupancyInTimeRange -#include // +#include #include // multNTracksPVeta1, multNTracksGlobal #include "Common/CCDB/EventSelectionParams.h" //kIsTriggerTVX, kNoSameBunchPileup, kIsGoodZvtxFT0vsPV @@ -36,10 +37,10 @@ using namespace o2; using namespace o2::framework; -using namespace o2::framework::expressions; +using namespace o2::framework::expressions; -using CollisionCandidates = soa::Join; -using TrackCandidates = soa::Join; +using CollisionCandidates = soa::Join; +using TrackCandidates = soa::Join; struct CentralityClassificationPbPb { @@ -57,14 +58,11 @@ struct CentralityClassificationPbPb Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; Configurable maxCent{"maxCent", 100.0f, "max centrality percentil"}; Configurable minCent{"minCent", 0.0f, "min centrality percentil"}; - } eventSelections; - struct TrackSelections : ConfigurableGroup { std::string prefix = "TrackSelections-Configurations"; // JSON group name Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; - Configurable requireTPCRefit{"RequireTPCRefit", true, "Require TPC Refit"}; Configurable requireITSRefit{"RequireITSRefit", true, "Require ITS Refit"}; Configurable requireITSibAny{"requireITSibAny", true, "Require ITS inner barrel (ib) any hits"}; @@ -83,7 +81,6 @@ struct CentralityClassificationPbPb Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; } trackSelections; - struct AxisConfigurations : ConfigurableGroup { std::string prefix = "axis-Configurations"; // JSON group name //ConfigurableAxis axisPt{"axispT", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p}_{T} (GeV/#it{c})"}; @@ -99,7 +96,7 @@ struct CentralityClassificationPbPb ConfigurableAxis axisMult{"axisMult",{500, 0.0f, 5000.0f}, "Multiplicity"}; //ConfigurableAxis axisAmplitude{"axisAmplitude", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140,160, 180, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000,2500, 3000, 3500,4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 16000, 18000, 20000, 25000, 30000, 35000, 40000, 45000, 50000,60000, 70000}, "FT0C Amplitude"}; ConfigurableAxis axisAmplitude{"axisAmplitude",{1400, 0.0f, 70000.0f},"FT0C Amplitude"}; - ConfigurableAxis axisVz{"axisVz", {200, -10.0f, 10.0f}, "V_{z} (cm)"}; //nuevo + ConfigurableAxis axisVz{"axisVz", {200, -10.0f, 10.0f}, "V_{z} (cm)"}; } axisConfigurations; From 65b06484f9ece39d8f143ce3e0f765697e41f990 Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Fri, 20 Nov 2026 16:41:10 +0100 Subject: [PATCH 3/8] Remove unusefull comments --- PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx index 5d355859e4c..d698071f107 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx @@ -13,7 +13,7 @@ /// \author Diana Rosales Herrera (diana.rosales.herrera@cern.ch) /// \author Chiara De Martin (chiara.de.martin@cern.ch) -#include // tpcNClsCrossedRows +#include #include #include #include @@ -23,12 +23,12 @@ #include #include -#include // TracksDCA -#include // ft0cOccupancyInTimeRange,trackOccupancyInTimeRange +#include +#include #include -#include // multNTracksPVeta1, multNTracksGlobal +#include -#include "Common/CCDB/EventSelectionParams.h" //kIsTriggerTVX, kNoSameBunchPileup, kIsGoodZvtxFT0vsPV +#include "Common/CCDB/EventSelectionParams.h" #include #include @@ -42,7 +42,7 @@ using namespace o2::framework::expressions; using CollisionCandidates = soa::Join; using TrackCandidates = soa::Join; -struct CentralityClassificationPbPb +struct heatCapacity { struct EventSelections : ConfigurableGroup { @@ -377,6 +377,6 @@ struct CentralityClassificationPbPb WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc) + adaptAnalysisTask(cfgc) }; } From 0887286a28d55d123e0685b61ddddd0ef626ce86 Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Tue, 24 Nov 2026 10:36:53 +0100 Subject: [PATCH 4/8] Change the name of the task --- PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index 9dac474785d..8d86c1bffcb 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -50,6 +50,6 @@ o2physics_add_dpl_workflow(dndeta-hi COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(heat-capacity - SOURCES heatcapacity.cxx + SOURCES heatCapacity.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) From ffe2fab74259dd6d1c27968fe9961252bd5d7686 Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Tue, 24 Nov 2026 10:40:06 +0100 Subject: [PATCH 5/8] Add processMC function --- .../GlobalEventProperties/heatCapacity.cxx | 178 ++++++++++++++---- 1 file changed, 137 insertions(+), 41 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx index d698071f107..b1e2734b755 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -41,9 +43,14 @@ using namespace o2::framework::expressions; using CollisionCandidates = soa::Join; using TrackCandidates = soa::Join; +using McCollisionCandidates = soa::Join; +using McTrackCandidates = soa::Join; struct heatCapacity { + Service pdg; + //Preslice perMcCollision = aod::mcparticle::mcCollisionId; + Preslice perCollision = aod::track::collisionId; struct EventSelections : ConfigurableGroup { std::string prefix = "EventSelections-Configurations"; // JSON group name @@ -74,7 +81,7 @@ struct heatCapacity Configurable dcaXYconst{"dcaXYconst", 0.0035f, "Constant term for DCAxy cut (cm)"}; Configurable dcaXYpt{"dcaXYpt", 0.0145f, "pT-dependent coefficient for DCAxy cut (cm)"}; Configurable dcaXYexp{"dcaXYexp", 0.91f, "Exponent for DCAxy cut"}; - Configurable maxeta{"maxeta", 2.0f, "pseudorapidity cut"}; + Configurable maxeta{"maxeta", 1.0f, "pseudorapidity cut"}; Configurable minpT{"minpT", 0.15f, "Min pT cut"}; Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "Max Chi2 per cluster TPC "}; Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "Max Chi2 per cluster ITS "}; @@ -83,7 +90,7 @@ struct heatCapacity struct AxisConfigurations : ConfigurableGroup { std::string prefix = "axis-Configurations"; // JSON group name - //ConfigurableAxis axisPt{"axispT", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis axispTVar{"axispTVar", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axisEta{"axisEta", {100, -2.0f, 2.0f}, "Eta"}; ConfigurableAxis axisPhi{"axisPhi", {100, 0, 2 * M_PI}, " Phi"}; ConfigurableAxis axispT{"axispT", {100, 0.15f, 10}, " pT"}; @@ -92,9 +99,7 @@ struct heatCapacity ConfigurableAxis axisEvSelection{"axisEvSelection",{10, 0.5f, 10.5f}, ""}; ConfigurableAxis axisTrackSelection{"axisTrackSelection",{8, 0.5f, 8.5f}, ""}; ConfigurableAxis axisCent{"axisCent",{100, 0, 100}, ""}; - //ConfigurableAxis axisUltCent{"axisUltCent",{VARIABLE_WIDTH, 0.0, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0}, ""}; ConfigurableAxis axisMult{"axisMult",{500, 0.0f, 5000.0f}, "Multiplicity"}; - //ConfigurableAxis axisAmplitude{"axisAmplitude", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140,160, 180, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000,2500, 3000, 3500,4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 16000, 18000, 20000, 25000, 30000, 35000, 40000, 45000, 50000,60000, 70000}, "FT0C Amplitude"}; ConfigurableAxis axisAmplitude{"axisAmplitude",{1400, 0.0f, 70000.0f},"FT0C Amplitude"}; ConfigurableAxis axisVz{"axisVz", {200, -10.0f, 10.0f}, "V_{z} (cm)"}; } axisConfigurations; @@ -130,17 +135,38 @@ struct heatCapacity histos.add("hdcaXYVSptBefCuts", "hdcaXYVSptBefCut", kTH2F, {axisConfigurations.axisdcaXY, axisConfigurations.axispT}); histos.add("hdcaXYVSpt", "hdcaXYVSpt", kTH2F, {axisConfigurations.axisdcaXY, axisConfigurations.axispT}); + //processReco Using sumAmpC histos.add("hFT0CAmplitude", "hFT0CAmplitude", kTH1D, {axisConfigurations.axisAmplitude}); - //histos.add("hUltCent", "hUltCent", kTH1F, {axisConfigurations.axisUltCent}); histos.add("hFT0CAmplitudeVSMult", "hFT0CAmplitudeVSMult", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisMult}); histos.add("hFT0CAmplitudeVSpT", "hFT0CAmplitudeVSpT", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axispT}); - histos.add("hFT0CAmplitudeVsVz", "hFT0CAmplitudeVsVz", kTH2F, {axisConfigurations.axisVz, axisConfigurations.axisAmplitude}); - - histos.add("hMultSelectedTracks", "Multiplicity of selected tracks;N_{tracks};Events", kTH1D, {axisConfigurations.axisMult}); + histos.add("hFT0CAmplitudeVsVz", "hFT0CAmplitudeVsVz", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisVz}); + //processReco Using centFT0C + histos.add("hCentFT0", "hCentFT0", kTH1D, {axisConfigurations.axisCent}); + histos.add("hCentFT0VSMult", "hCentFT0VSMult", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axisMult}); + histos.add("hCentFT0VSpT", "hCentFT0VSpT", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispT}); + histos.add("hCentFT0VsVz", "hCentFT0VsVz", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axisVz}); + + //Multiplicity per tracks histos.add("hMultGlobalTracks", "Global tracks multiplicity;multNTracksGlobal;Events", kTH1D, {axisConfigurations.axisMult}); histos.add("hMultPVeta1", "PV contributors (|#eta| < 1);multNTracksPVeta1;Events", kTH1D, {axisConfigurations.axisMult}); - - + histos.add("hpT", "pT histogram", kTH1D, {axisConfigurations.axispTVar}); + + //processMC histograms + if (doprocessMC) { + histos.add("MC/hMcCentFT0", "hMcCentFT0", kTH1D, {axisConfigurations.axisCent}); + histos.add("MC/hMcCentFT0VsVz", "hMcCentFT0VsVz", kTH2F, {axisConfigurations.axisVz, axisConfigurations.axisCent}); + histos.add("MC/hMcCentFT0VspTAll", "All selected reco tracks (Cent, pT_rec)", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0VspTRecoPrim", "Primary reco tracks (Cent, pT_MC)", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0VspTGenPrim", "Primary gen charged particles (Cent, pT_MC)", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); + histos.add("MC/hMcpTAll", "hMcpTAll", kTH1D, {axisConfigurations.axispTVar}); + histos.add("MC/hMcpTRecoPrim", "hMcpTRecoPrim", kTH1D, {axisConfigurations.axispTVar}); + histos.add("MC/hMcpTGenPrim", "hMcpTGenPrim", kTH1D, {axisConfigurations.axispTVar}); + histos.add("MC/hMcdcaZVSpt", "hMcdcaZVSpt", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispTVar}); + histos.add("MC/hMcdcaZVSptBefCuts", "hMcdcaZVSptBefCuts", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispT}); + histos.add("MC/hMcCentFT0_pT_eta_RecoPrim", "Reco Primary (Cent, pT_MC, Eta_MC)", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); + histos.add("MC/hMcCentFT0_pT_eta_GenPrim", "Gen Primary (Cent, pT_MC, Eta_MC)", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); + } + auto hEvSelCount = histos.get(HIST("hEventSelection")); hEvSelCount->GetXaxis()->SetBinLabel(1, "All events"); hEvSelCount->GetXaxis()->SetBinLabel(2, "sel8"); @@ -224,7 +250,7 @@ struct heatCapacity if (fillHists) { histos.fill(HIST("hEventSelection"), 8); } - /* PONER CONFIGURABLES */ + if (collision.centFT0C() < eventSelections.minCent || collision.centFT0C() > eventSelections.maxCent) { return false; } @@ -300,24 +326,18 @@ struct heatCapacity } if (fillHists) { histos.fill(HIST("hTrackSelection"), 6); - } - - //dcaZ VS pt before max dcaZ=0.2 selection, but after dcaXY - if (fillHists) { + //dcaZ VS pt before max dcaZ=0.2 selection, but after dcaXY histos.fill(HIST("hdcaZVSptBefCuts"), track.dcaZ(), track.pt()); } - // dcaZ cut + // dcaZ cut float maxDCAz = trackSelections.dcaZconst + trackSelections.dcaZpt * std::pow(track.pt(), trackSelections.dcaZexp); if(fabs(track.dcaZ()) > maxDCAz){ return false; } if (fillHists) { histos.fill(HIST("hTrackSelection"), 7); - } - - //dcaZ VS pt after max dcaZ=0.2 selection - if (fillHists) { + //dcaZ VS pt after max dcaZ=0.2 selection histos.fill(HIST("hdcaZVSpt"), track.dcaZ(), track.pt()); histos.fill(HIST("hTrackSelection"), 8); } @@ -325,53 +345,129 @@ struct heatCapacity return true; } + template + bool IsGenTrackSelected(CheckGenTrack const& particle) + { + if (!particle.isPhysicalPrimary()) { + return false; + } + if (!particle.producedByGenerator()) { + return false; + } + auto pdgTrack = pdg->GetParticle(particle.pdgCode()); + if (pdgTrack == nullptr) { + return false; + } + if (std::abs(pdgTrack->Charge()) < 3) { + return false; + } + if (std::abs(particle.eta()) >trackSelections.maxeta) { + return false; + } + if(particle.pt() < trackSelections.minpT){ + return false; + } + return true; + } - void process(CollisionCandidates::iterator const& collision, TrackCandidates const& tracks, aod::FT0s const& ) + void processReco(CollisionCandidates::iterator const& collision, TrackCandidates const& tracks, aod::FT0s const& ) { - if (!isEventAccepted(collision, true)) { return; } - //Looping over tracks before selection - for (int i = 0; i < tracks.size(); i++) { - auto track = tracks.iteratorAt(i); - histos.fill(HIST("hNTracksVSetaBefCuts"), track.eta()); - histos.fill(HIST("hNTracksVSphiBefCuts"), track.phi()); - histos.fill(HIST("hdcaXYVSptBefCuts"), track.dcaXY(), track.pt()); - } - //Collision selection level + //Using .centFT0C + float centrality = collision.centFT0C(); + int mult = collision.multNTracksPVeta1(); + histos.fill(HIST("hCentFT0"), centrality); + histos.fill(HIST("hCentFT0VsVz"), centrality, collision.posZ()); + histos.fill(HIST("hCentFT0VSMult"), centrality, mult); + + histos.fill(HIST("hMultGlobalTracks"), collision.multNTracksGlobal()); + histos.fill(HIST("hMultPVeta1"), mult); + + + //Using has_foundFT0() and .sumAmpC if (!collision.has_foundFT0()) { return; } const auto& ft0 = collision.foundFT0(); float ft0cAmp = ft0.sumAmpC(); - int multiplicity = collision.multNTracksPVeta1(); histos.fill(HIST("hFT0CAmplitude"),ft0cAmp); - histos.fill(HIST("hFT0CAmplitudeVsVz"), collision.posZ(), ft0cAmp); - histos.fill(HIST("hFT0CAmplitudeVSMult"), ft0cAmp, multiplicity); - + histos.fill(HIST("hFT0CAmplitudeVsVz"), ft0cAmp, collision.posZ()); + histos.fill(HIST("hFT0CAmplitudeVSMult"), ft0cAmp, mult); + - //Looping over selected tracks - int nSelTracks = 0; + //Looping over tracks before selection for (int i = 0; i < tracks.size(); i++) { auto track = tracks.iteratorAt(i); + histos.fill(HIST("hNTracksVSetaBefCuts"), track.eta()); + histos.fill(HIST("hNTracksVSphiBefCuts"), track.phi()); + histos.fill(HIST("hdcaXYVSptBefCuts"), track.dcaXY(), track.pt()); + if (!IsTrackSelected(track, true)) { continue; } - nSelTracks++; histos.fill(HIST("hNTracksVSeta"), track.eta()); histos.fill(HIST("hNTracksVSphi"), track.phi()); + histos.fill(HIST("hpT"), track.pt()); histos.fill(HIST("hdcaXYVSpt"), track.dcaXY(), track.pt()); histos.fill(HIST("hFT0CAmplitudeVSpT"), ft0cAmp, track.pt()); + histos.fill(HIST("hCentFT0VSpT"), centrality, track.pt()); } + } + + PROCESS_SWITCH(heatCapacity, processReco, "Process for Reco data", true); - //histograms for mult - histos.fill(HIST("hMultSelectedTracks"), nSelTracks); - histos.fill(HIST("hMultGlobalTracks"), collision.multNTracksGlobal()); - histos.fill(HIST("hMultPVeta1"), collision.multNTracksPVeta1()); + void processMC(aod::McCollisions::iterator const&, soa::SmallGroups const& collisions, McTrackCandidates const& tracks, aod::McParticles const& mcParticles) + { + //hist counting gen events + //Do all reco collisions need to pass the selection? + for (const auto& collision : collisions) { + //histogram + if (!isEventAccepted(collision,false)) { + continue; + } + float centrality = collision.centFT0C(); + histos.fill(HIST("MC/hMcCentFT0VsVz"), collision.posZ(), centrality); + histos.fill(HIST("MC/hMcCentFT0"),centrality ); + + + auto tracksPerColl = tracks.sliceBy(perCollision, collision.globalIndex()); + for (const auto& track : tracksPerColl) { + if (!IsTrackSelected(track, false)) { + continue; + } + //Todas las trazas reconstruidas seleccionadas + histos.fill(HIST("MC/hMcpTAll"), track.pt()); + histos.fill(HIST("MC/hMcCentFT0VspTAll"), centrality, track.pt()); + //Numerador de eficiencia + if (track.has_mcParticle()) { + const auto& mcPart = track.mcParticle(); + if (mcPart.isPhysicalPrimary() && mcPart.producedByGenerator()) { + histos.fill(HIST("MC/hMcpTRecoPrim"), mcPart.pt()); + histos.fill(HIST("MC/hMcCentFT0VspTRecoPrim"), centrality, mcPart.pt()); + histos.fill(HIST("MC/hMcCentFT0_pT_eta_RecoPrim"), centrality, mcPart.pt(), mcPart.eta()); + } + } + } + + + // Denominador de eficiencia + + for (const auto& particle : mcParticles) { + if (!IsGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("MC/hMcpTGenPrim"), particle.pt()); + histos.fill(HIST("MC/hMcCentFT0VspTGenPrim"), centrality, particle.pt()); + histos.fill(HIST("MC/hMcCentFT0_pT_eta_GenPrim"), centrality, particle.pt(), particle.eta()); + } + } } + PROCESS_SWITCH(heatCapacity, processMC, "Process for MC data", false); + }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 6b7e59e55a09808d271b86854e6663834d689421 Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Thu, 26 Nov 2026 14:43:37 +0100 Subject: [PATCH 6/8] efficiency histograms --- .../GlobalEventProperties/heatCapacity.cxx | 119 ++++++++++++------ 1 file changed, 80 insertions(+), 39 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx index b1e2734b755..56ea0d051b2 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx @@ -49,7 +49,6 @@ using McTrackCandidates = soa::Join; struct heatCapacity { Service pdg; - //Preslice perMcCollision = aod::mcparticle::mcCollisionId; Preslice perCollision = aod::track::collisionId; struct EventSelections : ConfigurableGroup { @@ -138,33 +137,46 @@ struct heatCapacity //processReco Using sumAmpC histos.add("hFT0CAmplitude", "hFT0CAmplitude", kTH1D, {axisConfigurations.axisAmplitude}); histos.add("hFT0CAmplitudeVSMult", "hFT0CAmplitudeVSMult", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisMult}); - histos.add("hFT0CAmplitudeVSpT", "hFT0CAmplitudeVSpT", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axispT}); + histos.add("hFT0CAmplitudeVSpT", "hFT0CAmplitudeVSpT", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axispTVar}); histos.add("hFT0CAmplitudeVsVz", "hFT0CAmplitudeVsVz", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisVz}); //processReco Using centFT0C histos.add("hCentFT0", "hCentFT0", kTH1D, {axisConfigurations.axisCent}); histos.add("hCentFT0VSMult", "hCentFT0VSMult", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axisMult}); - histos.add("hCentFT0VSpT", "hCentFT0VSpT", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispT}); + histos.add("hCentFT0VSpT", "hCentFT0VSpT", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); histos.add("hCentFT0VsVz", "hCentFT0VsVz", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axisVz}); - + histos.add("hCentFT0MultpT", "hCentFT0MultpT;Centrality; Multiplicity; pT", kTH3F, {axisConfigurations.axisCent, axisConfigurations.axisMult, axisConfigurations.axispTVar}); //Multiplicity per tracks histos.add("hMultGlobalTracks", "Global tracks multiplicity;multNTracksGlobal;Events", kTH1D, {axisConfigurations.axisMult}); - histos.add("hMultPVeta1", "PV contributors (|#eta| < 1);multNTracksPVeta1;Events", kTH1D, {axisConfigurations.axisMult}); + histos.add("hMultPVeta1", "PV contributors eta< 1; multNTracksPVeta1;Events", kTH1D, {axisConfigurations.axisMult}); histos.add("hpT", "pT histogram", kTH1D, {axisConfigurations.axispTVar}); + histos.add("hMultVSpT", "MultVSpT; Mult; pT)", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); + histos.add("hMult", "hMult; Mult-selected tracks; Events", kTH1D, {axisConfigurations.axisMult}); //processMC histograms if (doprocessMC) { - histos.add("MC/hMcCentFT0", "hMcCentFT0", kTH1D, {axisConfigurations.axisCent}); + histos.add("MC/hMcCentFT0", "hMcCentFT0; Centrality FT0; Entries", kTH1D, {axisConfigurations.axisCent}); histos.add("MC/hMcCentFT0VsVz", "hMcCentFT0VsVz", kTH2F, {axisConfigurations.axisVz, axisConfigurations.axisCent}); - histos.add("MC/hMcCentFT0VspTAll", "All selected reco tracks (Cent, pT_rec)", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); - histos.add("MC/hMcCentFT0VspTRecoPrim", "Primary reco tracks (Cent, pT_MC)", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); - histos.add("MC/hMcCentFT0VspTGenPrim", "Primary gen charged particles (Cent, pT_MC)", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); - histos.add("MC/hMcpTAll", "hMcpTAll", kTH1D, {axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0VspTAll", "All selected reco tracks passing cuts; Cent; pT_rec", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0VspTRecoPrim", "Primary reco tracks;Cent; pT_MC", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0VspTGenPrim", "Primary gen charged particles; Cent; pT_MC", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); + histos.add("MC/hMcpTAll", "hMcpTAll; pT from all selected tracks; Entries", kTH1D, {axisConfigurations.axispTVar}); histos.add("MC/hMcpTRecoPrim", "hMcpTRecoPrim", kTH1D, {axisConfigurations.axispTVar}); histos.add("MC/hMcpTGenPrim", "hMcpTGenPrim", kTH1D, {axisConfigurations.axispTVar}); histos.add("MC/hMcdcaZVSpt", "hMcdcaZVSpt", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispTVar}); - histos.add("MC/hMcdcaZVSptBefCuts", "hMcdcaZVSptBefCuts", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispT}); - histos.add("MC/hMcCentFT0_pT_eta_RecoPrim", "Reco Primary (Cent, pT_MC, Eta_MC)", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); - histos.add("MC/hMcCentFT0_pT_eta_GenPrim", "Gen Primary (Cent, pT_MC, Eta_MC)", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); + histos.add("MC/hMcdcaZVSptBefCuts", "hMcdcaZVSptBefCuts", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0_pT_eta_RecoPrim", "Primary Reco; Cent; pT_MC; Eta_MC", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); + histos.add("MC/hMcCentFT0_pT_eta_GenPrim", "Primary gen; Cent; pT_MC: Eta_MC", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); + histos.add("MC/hMcCentFT0_pT_eta_All", "All tracks passing cuts; Cent; pT: Eta", kTH3D, {axisConfigurations.axisCent, axisConfigurations.axispTVar, axisConfigurations.axisEta}); + histos.add("MC/hMcCentFT0Mult", "MC Selected events; Centrality; Mult", kTH2D, {axisConfigurations.axisCent, axisConfigurations.axisMult}); + histos.add("MC/hMcCentFT0MultpTRecoPrim", "Primary reco tracks; Centrality; Mul; pT_MC", kTH3F, {axisConfigurations.axisCent, axisConfigurations.axisMult, axisConfigurations.axispTVar}); + histos.add("MC/hMcCentFT0MultpTGenPrim", "Primary gen particles; Centrality; Mult; pT_MC", kTH3F, {axisConfigurations.axisCent, axisConfigurations.axisMult, axisConfigurations.axispTVar}); + //MCmultiplicity + histos.add("MC/hMcMult", "MC delected mult events", kTH1D, {axisConfigurations.axisMult}); + histos.add("MC/hMcMultVspTRecoPrim", "Primary reco tracks; Mult; pT_MC", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); + histos.add("MC/hMcMultVspTGenPrim","Primary gen charged particles; Mult; pT_MC", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); + histos.add("MC/hMcMultGen", "MC mult generated ; N_gen; Events", kTH1D, {axisConfigurations.axisMult}); + + histos.add("MC/hNRecoCollisionsPerMc", "Reco collisions per MC event; reco collisions; MC events", kTH1D, {{10, -0.5, 9.5}}); } auto hEvSelCount = histos.get(HIST("hEventSelection")); @@ -379,10 +391,11 @@ struct heatCapacity //Using .centFT0C float centrality = collision.centFT0C(); int mult = collision.multNTracksPVeta1(); + + //1/Nev histos.fill(HIST("hCentFT0"), centrality); histos.fill(HIST("hCentFT0VsVz"), centrality, collision.posZ()); histos.fill(HIST("hCentFT0VSMult"), centrality, mult); - histos.fill(HIST("hMultGlobalTracks"), collision.multNTracksGlobal()); histos.fill(HIST("hMultPVeta1"), mult); @@ -397,7 +410,7 @@ struct heatCapacity histos.fill(HIST("hFT0CAmplitudeVsVz"), ft0cAmp, collision.posZ()); histos.fill(HIST("hFT0CAmplitudeVSMult"), ft0cAmp, mult); - + int nSelectedTracks = 0; //Looping over tracks before selection for (int i = 0; i < tracks.size(); i++) { auto track = tracks.iteratorAt(i); @@ -408,66 +421,94 @@ struct heatCapacity if (!IsTrackSelected(track, true)) { continue; } + nSelectedTracks++; + histos.fill(HIST("hCentFT0MultpT"), centrality, mult, track.pt()); + histos.fill(HIST("hMultVSpT"), mult, track.pt()); histos.fill(HIST("hNTracksVSeta"), track.eta()); histos.fill(HIST("hNTracksVSphi"), track.phi()); histos.fill(HIST("hpT"), track.pt()); histos.fill(HIST("hdcaXYVSpt"), track.dcaXY(), track.pt()); histos.fill(HIST("hFT0CAmplitudeVSpT"), ft0cAmp, track.pt()); histos.fill(HIST("hCentFT0VSpT"), centrality, track.pt()); - } + } + //Mult dist per event + histos.fill(HIST("hMult"), nSelectedTracks); } - PROCESS_SWITCH(heatCapacity, processReco, "Process for Reco data", true); + PROCESS_SWITCH(heatCapacity, processReco, "Process for Reco data", false); void processMC(aod::McCollisions::iterator const&, soa::SmallGroups const& collisions, McTrackCandidates const& tracks, aod::McParticles const& mcParticles) { - //hist counting gen events - //Do all reco collisions need to pass the selection? + bool atLeastOne = false; + float bestMult = -1.0f; + float bestCent = -1.0f; + float bestVz = 0.0f; + + histos.fill(HIST("MC/hNRecoCollisionsPerMc"), collisions.size()); for (const auto& collision : collisions) { - //histogram if (!isEventAccepted(collision,false)) { continue; } + atLeastOne = true; + float centrality = collision.centFT0C(); - histos.fill(HIST("MC/hMcCentFT0VsVz"), collision.posZ(), centrality); - histos.fill(HIST("MC/hMcCentFT0"),centrality ); - - + int mult = collision.multNTracksPVeta1(); + if (mult > bestMult) { + bestMult = mult; + bestCent = centrality; + bestVz = collision.posZ(); + } + auto tracksPerColl = tracks.sliceBy(perCollision, collision.globalIndex()); for (const auto& track : tracksPerColl) { if (!IsTrackSelected(track, false)) { continue; } - //Todas las trazas reconstruidas seleccionadas + //All reco tracks passing cuts histos.fill(HIST("MC/hMcpTAll"), track.pt()); histos.fill(HIST("MC/hMcCentFT0VspTAll"), centrality, track.pt()); - //Numerador de eficiencia + histos.fill(HIST("MC/hMcCentFT0_pT_eta_All"), centrality, track.pt(), track.eta()); + + + //Numerator if (track.has_mcParticle()) { const auto& mcPart = track.mcParticle(); if (mcPart.isPhysicalPrimary() && mcPart.producedByGenerator()) { histos.fill(HIST("MC/hMcpTRecoPrim"), mcPart.pt()); histos.fill(HIST("MC/hMcCentFT0VspTRecoPrim"), centrality, mcPart.pt()); + histos.fill(HIST("MC/hMcCentFT0MultpTRecoPrim"), centrality, mult, mcPart.pt()); histos.fill(HIST("MC/hMcCentFT0_pT_eta_RecoPrim"), centrality, mcPart.pt(), mcPart.eta()); + histos.fill(HIST("MC/hMcMultVspTRecoPrim"), mult, mcPart.pt()); } } } - + } - // Denominador de eficiencia - - for (const auto& particle : mcParticles) { - if (!IsGenTrackSelected(particle)) { - continue; - } - histos.fill(HIST("MC/hMcpTGenPrim"), particle.pt()); - histos.fill(HIST("MC/hMcCentFT0VspTGenPrim"), centrality, particle.pt()); - histos.fill(HIST("MC/hMcCentFT0_pT_eta_GenPrim"), centrality, particle.pt(), particle.eta()); - } + if (!atLeastOne) { + return; } - } - PROCESS_SWITCH(heatCapacity, processMC, "Process for MC data", false); + histos.fill(HIST("MC/hMcCentFT0VsVz"), bestVz, bestCent); + histos.fill(HIST("MC/hMcCentFT0"), bestCent); + histos.fill(HIST("MC/hMcMult"), bestMult); + histos.fill(HIST("MC/hMcCentFT0Mult"), bestCent, bestMult); + int nGenParticles = 0; + // Denominator + for (const auto& particle : mcParticles) { + if (!IsGenTrackSelected(particle)) { + continue; + } + nGenParticles++; + histos.fill(HIST("MC/hMcpTGenPrim"), particle.pt()); + histos.fill(HIST("MC/hMcCentFT0VspTGenPrim"), bestCent, particle.pt()); + histos.fill(HIST("MC/hMcCentFT0_pT_eta_GenPrim"), bestCent, particle.pt(), particle.eta()); + histos.fill(HIST("MC/hMcMultVspTGenPrim"), bestMult, particle.pt()); + histos.fill(HIST("MC/hMcCentFT0MultpTGenPrim"), bestCent, bestMult, particle.pt()); + } + histos.fill(HIST("MC/hMcMultGen"), nGenParticles); + } + PROCESS_SWITCH(heatCapacity, processMC, "Process for MC data", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 6c91ba28ea0c175dcffdfb5994889139b7e10e4a Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 26 Nov 2026 13:45:49 +0000 Subject: [PATCH 7/8] Please consider the following formatting changes --- .../GlobalEventProperties/heatCapacity.cxx | 168 ++++++++---------- 1 file changed, 78 insertions(+), 90 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx index 56ea0d051b2..2794e4c715c 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx @@ -13,29 +13,28 @@ /// \author Diana Rosales Herrera (diana.rosales.herrera@cern.ch) /// \author Chiara De Martin (chiara.de.martin@cern.ch) +#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 #include #include #include -#include -#include -#include #include -#include - -#include -#include -#include -#include +#include +#include -#include "Common/CCDB/EventSelectionParams.h" +#include +#include #include #include -#include - using namespace o2; using namespace o2::framework; @@ -46,8 +45,7 @@ using TrackCandidates = soa::Join using McCollisionCandidates = soa::Join; using McTrackCandidates = soa::Join; -struct heatCapacity -{ +struct heatCapacity { Service pdg; Preslice perCollision = aod::track::collisionId; @@ -65,7 +63,7 @@ struct heatCapacity Configurable maxCent{"maxCent", 100.0f, "max centrality percentil"}; Configurable minCent{"minCent", 0.0f, "min centrality percentil"}; } eventSelections; - + struct TrackSelections : ConfigurableGroup { std::string prefix = "TrackSelections-Configurations"; // JSON group name Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; @@ -73,7 +71,7 @@ struct heatCapacity Configurable requireITSRefit{"RequireITSRefit", true, "Require ITS Refit"}; Configurable requireITSibAny{"requireITSibAny", true, "Require ITS inner barrel (ib) any hits"}; - //Configurable dcaZpos{"dcaZpos", 0.2, "DCA Pos To PV (cm)"}; + // Configurable dcaZpos{"dcaZpos", 0.2, "DCA Pos To PV (cm)"}; Configurable dcaZconst{"dcaZconst", 0.0028f, "Constant term for DCAz cut (cm)"}; Configurable dcaZpt{"dcaZpt", 0.0175f, "pT-dependent coefficient for DCAz cut (cm)"}; Configurable dcaZexp{"dcaZexp", -0.88f, "Exponent for DCAz cut"}; @@ -86,28 +84,25 @@ struct heatCapacity Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "Max Chi2 per cluster ITS "}; Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; } trackSelections; - + struct AxisConfigurations : ConfigurableGroup { std::string prefix = "axis-Configurations"; // JSON group name ConfigurableAxis axispTVar{"axispTVar", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axisEta{"axisEta", {100, -2.0f, 2.0f}, "Eta"}; ConfigurableAxis axisPhi{"axisPhi", {100, 0, 2 * M_PI}, " Phi"}; ConfigurableAxis axispT{"axispT", {100, 0.15f, 10}, " pT"}; - ConfigurableAxis axisdcaZ{"axisdcaZ",{2000, -3.0f, 3.0f}, "dcaZ"}; - ConfigurableAxis axisdcaXY{"axisdcaXY",{2000, -1.0f, 1.0f}, "dcaXY"}; - ConfigurableAxis axisEvSelection{"axisEvSelection",{10, 0.5f, 10.5f}, ""}; - ConfigurableAxis axisTrackSelection{"axisTrackSelection",{8, 0.5f, 8.5f}, ""}; - ConfigurableAxis axisCent{"axisCent",{100, 0, 100}, ""}; - ConfigurableAxis axisMult{"axisMult",{500, 0.0f, 5000.0f}, "Multiplicity"}; - ConfigurableAxis axisAmplitude{"axisAmplitude",{1400, 0.0f, 70000.0f},"FT0C Amplitude"}; + ConfigurableAxis axisdcaZ{"axisdcaZ", {2000, -3.0f, 3.0f}, "dcaZ"}; + ConfigurableAxis axisdcaXY{"axisdcaXY", {2000, -1.0f, 1.0f}, "dcaXY"}; + ConfigurableAxis axisEvSelection{"axisEvSelection", {10, 0.5f, 10.5f}, ""}; + ConfigurableAxis axisTrackSelection{"axisTrackSelection", {8, 0.5f, 8.5f}, ""}; + ConfigurableAxis axisCent{"axisCent", {100, 0, 100}, ""}; + ConfigurableAxis axisMult{"axisMult", {500, 0.0f, 5000.0f}, "Multiplicity"}; + ConfigurableAxis axisAmplitude{"axisAmplitude", {1400, 0.0f, 70000.0f}, "FT0C Amplitude"}; ConfigurableAxis axisVz{"axisVz", {200, -10.0f, 10.0f}, "V_{z} (cm)"}; } axisConfigurations; - - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - void init(InitContext const&) { histos.add("hEventSelection", "hEventSelection", kTH1D, {axisConfigurations.axisEvSelection}); @@ -118,15 +113,15 @@ struct heatCapacity histos.add("hEventPVcontributorsVsCentralityBefCuts", "hEventPVcontributorsVsCentralityBefCuts", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); histos.add("hEventPVcontributorsVsCentrality", "hEventPVcontributorsVsCentrality", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); - + histos.add("hEventGlobalTracksVsCentralityBefCuts", "hEventGlobalTracksVsCentralityBefCuts", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); histos.add("hEventGlobalTracksVsCentrality", "hEventGlobalTracksVsCentrality", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); - + histos.add("hNTracksVSetaBefCuts", "hNTracksVSetaBefCuts", kTH1D, {axisConfigurations.axisEta}); histos.add("hNTracksVSeta", "hNTracksVSeta", kTH1D, {axisConfigurations.axisEta}); - histos.add("hNTracksVSphiBefCuts", "hNTracksVSphiBefCuts", kTH1D, {axisConfigurations.axisPhi}); - histos.add("hNTracksVSphi", "hNTracksVSphi", kTH1D, {axisConfigurations.axisPhi}); + histos.add("hNTracksVSphiBefCuts", "hNTracksVSphiBefCuts", kTH1D, {axisConfigurations.axisPhi}); + histos.add("hNTracksVSphi", "hNTracksVSphi", kTH1D, {axisConfigurations.axisPhi}); histos.add("hdcaZVSptBefCuts", "hdcaZVSptBefCuts", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispT}); histos.add("hdcaZVSpt", "hdcaZVSpt", kTH2F, {axisConfigurations.axisdcaZ, axisConfigurations.axispT}); @@ -134,25 +129,25 @@ struct heatCapacity histos.add("hdcaXYVSptBefCuts", "hdcaXYVSptBefCut", kTH2F, {axisConfigurations.axisdcaXY, axisConfigurations.axispT}); histos.add("hdcaXYVSpt", "hdcaXYVSpt", kTH2F, {axisConfigurations.axisdcaXY, axisConfigurations.axispT}); - //processReco Using sumAmpC - histos.add("hFT0CAmplitude", "hFT0CAmplitude", kTH1D, {axisConfigurations.axisAmplitude}); + // processReco Using sumAmpC + histos.add("hFT0CAmplitude", "hFT0CAmplitude", kTH1D, {axisConfigurations.axisAmplitude}); histos.add("hFT0CAmplitudeVSMult", "hFT0CAmplitudeVSMult", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisMult}); histos.add("hFT0CAmplitudeVSpT", "hFT0CAmplitudeVSpT", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axispTVar}); histos.add("hFT0CAmplitudeVsVz", "hFT0CAmplitudeVsVz", kTH2F, {axisConfigurations.axisAmplitude, axisConfigurations.axisVz}); - //processReco Using centFT0C - histos.add("hCentFT0", "hCentFT0", kTH1D, {axisConfigurations.axisCent}); + // processReco Using centFT0C + histos.add("hCentFT0", "hCentFT0", kTH1D, {axisConfigurations.axisCent}); histos.add("hCentFT0VSMult", "hCentFT0VSMult", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axisMult}); histos.add("hCentFT0VSpT", "hCentFT0VSpT", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axispTVar}); histos.add("hCentFT0VsVz", "hCentFT0VsVz", kTH2F, {axisConfigurations.axisCent, axisConfigurations.axisVz}); histos.add("hCentFT0MultpT", "hCentFT0MultpT;Centrality; Multiplicity; pT", kTH3F, {axisConfigurations.axisCent, axisConfigurations.axisMult, axisConfigurations.axispTVar}); - //Multiplicity per tracks + // Multiplicity per tracks histos.add("hMultGlobalTracks", "Global tracks multiplicity;multNTracksGlobal;Events", kTH1D, {axisConfigurations.axisMult}); histos.add("hMultPVeta1", "PV contributors eta< 1; multNTracksPVeta1;Events", kTH1D, {axisConfigurations.axisMult}); histos.add("hpT", "pT histogram", kTH1D, {axisConfigurations.axispTVar}); histos.add("hMultVSpT", "MultVSpT; Mult; pT)", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); histos.add("hMult", "hMult; Mult-selected tracks; Events", kTH1D, {axisConfigurations.axisMult}); - - //processMC histograms + + // processMC histograms if (doprocessMC) { histos.add("MC/hMcCentFT0", "hMcCentFT0; Centrality FT0; Entries", kTH1D, {axisConfigurations.axisCent}); histos.add("MC/hMcCentFT0VsVz", "hMcCentFT0VsVz", kTH2F, {axisConfigurations.axisVz, axisConfigurations.axisCent}); @@ -170,15 +165,15 @@ struct heatCapacity histos.add("MC/hMcCentFT0Mult", "MC Selected events; Centrality; Mult", kTH2D, {axisConfigurations.axisCent, axisConfigurations.axisMult}); histos.add("MC/hMcCentFT0MultpTRecoPrim", "Primary reco tracks; Centrality; Mul; pT_MC", kTH3F, {axisConfigurations.axisCent, axisConfigurations.axisMult, axisConfigurations.axispTVar}); histos.add("MC/hMcCentFT0MultpTGenPrim", "Primary gen particles; Centrality; Mult; pT_MC", kTH3F, {axisConfigurations.axisCent, axisConfigurations.axisMult, axisConfigurations.axispTVar}); - //MCmultiplicity + // MCmultiplicity histos.add("MC/hMcMult", "MC delected mult events", kTH1D, {axisConfigurations.axisMult}); histos.add("MC/hMcMultVspTRecoPrim", "Primary reco tracks; Mult; pT_MC", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); - histos.add("MC/hMcMultVspTGenPrim","Primary gen charged particles; Mult; pT_MC", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); + histos.add("MC/hMcMultVspTGenPrim", "Primary gen charged particles; Mult; pT_MC", kTH2F, {axisConfigurations.axisMult, axisConfigurations.axispTVar}); histos.add("MC/hMcMultGen", "MC mult generated ; N_gen; Events", kTH1D, {axisConfigurations.axisMult}); - histos.add("MC/hNRecoCollisionsPerMc", "Reco collisions per MC event; reco collisions; MC events", kTH1D, {{10, -0.5, 9.5}}); + histos.add("MC/hNRecoCollisionsPerMc", "Reco collisions per MC event; reco collisions; MC events", kTH1D, {{10, -0.5, 9.5}}); } - + auto hEvSelCount = histos.get(HIST("hEventSelection")); hEvSelCount->GetXaxis()->SetBinLabel(1, "All events"); hEvSelCount->GetXaxis()->SetBinLabel(2, "sel8"); @@ -186,7 +181,7 @@ struct heatCapacity hEvSelCount->GetXaxis()->SetBinLabel(4, "Vertex Z position"); hEvSelCount->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); hEvSelCount->GetXaxis()->SetBinLabel(6, "kNoSameBunchPileup"); - hEvSelCount->GetXaxis()->SetBinLabel(7, "Below min occup."); + hEvSelCount->GetXaxis()->SetBinLabel(7, "Below min occup."); hEvSelCount->GetXaxis()->SetBinLabel(8, "Above max occup."); hEvSelCount->GetXaxis()->SetBinLabel(9, "Centrality"); hEvSelCount->GetXaxis()->SetBinLabel(10, "Selected events"); @@ -200,7 +195,6 @@ struct heatCapacity hTrackSelCount->GetXaxis()->SetBinLabel(6, "dcaXY"); hTrackSelCount->GetXaxis()->SetBinLabel(7, "dcaZ"); hTrackSelCount->GetXaxis()->SetBinLabel(8, "Selected tracks"); - } template @@ -224,7 +218,7 @@ struct heatCapacity return false; } if (fillHists) { - histos.fill(HIST("hEventSelection"), 3 ); + histos.fill(HIST("hEventSelection"), 3); } if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { @@ -238,7 +232,7 @@ struct heatCapacity return false; } if (fillHists) { - histos.fill(HIST("hEventSelection"), 5 ); + histos.fill(HIST("hEventSelection"), 5); } if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { @@ -262,27 +256,25 @@ struct heatCapacity if (fillHists) { histos.fill(HIST("hEventSelection"), 8); } - + if (collision.centFT0C() < eventSelections.minCent || collision.centFT0C() > eventSelections.maxCent) { return false; } if (fillHists) { histos.fill(HIST("hEventSelection"), 9); } - if (fillHists) { - //Arfer Event Selection + // Arfer Event Selection histos.fill(HIST("hEventSelection"), 10); histos.fill(HIST("hEventNchCorrelation"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentrality"), collision.centFT0C(), collision.multNTracksPVeta1()); histos.fill(HIST("hEventGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); } - + return true; } - template bool IsTrackSelected(CheckTrack const& track, bool fillHists) { @@ -290,10 +282,10 @@ struct heatCapacity histos.fill(HIST("hTrackSelection"), 1); } - //TPC cuts + // TPC cuts if (trackSelections.requireTPCRefit && !track.hasTPC()) { return false; - } + } if (track.hasTPC() && (track.tpcNClsCrossedRows() < trackSelections.minTPCrows || track.tpcChi2NCl() > trackSelections.maxChi2TPC || track.tpcCrossedRowsOverFindableCls() < trackSelections.minNCrossedRowsOverFindableClustersTPC)) { return false; } @@ -301,7 +293,7 @@ struct heatCapacity histos.fill(HIST("hTrackSelection"), 2); } - //ITS cuts + // ITS cuts if (trackSelections.requireITSRefit && !track.hasITS()) { return false; } @@ -316,7 +308,7 @@ struct heatCapacity } // eta cut - if(fabs(track.eta()) > trackSelections.maxeta){ + if (fabs(track.eta()) > trackSelections.maxeta) { return false; } if (fillHists) { @@ -324,7 +316,7 @@ struct heatCapacity } // pT cut - if(track.pt() < trackSelections.minpT){ + if (track.pt() < trackSelections.minpT) { return false; } if (fillHists) { @@ -333,23 +325,23 @@ struct heatCapacity // dcaXY cut float maxDCAxy = trackSelections.dcaXYconst + trackSelections.dcaXYpt * std::pow(track.pt(), trackSelections.dcaXYexp); - if(fabs(track.dcaXY()) > maxDCAxy){ + if (fabs(track.dcaXY()) > maxDCAxy) { return false; } if (fillHists) { histos.fill(HIST("hTrackSelection"), 6); - //dcaZ VS pt before max dcaZ=0.2 selection, but after dcaXY + // dcaZ VS pt before max dcaZ=0.2 selection, but after dcaXY histos.fill(HIST("hdcaZVSptBefCuts"), track.dcaZ(), track.pt()); } // dcaZ cut float maxDCAz = trackSelections.dcaZconst + trackSelections.dcaZpt * std::pow(track.pt(), trackSelections.dcaZexp); - if(fabs(track.dcaZ()) > maxDCAz){ + if (fabs(track.dcaZ()) > maxDCAz) { return false; - } + } if (fillHists) { histos.fill(HIST("hTrackSelection"), 7); - //dcaZ VS pt after max dcaZ=0.2 selection + // dcaZ VS pt after max dcaZ=0.2 selection histos.fill(HIST("hdcaZVSpt"), track.dcaZ(), track.pt()); histos.fill(HIST("hTrackSelection"), 8); } @@ -373,51 +365,50 @@ struct heatCapacity if (std::abs(pdgTrack->Charge()) < 3) { return false; } - if (std::abs(particle.eta()) >trackSelections.maxeta) { + if (std::abs(particle.eta()) > trackSelections.maxeta) { return false; } - if(particle.pt() < trackSelections.minpT){ + if (particle.pt() < trackSelections.minpT) { return false; } return true; } - void processReco(CollisionCandidates::iterator const& collision, TrackCandidates const& tracks, aod::FT0s const& ) - { + void processReco(CollisionCandidates::iterator const& collision, TrackCandidates const& tracks, aod::FT0s const&) + { if (!isEventAccepted(collision, true)) { return; } - //Using .centFT0C + // Using .centFT0C float centrality = collision.centFT0C(); int mult = collision.multNTracksPVeta1(); - //1/Nev + // 1/Nev histos.fill(HIST("hCentFT0"), centrality); histos.fill(HIST("hCentFT0VsVz"), centrality, collision.posZ()); histos.fill(HIST("hCentFT0VSMult"), centrality, mult); histos.fill(HIST("hMultGlobalTracks"), collision.multNTracksGlobal()); histos.fill(HIST("hMultPVeta1"), mult); - - //Using has_foundFT0() and .sumAmpC + // Using has_foundFT0() and .sumAmpC if (!collision.has_foundFT0()) { return; } const auto& ft0 = collision.foundFT0(); float ft0cAmp = ft0.sumAmpC(); - histos.fill(HIST("hFT0CAmplitude"),ft0cAmp); + histos.fill(HIST("hFT0CAmplitude"), ft0cAmp); histos.fill(HIST("hFT0CAmplitudeVsVz"), ft0cAmp, collision.posZ()); histos.fill(HIST("hFT0CAmplitudeVSMult"), ft0cAmp, mult); - + int nSelectedTracks = 0; - //Looping over tracks before selection - for (int i = 0; i < tracks.size(); i++) { + // Looping over tracks before selection + for (int i = 0; i < tracks.size(); i++) { auto track = tracks.iteratorAt(i); histos.fill(HIST("hNTracksVSetaBefCuts"), track.eta()); - histos.fill(HIST("hNTracksVSphiBefCuts"), track.phi()); - histos.fill(HIST("hdcaXYVSptBefCuts"), track.dcaXY(), track.pt()); - + histos.fill(HIST("hNTracksVSphiBefCuts"), track.phi()); + histos.fill(HIST("hdcaXYVSptBefCuts"), track.dcaXY(), track.pt()); + if (!IsTrackSelected(track, true)) { continue; } @@ -430,11 +421,11 @@ struct heatCapacity histos.fill(HIST("hdcaXYVSpt"), track.dcaXY(), track.pt()); histos.fill(HIST("hFT0CAmplitudeVSpT"), ft0cAmp, track.pt()); histos.fill(HIST("hCentFT0VSpT"), centrality, track.pt()); - } - //Mult dist per event + } + // Mult dist per event histos.fill(HIST("hMult"), nSelectedTracks); } - + PROCESS_SWITCH(heatCapacity, processReco, "Process for Reco data", false); void processMC(aod::McCollisions::iterator const&, soa::SmallGroups const& collisions, McTrackCandidates const& tracks, aod::McParticles const& mcParticles) @@ -443,10 +434,10 @@ struct heatCapacity float bestMult = -1.0f; float bestCent = -1.0f; float bestVz = 0.0f; - + histos.fill(HIST("MC/hNRecoCollisionsPerMc"), collisions.size()); for (const auto& collision : collisions) { - if (!isEventAccepted(collision,false)) { + if (!isEventAccepted(collision, false)) { continue; } atLeastOne = true; @@ -459,19 +450,17 @@ struct heatCapacity bestVz = collision.posZ(); } - auto tracksPerColl = tracks.sliceBy(perCollision, collision.globalIndex()); for (const auto& track : tracksPerColl) { if (!IsTrackSelected(track, false)) { continue; } - //All reco tracks passing cuts + // All reco tracks passing cuts histos.fill(HIST("MC/hMcpTAll"), track.pt()); histos.fill(HIST("MC/hMcCentFT0VspTAll"), centrality, track.pt()); histos.fill(HIST("MC/hMcCentFT0_pT_eta_All"), centrality, track.pt(), track.eta()); - - - //Numerator + + // Numerator if (track.has_mcParticle()) { const auto& mcPart = track.mcParticle(); if (mcPart.isPhysicalPrimary() && mcPart.producedByGenerator()) { @@ -502,7 +491,7 @@ struct heatCapacity nGenParticles++; histos.fill(HIST("MC/hMcpTGenPrim"), particle.pt()); histos.fill(HIST("MC/hMcCentFT0VspTGenPrim"), bestCent, particle.pt()); - histos.fill(HIST("MC/hMcCentFT0_pT_eta_GenPrim"), bestCent, particle.pt(), particle.eta()); + histos.fill(HIST("MC/hMcCentFT0_pT_eta_GenPrim"), bestCent, particle.pt(), particle.eta()); histos.fill(HIST("MC/hMcMultVspTGenPrim"), bestMult, particle.pt()); histos.fill(HIST("MC/hMcCentFT0MultpTGenPrim"), bestCent, bestMult, particle.pt()); } @@ -514,6 +503,5 @@ struct heatCapacity WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc) - }; + adaptAnalysisTask(cfgc)}; } From 33d5fb9ca0d50cd25fc48ed6b28b120ed09b3764 Mon Sep 17 00:00:00 2001 From: Diana Rosales Date: Thu, 26 Nov 2026 17:37:54 +0100 Subject: [PATCH 8/8] fix MegaLinter error --- PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx index 2794e4c715c..ff0ec2471d0 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heatCapacity.cxx @@ -8,7 +8,7 @@ // 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 heatCapacity.cxx /// \brief Task to measure charged particles spectra in ultracentral collisions /// \author Diana Rosales Herrera (diana.rosales.herrera@cern.ch) /// \author Chiara De Martin (chiara.de.martin@cern.ch) @@ -262,9 +262,6 @@ struct heatCapacity { } if (fillHists) { histos.fill(HIST("hEventSelection"), 9); - } - - if (fillHists) { // Arfer Event Selection histos.fill(HIST("hEventSelection"), 10); histos.fill(HIST("hEventNchCorrelation"), collision.multNTracksPVeta1(), collision.multNTracksGlobal());