Skip to content

Fix checkSG.py: decode b-string SG keys

Oleg Kuprash requested to merge okuprash/athena:fix_checkSG into main

In main, when running checkSG.py over a recent AOD, the script fails with

[okuprash@lxplus906 okuprash]$ checkSG.py /eos/atlas/atlastier0/rucio//data24_13p6TeV/physics_Main/00483398/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248._lb0200._0001.1
## checking [/eos/atlas/atlastier0/rucio//data24_13p6TeV/physics_Main/00483398/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248._lb0200._0001.1]...
================================================================================
                          Container type | StoreGate keys
-----------------------------------------+--------------------------------------
## Caught exception [<class 'TypeError'>] !!
## What: sequence item 0: expected str instance, string found
<class 'TypeError'>
sequence item 0: expected str instance, string found
Traceback (most recent call last):
  File "/cvmfs/atlas-nightlies.cern.ch/repo/sw/main_Athena_x86_64-el9-gcc13-opt/2024-09-03T2101/Athena/25.0.16/InstallArea/x86_64-el9-gcc13-opt/python/PyUtils/scripts/check_sg.py", line 60, in main
    print ("%40s%s%-40s" % (name, " | ", ', '.join(sorted(sgkeys))))
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 0: expected str instance, string found
## Bye.

The reason is that some of the sgkeys are b-strings, e.g. b'AllCalo', coming from C++ cppyy.gbl.std.string, while some other sgkeys are python strings, therefore sorting is not working.
This MR fixes the script by decoding b-strings to strings before sorting.
After the fix, the script is working as expected:

[okuprash@lxplus9115 run]$ checkSG.py /eos/atlas/atlastier0/rucio//data24_13p6TeV/physics_Main/00483398/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248._lb0200._0001.1
## checking [/eos/atlas/atlastier0/rucio//data24_13p6TeV/physics_Main/00483398/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248/data24_13p6TeV.00483398.physics_Main.merge.AOD.f1506_m2248._lb0200._0001.1]...
================================================================================
                          Container type | StoreGate keys
-----------------------------------------+--------------------------------------
                       CaloCellContainer | AllCalo
            CaloClusterCellLinkContainer | CaloCalTopoClusters_links, ForwardElectronClusters_links, InDetLargeD0TrackParticlesAssociatedClusters_links, InDetTrackParticlesAssociatedClusters_links, LRTegammaClusters_links, MuonClusterCollection_links, TauPi0Clusters_EleRM_links, TauPi0Clusters_links, TauShotClusters_EleRM_links, TauShotClusters_links, egammaClusters_links
                              DataHeader | StreamAOD
...
                xAOD::jFexTowerContainer | L1_jFexDataTowers
================================================================================
## Bye.

Merge request reports

Loading