Skip to content
Snippets Groups Projects
Commit fd39d13e authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'main-rntuple-validation-update-20250113' into 'main'

PyJobTransforms: Fix RNTuple validation in main--dev3LCG

See merge request atlas/athena!77148
parents a5c18995 de3945a5
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
## @Package PyJobTransforms.trfValidateRootFile
# @brief Functionality to test a Root file for corruption
......@@ -8,6 +8,7 @@
# @todo The main() CLI should migrate to @c scripts and this module just implement functions
from functools import lru_cache
import sys, os
import logging
......@@ -19,6 +20,12 @@ from PyUtils.PoolFile import isRNTuple
msg = logging.getLogger(__name__)
@lru_cache(maxsize=1)
def getROOTVersion():
from Gaudi.Main import BootstrapHelper
bsh = BootstrapHelper()
return bsh.ROOT_VERSION
def checkBranch(branch):
msg.debug('Checking branch %s ...', branch.GetName())
......@@ -86,7 +93,10 @@ def checkNTupleEventWise(ntuple, printInterval = 150000):
for i in reader:
try:
entry = reader.GetModel().CreateEntry()
if getROOTVersion() >= (6, 33, 0):
entry = reader.CreateEntry()
else:
entry = reader.GetModel().CreateEntry()
reader.LoadEntry(i, entry)
except Exception as err:
msg.warning('Event %s of ntuple %s is corrupted: %s', i, reader.GetDescriptor().GetName(), err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment