Skip to content

Commit

Permalink
Abort in case input file does not contain events ttree (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt committed Sep 16, 2024
1 parent 54e8495 commit e032e91
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ def get_entries(inpath: str) -> int:
'''
nevents = None
with ROOT.TFile(inpath, 'READ') as infile:
tt = infile.Get("events")
nevents = tt.GetEntries()
try:
nevents = infile.Get("events").GetEntries()
except AttributeError:
LOGGER.error('Input file is missing "events" TTree!\nAborting...')
sys.exit(3)
return nevents


Expand Down

0 comments on commit e032e91

Please sign in to comment.