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