ATLAS Offline Software
Loading...
Searching...
No Matches
python.LumiQuery Namespace Reference

Classes

class  PyRunLumiP1

Functions

 ListFromFile (filename="FewEventsLumi.pool.root", label="LumiBlockCollection_p1_LumiBlocks", metadatatree="MetaData")
 PrintList ()

Variables

list LumiRangeList = []
 ll1 = ListFromFile( sys.argv[1], "LumiBlockCollection_p1_LumiBlocks", "MetaData" )
 ll2 = ListFromFile( sys.argv[1], "LumiBlockCollection_p1_IncompleteLumiBlocks", "MetaData" )

Function Documentation

◆ ListFromFile()

python.LumiQuery.ListFromFile ( filename = "FewEventsLumi.pool.root",
label = "LumiBlockCollection_p1_LumiBlocks",
metadatatree = "MetaData" )
 Returns a list of RunLumiBlock ranges (stored as python tuples of type PyRunLumiP1) from the named file.

The file should have metadata stored internally as a ROOT tree
(named 'Stream' by default). It can be a POOL file or other generic
ntuple file.

Note: This function does not access the MetaDataStore.  Please use
a LumiBlock AlgTool for that.

Definition at line 41 of file LumiQuery.py.

41def 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.
43
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
46 ntuple file.
47
48 Note: This function does not access the MetaDataStore. Please use
49 a LumiBlock AlgTool for that.
50 """
51
52 import ROOT
53 a = ROOT.TFile.Open(filename)
54 global LumiRangeList
55 LumiRangeList = []
56 try:
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)
63 T.GetEntry(0)
64 except AttributeError:
65 print("There is no tree named", metadatatree, "in file" ,filename)
66 if a.__repr__() != 'None':
67 print(8*'--', "Contents:", 8*'--')
68 a.ls()
69 return
70
71
75 try:
76 iterRange = getattr( T, label ).size() #T.GetLeaf("vector<LumiBlockRange_p1>.m_start").GetLen()
77 except AttributeError as a:
78 print(a)
79 print("The tree", metadatatree, "in file" ,filename, "has no vector<LumiBlockRange_p1>.m_start branch, so I don't understand its format.")
80 return
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 ]
84
85
void print(char *figname, TCanvas *c1)

◆ PrintList()

python.LumiQuery.PrintList ( )
An example function. It prints the list returned by ListFromFile. 

Definition at line 86 of file LumiQuery.py.

86def PrintList():
87 """ An example function. It prints the list returned by ListFromFile. """
88 for (x,y) in LumiRangeList: print(x, 'to', y)
89
90

Variable Documentation

◆ ll1

python.LumiQuery.ll1 = ListFromFile( sys.argv[1], "LumiBlockCollection_p1_LumiBlocks", "MetaData" )

Definition at line 93 of file LumiQuery.py.

◆ ll2

python.LumiQuery.ll2 = ListFromFile( sys.argv[1], "LumiBlockCollection_p1_IncompleteLumiBlocks", "MetaData" )

Definition at line 94 of file LumiQuery.py.

◆ LumiRangeList

list python.LumiQuery.LumiRangeList = []

Definition at line 9 of file LumiQuery.py.