42 def ListFromFile(filename="FewEventsLumi.pool.root", label = "LumiBlockCollection_p1_LumiBlocks", metadatatree="MetaData"):
43 """ Returns a list of RunLumiBlock ranges (stored as python tuples of type PyRunLumiP1) from the named file.
45 The file should have metadata stored internally as a ROOT tree
46 (named 'Stream' by default). It can be a POOL file or other generic
49 Note: This function does not access the MetaDataStore. Please use
50 a LumiBlock AlgTool for that.
54 a = ROOT.TFile.Open(filename)
58 T = a.Get(metadatatree)
59 T.SetBranchStatus(
"*",0)
60 T.SetBranchStatus(label,1)
61 T.SetBranchStatus(
"vector<LumiBlockRange_p1>",1)
62 T.SetBranchStatus(
"vector<LumiBlockRange_p1>.m_start",1)
63 T.SetBranchStatus(
"vector<LumiBlockRange_p1>.m_stop",1)
65 except AttributeError:
66 print(
"There is no tree named", metadatatree,
"in file" ,filename)
67 if a.__repr__() !=
'None':
68 print(8*
'--',
"Contents:", 8*
'--')
77 iterRange = getattr( T, label ).
size()
78 except AttributeError
as a:
80 print(
"The tree", metadatatree,
"in file" ,filename,
"has no vector<LumiBlockRange_p1>.m_start branch, so I don't understand its format.")
82 for i
in range(iterRange):
83 LumiRangeList += [ (PyRunLumiP1( getattr( T, label )[i].m_start ),PyRunLumiP1( getattr( T, label )[i].m_stop ))]
84 return [ x
for x
in LumiRangeList ]