From 1491a8c29c7daf57341954c284cc91a5a844fc5a Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Thu, 26 Nov 2026 13:22:37 +0100 Subject: [PATCH 1/3] Complete dictionary rootmaps with all public headers + include FairLogger in Generator.h Since the FairRoot simulation infrastructure moved into O2 (805a3d7c3a), some external generator macros fail when o2-sim-dpl-eventgen compiles them with either: "unknown type name 'TMCProcess'" followed by a cling segfault or "use of undeclared identifier 'info'" in macros using LOG(...). before FairRoot rootmap had no FairGenerator.h, so including it made cling parse automatically the entire payload of the software, which caused accidentally to pull cleanly VMC types and FairLogger. Now libO2FairRootBase lists the header correctly causing the side effect to be gone, and this needed to be fixed. --- Generators/include/Generators/Generator.h | 2 ++ cmake/AddRootDictionary.cmake | 15 +++++++++++++++ cmake/RunRootcling.cmake | 21 +++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Generators/include/Generators/Generator.h b/Generators/include/Generators/Generator.h index ac98b6f7b33a5..5a34ca9882a66 100644 --- a/Generators/include/Generators/Generator.h +++ b/Generators/include/Generators/Generator.h @@ -15,6 +15,8 @@ #define ALICEO2_EVENTGEN_GENERATOR_H_ #include "FairGenerator.h" +// Needed inclusion for the many external generators using LOG after FairRoot was included in O2 (07/2026) +#include #include "TParticle.h" #include "Generators/Trigger.h" #include diff --git a/cmake/AddRootDictionary.cmake b/cmake/AddRootDictionary.cmake index f088a86709910..fc28acd125788 100644 --- a/cmake/AddRootDictionary.cmake +++ b/cmake/AddRootDictionary.cmake @@ -140,6 +140,19 @@ function(add_root_dictionary target) set(pcmDeps) endif() + # Public headers of this dictionary. rootcling writes rootmap entries only for a few of them + # so RunRootcling.cmake adds the missing ones. Without this + # a ROOT macro including the header makes cling parse automatically the + # whole dictionary payload from inside the half-parsed header, failing with + # "unknown type name" / "incomplete type" errors and this can cause the interpreter to crash + set(rootmapHeaders) + foreach(h IN LISTS A_HEADERS) + if(h MATCHES "(^|/)include/(.+)$") + list(APPEND rootmapHeaders ${CMAKE_MATCH_2}) + endif() + endforeach() + string(REPLACE ";" "|" rootmapHeaders "${rootmapHeaders}") + if(A_EXTRA_PATCH) set(extraPatch -DPATCH=${CMAKE_CURRENT_LIST_DIR}/${A_EXTRA_PATCH}) else() @@ -163,6 +176,8 @@ function(add_root_dictionary target) "-DLD_LIBRARY_PATH=${LD_LIBRARY_PATH}" ${extraPatch} "-DARGS=${rootclingArgs}" + "-DROOTMAP=${rootmapFile}" + "-DROOTMAP_HEADERS=${rootmapHeaders}" -P ${O2_RUN_ROOTCLING_SCRIPT} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${pcmBase} ${pcmFile} diff --git a/cmake/RunRootcling.cmake b/cmake/RunRootcling.cmake index b2d7d74860f33..84a19e43bd9db 100644 --- a/cmake/RunRootcling.cmake +++ b/cmake/RunRootcling.cmake @@ -9,8 +9,9 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -# Runs rootcling, optionally appends PATCH to the generated dictionary, and -# turns the "Unused class rule" warning into an error. +# Runs rootcling, optionally appends PATCH to the generated dictionary, turns +# the "Unused class rule" warning into an error, and completes the rootmap with +# a "header" entry for each of ROOTMAP_HEADERS (see AddRootDictionary.cmake). # # rootcling only offers -failOnWarnings, which is all or nothing, so the # output still has to be inspected to single out that one warning. @@ -55,3 +56,19 @@ if(PATCH) file(READ ${PATCH} patchContent) file(APPEND ${DICTIONARY} "${patchContent}") endif() + +if(ROOTMAP AND ROOTMAP_HEADERS AND EXISTS ${ROOTMAP}) + cmake_policy(SET CMP0007 NEW) # keep empty rootmap lines as list elements + file(STRINGS ${ROOTMAP} rootmapLines) + string(REPLACE "|" ";" rootmapHeaders "${ROOTMAP_HEADERS}") + set(missing "") + foreach(h IN LISTS rootmapHeaders) + list(FIND rootmapLines "header ${h}" index) + if(index EQUAL -1) + string(APPEND missing "header ${h}\n") + endif() + endforeach() + if(missing) + file(APPEND ${ROOTMAP} "# Public headers of this dictionary not listed by rootcling\n${missing}") + endif() +endif() From 36161fef9fca24edd05b92642b4139b76d4be5c9 Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Thu, 26 Nov 2026 13:35:50 +0100 Subject: [PATCH 2/3] Fixed headers that cannot be parsed alone This was exposed by the complete rootmaps of the previous commit. Basically with every public header listed now, cling parses a header directly before the macro includes run. Many headers worked only because cling had read them once. --- .../Detectors/TPC/include/DataFormatsTPC/AltroSyncSignal.h | 5 +++++ .../EMCAL/calib/include/EMCALCalib/TriggerSTUErrorCounter.h | 5 +++++ .../ITS/simulation/include/ITSSimulation/ITSDataSimulator.h | 5 +++++ Detectors/TPC/qc/include/TPCQC/Tracks.h | 1 + .../ITS3/reconstruction/include/ITS3Reconstruction/IOUtils.h | 5 +++++ 5 files changed, 21 insertions(+) diff --git a/DataFormats/Detectors/TPC/include/DataFormatsTPC/AltroSyncSignal.h b/DataFormats/Detectors/TPC/include/DataFormatsTPC/AltroSyncSignal.h index 6dee49e4ed6c6..01ab9593c1eb0 100644 --- a/DataFormats/Detectors/TPC/include/DataFormatsTPC/AltroSyncSignal.h +++ b/DataFormats/Detectors/TPC/include/DataFormatsTPC/AltroSyncSignal.h @@ -12,6 +12,9 @@ /// \file AltroSyncSignal.h /// \brief Definition of the timebin from which syncronization starts +#ifndef ALICEO2_DATAFORMATSTPC_ALTROSYNCSIGNAL_H +#define ALICEO2_DATAFORMATSTPC_ALTROSYNCSIGNAL_H + #include "GPUCommonRtypes.h" namespace o2::tpc @@ -28,3 +31,5 @@ struct AltroSyncSignal { ClassDefNV(AltroSyncSignal, 1); }; } // namespace o2::tpc + +#endif // ALICEO2_DATAFORMATSTPC_ALTROSYNCSIGNAL_H diff --git a/Detectors/EMCAL/calib/include/EMCALCalib/TriggerSTUErrorCounter.h b/Detectors/EMCAL/calib/include/EMCALCalib/TriggerSTUErrorCounter.h index 38079676c60e8..9a7ad914ac9ba 100644 --- a/Detectors/EMCAL/calib/include/EMCALCalib/TriggerSTUErrorCounter.h +++ b/Detectors/EMCAL/calib/include/EMCALCalib/TriggerSTUErrorCounter.h @@ -8,6 +8,9 @@ // 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. +#ifndef ALICEO2_EMCAL_TRIGGERSTUERRORCOUNTER_H +#define ALICEO2_EMCAL_TRIGGERSTUERRORCOUNTER_H + #include #include #include @@ -80,3 +83,5 @@ class TriggerSTUErrorCounter } // namespace emcal } // namespace o2 + +#endif // ALICEO2_EMCAL_TRIGGERSTUERRORCOUNTER_H diff --git a/Detectors/ITSMFT/ITS/simulation/include/ITSSimulation/ITSDataSimulator.h b/Detectors/ITSMFT/ITS/simulation/include/ITSSimulation/ITSDataSimulator.h index c8bb9becbd2da..f8bd6c61f4cfb 100644 --- a/Detectors/ITSMFT/ITS/simulation/include/ITSSimulation/ITSDataSimulator.h +++ b/Detectors/ITSMFT/ITS/simulation/include/ITSSimulation/ITSDataSimulator.h @@ -13,6 +13,9 @@ /// \brief Infrastructure to simulate ALPIDE chip data. /// \author knaumov@cern.ch +#ifndef ALICEO2_ITSSIMULATION_ITSDATASIMULATOR_H +#define ALICEO2_ITSSIMULATION_ITSDATASIMULATOR_H + #include "ITSMFTBase/SegmentationAlpide.h" #include "ITSMFTReconstruction/PixelData.h" @@ -52,3 +55,5 @@ class ITSDataSimulator } // namespace itsmft } // namespace o2 + +#endif // ALICEO2_ITSSIMULATION_ITSDATASIMULATOR_H diff --git a/Detectors/TPC/qc/include/TPCQC/Tracks.h b/Detectors/TPC/qc/include/TPCQC/Tracks.h index ff215b68ce3b1..1ba4ea11ece4f 100644 --- a/Detectors/TPC/qc/include/TPCQC/Tracks.h +++ b/Detectors/TPC/qc/include/TPCQC/Tracks.h @@ -27,6 +27,7 @@ #include "TH1.h" #include "TH1F.h" #include "TH2F.h" +#include "MathUtils/Cartesian.h" namespace o2 { diff --git a/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/IOUtils.h b/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/IOUtils.h index 05ec269a89219..b62ccb38765c1 100644 --- a/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/IOUtils.h +++ b/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/IOUtils.h @@ -8,6 +8,9 @@ // 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. +#ifndef ALICEO2_ITS3RECONSTRUCTION_IOUTILS_H +#define ALICEO2_ITS3RECONSTRUCTION_IOUTILS_H + #include #include "SimulationDataFormat/MCTruthContainer.h" #include "ReconstructionDataFormats/BaseCluster.h" @@ -87,3 +90,5 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf, const dataformats::MCTruthContainer* mcLabels = nullptr); } // namespace its3::ioutils } // namespace o2 + +#endif // ALICEO2_ITS3RECONSTRUCTION_IOUTILS_H From 47cec55e16669f6aff7663c5e2f5cbb1382a4bc5 Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Thu, 26 Nov 2026 15:24:35 +0100 Subject: [PATCH 3/3] Include the logger where cling can see it in ZDC CreateSimCondition macros In the other macros ROOT name lookups parse libraries that bring in the logger, but these macros are missing it. --- Detectors/ZDC/macro/CreateSimCondition.C | 2 +- Detectors/ZDC/macro/CreateSimCondition_pp.C | 2 +- cmake/AddRootDictionary.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Detectors/ZDC/macro/CreateSimCondition.C b/Detectors/ZDC/macro/CreateSimCondition.C index 9f29aafc979bb..94e1aa478e3a5 100644 --- a/Detectors/ZDC/macro/CreateSimCondition.C +++ b/Detectors/ZDC/macro/CreateSimCondition.C @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#if !defined(__CLING__) || defined(__ROOTCLING__) #include "Framework/Logger.h" +#if !defined(__CLING__) || defined(__ROOTCLING__) #include "CCDB/CcdbApi.h" #include #include diff --git a/Detectors/ZDC/macro/CreateSimCondition_pp.C b/Detectors/ZDC/macro/CreateSimCondition_pp.C index f38634ef18fac..41b14d1c1964e 100644 --- a/Detectors/ZDC/macro/CreateSimCondition_pp.C +++ b/Detectors/ZDC/macro/CreateSimCondition_pp.C @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#if !defined(__CLING__) || defined(__ROOTCLING__) #include "Framework/Logger.h" +#if !defined(__CLING__) || defined(__ROOTCLING__) #include "CCDB/CcdbApi.h" #include #include diff --git a/cmake/AddRootDictionary.cmake b/cmake/AddRootDictionary.cmake index fc28acd125788..2b8c752b324cc 100644 --- a/cmake/AddRootDictionary.cmake +++ b/cmake/AddRootDictionary.cmake @@ -140,7 +140,7 @@ function(add_root_dictionary target) set(pcmDeps) endif() - # Public headers of this dictionary. rootcling writes rootmap entries only for a few of them + # Public headers of this dictionary. rootcling writes rootmap entries only for a few of them # so RunRootcling.cmake adds the missing ones. Without this # a ROOT macro including the header makes cling parse automatically the # whole dictionary payload from inside the half-parsed header, failing with