6 from __future__
import print_function
10 rf = ROOT.TFile.Open(fname,
'READ')
11 if not rf
or not rf.IsOpen():
12 print(
' %s is empty or not accessible' % fname)
14 if rf.TestBit(ROOT.TFile.kRecovered):
15 print(
" %s is recovered. It means it was corrupt" % fname)
17 cleancache = ROOT.gROOT.MustClean(); ROOT.gROOT.SetMustClean(
False)
19 print(
"dolsr returned %s "%(RV))
21 ROOT.gROOT.SetMustClean(cleancache)
25 resultdir = dir.Get(
'Results'); statusobj =
None
27 statusobj = resultdir.Get(
'Status')
29 l = statusobj.GetListOfKeys()
31 keys = dir.GetListOfKeys()
35 keyClass=ROOT.TClass.GetClass(key.GetClassName())
36 if keyClass.InheritsFrom(
'TDirectory'):
37 dirobj = key.ReadObj()
38 resultdir = dirobj.Get(
'Results'); statusobj =
None
40 statusobj = resultdir.Get(
'Status')
42 if name[-1] ==
'_' and resultdir:
43 hist = dir.Get(name[:-1])
44 subkeys = resultdir.GetListOfKeys()
45 for subkey
in subkeys:
46 ressub = subkey.GetName()
47 if ressub
not in (
'Status',
'Reference',
'ResultObject')
and ROOT.TClass.GetClass(subkey.GetClassName()).InheritsFrom(
'TDirectory'):
48 subObj=subkey.ReadObj()
49 l = subObj.GetListOfKeys()
52 l = statusobj.GetListOfKeys()
58 elif keyClass.InheritsFrom(
"TTree"):
61 print(
"WARNING TTree Object \"%s\" in file:directory \"%s\" is corrupt "\
62 "keylen=%s numbytes=%s objlen=%s fseekkey=%s"%(name,dir.GetPath(),key.GetKeylen(),
63 key.GetNbytes(),key.GetObjlen(),key.GetSeekKey()))
66 nentries=currObj.GetEntriesFast()
71 for j
in range(nentries):
72 ientry=currObj.LoadTree(j)
75 nb=currObj.GetEntry(j)
84 print(
"WARNING Object \"%s\" in file:directory \"%s\" is corrupt "\
85 "keylen=%s numbytes=%s objlen=%s fseekkey=%s"%(name,dir.GetPath(),key.GetKeylen(),
86 key.GetNbytes(),key.GetObjlen(),key.GetSeekKey()))
94 if __name__ ==
"__main__" :