Skip to content

cppjit problem with enum #24176

Closed
Closed

Description

@elmsheus

Check duplicate issues.

  • Checked for duplicates

Description

As discussed in today's LIM meeting, ATLAS has problems in python runtime with the new cppjit and C++ enums. The ATLAS internal ticket is at https://its.cern.ch/jira/browse/ATEAM-1198 and examples of runtime tracebacks of the dev3/AnalysisBase nightlies are at https://bigpanda.cern.ch/testsview/?nightly=main--dev3LCG_AnalysisBase_x86_64-el9-gcc15-opt&rel=2026-11-15T2100&ar=x86_64-el9-gcc15-opt&proj=AnalysisBase and https://bigpanda.cern.ch/testsview/?nightly=main--dev4LCG_Athena_x86_64-el9-gcc15-opt&rel=2026-11-15T2100&ar=x86_64-el9-gcc15-opt&proj=Athena (again probably ATLAS internal).

One example traceback at https://atlas-sw-build-logs.web.cern.ch/nightlywww/LCGWebArea/ardoc_web_areamaindev3LCG64BE9G15AnalysisBaseOpt/ARDOC_TestLog_2026-11-15T2100/PhysicsAnalysis_Algorithms_AnalysisAlgorithmsConfig___AnalysisAlgorithmsConfigConf__AnalysisAlgorithmsConfigTest__m.html:

[..]
Comparing config sequences from the block and textconfiguration methods
Traceback (most recent call last):
  File "/build1/atnight/localbuilds/nightlies/main--dev3LCG/athena/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/ConfigText_unitTest.py", line 561, in <module>
    compareTextBuilder(textConfig, checkOrder=checkOrder)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build1/atnight/localbuilds/nightlies/main--dev3LCG/athena/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/ConfigText_unitTest.py", line 55, in compareTextBuilder
    config = TextConfig()
  File "/build1/atnight/localbuilds/nightlies/main--dev3LCG/build/build/AnalysisBase/x86_64-el9-gcc15-opt/python/AnalysisAlgorithmsConfig/ConfigText.py", line 51, in __init__
    self.addDefaultAlgs()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/build1/atnight/localbuilds/nightlies/main--dev3LCG/build/build/AnalysisBase/x86_64-el9-gcc15-opt/python/AnalysisAlgorithmsConfig/ConfigFactory.py", line 305, in addDefaultAlgs
    from EgammaAnalysisAlgorithms.ElectronAnalysisConfig import ElectronCalibration
  File "/build1/atnight/localbuilds/nightlies/main--dev3LCG/build/build/AnalysisBase/x86_64-el9-gcc15-opt/python/EgammaAnalysisAlgorithms/ElectronAnalysisConfig.py", line 18, in <module>
    from xAODEgamma.xAODEgammaParameters import xAOD
  File "/build1/atnight/localbuilds/nightlies/main--dev3LCG/build/build/AnalysisBase/x86_64-el9-gcc15-opt/python/xAODEgamma/xAODEgammaParameters.py", line 8, in <module>
    from ROOT.xAOD.EgammaParameters import EgammaType  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'EgammaParameters'

Fix it with https://gitlab.cern.ch/atlas/athena/-/blob/main/Event/xAOD/xAODEgamma/python/xAODEgammaParameters.py?ref_type=heads

-from ROOT.xAOD.EgammaParameters import EgammaType  # noqa: F401 
+from RootUtils.LoadEnumHeader import loadEnumHeader
+loadEnumHeader('xAODEgamma/EgammaEnums.h')
+from ROOT.xAOD.EgammaParameters import EgammaType  # noqa: F401

or cleaner using https://gitlab.cern.ch/atlas/athena/-/blob/main/Control/RootUtils/python/LoadEnumHeader.py?ref_type=heads

+from RootUtils.LoadEnumHeader import loadEnumHeader
+loadEnumHeader('xAODEgamma/EgammaEnums.h')
+from ROOT.xAOD.EgammaParameters import EgammaType  # noqa: F401

Examples of enum header files we have to treat like this:

There will be more, but we have not yet gone through all of them.

No stand-anlone reproducer add here yet - please let me know if you'd need one in the ATLAS environment.

Reproducer

No stand-anlone reproducer add here yet - please let me know if you'd need one in the ATLAS environment.

ROOT version

6.42-pre, and ROOT versions in dev4 and dev3 LCG nightlies

Installation method

dev3/dev4 nightlies

Operating system

Linux

Additional context

No response

Activity

  1. self-assigned this
    on Nov 16, 2026
  2. Nowakus commented on Nov 16, 2026

    @Nowakus
    Contributor

    So here is a simple reproducer that will show the following results, depending on the ROOT version:
    (tar files are not supported apparently, so I put it here: /afs/cern.ch/user/m/mnowak/public/enums.tar)

    % root --version
    ROOT Version: 6.40.02
    % ./compile.sh
    % source env.sh
    % python
    Python 3.13.11 (main, Feb 3 2026, 13:34:10) [GCC 15.2.0] on linux

    import ROOT
    ROOT.xAOD.EgammaParameters.MyEnum.electron
    (xAOD::EgammaParameters::MyEnum::xAOD::EgammaParameters::MyEnum::electron) : (unsigned int) 0

    % root --version
    ROOT Version: 6.43.01
    % ./compile.sh
    % source env.sh
    % python
    Python 3.14.10 (main, Nov 10 2026, 12:16:02) [GCC 16.1.0] on linux

    import ROOT
    ROOT.xAOD.EgammaParameters.MyEnum.electron
    Traceback (most recent call last):
    File "", line 1, in
    ROOT.xAOD.EgammaParameters.MyEnum.electron
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: <namespace cppjit.gbl.xAOD.EgammaParameters at 0x8897610> has no attribute 'MyEnum'. Full details:
    type object 'EgammaParameters' has no attribute 'MyEnum'
    'MyEnum' is not a known C++ class
    'MyEnum' is not a known C++ template
    'MyEnum' is not a known C++ enum

  3. guitargeek commented on Nov 17, 2026

    @guitargeek
    Contributor

    I have suggested a minimal fix:

    I'll try to get it into ROOT 6.42, so that you don't have to apply the workaround!

  4. added 2 commits that reference this issue on Nov 17, 2026
    de2693b
    cc0c244
  5. added 2 commits that reference this issue on Nov 18, 2026
    c1b72e5
    1473e79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions