From 553e3e7e20bf7ad1c2da3884d624e66eff509781 Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Fri, 20 Jun 2025 09:19:17 +0200 Subject: [PATCH 1/4] Prevent dangling reference error when switching from gsl to std::span --- Common/TableProducer/multiplicityTable.cxx | 6 ++++-- Common/Tools/MultModule.h | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index eb9648ecf2b..71d24ab6a30 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -267,12 +267,14 @@ struct MultiplicityTable { int multNContribsEtaHalf = 0; if (collision.has_fv0a()) { - for (const auto& amplitude : collision.fv0a().amplitude()) { + auto fv0a = collision.fv0a(); + for (const auto& amplitude : fv0a.amplitude()) { multFV0A += amplitude; } } if (collision.has_fv0c()) { - for (const auto& amplitude : collision.fv0c().amplitude()) { + auto fv0c = collision.fv0c(); + for (const auto& amplitude : fv0c.amplitude()) { multFV0C += amplitude; } } diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index 07397131b68..03a76088d4c 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -500,12 +500,14 @@ class MultModule //_______________________________________________________________________ // forward detector signals, raw if (collision.has_fv0a()) { - for (const auto& amplitude : collision.fv0a().amplitude()) { + auto fv0a = collision.fv0a(); + for (const auto& amplitude : fv0a.amplitude()) { mults.multFV0A += amplitude; } } if (collision.has_fv0c()) { - for (const auto& amplitude : collision.fv0c().amplitude()) { + auto fv0c = collision.fv0c(); + for (const auto& amplitude : fv0c.amplitude()) { mults.multFV0C += amplitude; } } From 3270f58f6390d3c2e9097e3af339756e56bf472c Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Fri, 20 Jun 2025 09:30:26 +0200 Subject: [PATCH 2/4] eventSelectionQa.cxx --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 9d9dc544b58..5b8ea870fae 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -448,7 +448,8 @@ struct EventSelectionQaTask { float multV0A = 0; float multV0C = 0; if (bc.has_fv0a()) { - for (unsigned int i = 0; i < bc.fv0a().amplitude().size(); ++i) { + auto fv0a = bc.fv0a(); + for (unsigned int i = 0; i < fv0a.amplitude().size(); ++i) { int ring = bc.fv0a().channel()[i] / 8; multRingV0A[ring] += bc.fv0a().amplitude()[i]; multV0A += bc.fv0a().amplitude()[i]; @@ -456,7 +457,8 @@ struct EventSelectionQaTask { } if (bc.has_fv0c()) { - for (unsigned int i = 0; i < bc.fv0c().amplitude().size(); ++i) { + auto fv0c = bc.fv0c(); + for (unsigned int i = 0; i < fv0c.amplitude().size(); ++i) { int ring = bc.fv0c().channel()[i] / 8; multRingV0C[ring] += bc.fv0c().amplitude()[i]; multV0C += bc.fv0c().amplitude()[i]; @@ -847,7 +849,8 @@ struct EventSelectionQaTask { histos.fill(HIST("hOrbitFV0"), orbit - orbitSOR); histos.fill(HIST("hBcFV0"), localBC); float multV0A = 0; - for (const auto& amplitude : bc.fv0a().amplitude()) { + auto fv0a = bc.fv0a(); + for (const auto& amplitude : fv0a.amplitude()) { multV0A += amplitude; } histos.fill(HIST("hMultV0Aall"), multV0A); @@ -1079,7 +1082,8 @@ struct EventSelectionQaTask { // FV0 float multV0A = 0; if (foundBC.has_fv0a()) { - for (const auto& amplitude : foundBC.fv0a().amplitude()) { + auto fv0a = foundBC.fv0a(); + for (const auto& amplitude : fv0a.amplitude()) { multV0A += amplitude; } } From cb26757a48bc897e4bd048be7261d9a7936befe7 Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Fri, 20 Jun 2025 09:32:02 +0200 Subject: [PATCH 3/4] flowZdcTask.cxx --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 3daec8cf2c7..90782f272b5 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -432,10 +432,11 @@ struct FlowZdcTask { float aT0A = 0., aT0C = 0., aV0A = 0.; if (foundBC.has_ft0()) { - for (const auto& amplitude : foundBC.ft0().amplitudeA()) { + auto ft0 = foundBC.ft0(); + for (const auto& amplitude : ft0.amplitudeA()) { aT0A += amplitude; } - for (const auto& amplitude : foundBC.ft0().amplitudeC()) { + for (const auto& amplitude : ft0.amplitudeC()) { aT0C += amplitude; } } else { @@ -443,7 +444,8 @@ struct FlowZdcTask { } histos.fill(HIST("hEventCounter"), EvCutLabel::TZero); if (foundBC.has_fv0a()) { - for (const auto& amplitude : foundBC.fv0a().amplitude()) { + auto fv0a = foundBC.fv0a(); + for (const auto& amplitude : fv0a.amplitude()) { aV0A += amplitude; } } else { From a8502f79975e13abdc6043728294f37806377af6 Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Fri, 20 Jun 2025 09:33:21 +0200 Subject: [PATCH 4/4] flowGfwTask.cxx --- PWGCF/Flow/Tasks/flowGfwTask.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwTask.cxx b/PWGCF/Flow/Tasks/flowGfwTask.cxx index e5854dcf43b..c03853c0f99 100644 --- a/PWGCF/Flow/Tasks/flowGfwTask.cxx +++ b/PWGCF/Flow/Tasks/flowGfwTask.cxx @@ -886,10 +886,11 @@ struct FlowGfwTask { double ft0mAmp = 0; if (foundBC.has_ft0()) { - for (const auto& amplitude : foundBC.ft0().amplitudeA()) { + auto ft0 = foundBC.ft0(); + for (const auto& amplitude : ft0.amplitudeA()) { ft0aAmp += amplitude; } - for (const auto& amplitude : foundBC.ft0().amplitudeC()) { + for (const auto& amplitude : ft0.amplitudeC()) { ft0cAmp += amplitude; } } else {