This script simply takes a ROOT file as input,
reads the index_ref for all events in the file
and makes sure each event has a unique value.
Otherwise, it raises an error...
Definition at line 9 of file checkIndexRefs.py.
9 def main(infile, intree="CollectionTree"):
11 This script simply takes a ROOT file as input,
12 reads the index_ref for all events in the file
13 and makes sure each event has a unique value.
14 Otherwise, it raises an error...
17 logging.info(f
"== Using input file {infile} ==")
19 f = ROOT.TFile(infile)
21 t.SetBranchStatus(
"*", 0)
22 t.SetBranchStatus(
"index_ref", 1)
25 nentries = t.GetEntries()
29 for idx
in range(nentries):
31 if hasattr(t,
'index_ref'):
33 if iref
not in indices:
38 logging.error(
"Cannot read index_ref!")
41 nindices = len(indices)
44 if nindices == nentries:
45 logging.info(f
"== Total number of keys is {nindices} vs"
46 f
" total number of events is {nentries} ==")
47 logging.info(
"All good!")
53 offset = key - ( pid << 32 )
54 logging.warning(f
" >> {key} (pid : {pid}, offset : {offset})"
55 f
" is repeated {indices[key]} times...")
56 logging.error(f
"== Total number of keys is {nindices} vs"
57 f
" total number of events is {nentries} ==")
58 logging.error(
"The test FAILED!")