ATLAS Offline Software
Classes | Functions | Variables
python.LumiQuery Namespace Reference

Classes

class  PyRunLumiP1
 

Functions

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

Variables

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

Function Documentation

◆ ListFromFile()

def 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 42 of file LumiQuery.py.

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

◆ PrintList()

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

Definition at line 87 of file LumiQuery.py.

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

Variable Documentation

◆ ll1

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

Definition at line 95 of file LumiQuery.py.

◆ ll2

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

Definition at line 96 of file LumiQuery.py.

◆ LumiRangeList

list python.LumiQuery.LumiRangeList = []

Definition at line 10 of file LumiQuery.py.

python.LumiQuery.ListFromFile
def ListFromFile(filename="FewEventsLumi.pool.root", label="LumiBlockCollection_p1_LumiBlocks", metadatatree="MetaData")
Definition: LumiQuery.py:42
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.LumiQuery.PrintList
def PrintList()
Definition: LumiQuery.py:87