ATLAS Offline Software
Functions
ParseCurrentFile Namespace Reference

Functions

def GetKeyNames (self, dir="")
 
def ReadCurrentHistograms (aSystFile, newjetsdict=[])
 

Function Documentation

◆ GetKeyNames()

def ParseCurrentFile.GetKeyNames (   self,
  dir = "" 
)

Definition at line 10 of file ICHEP2016/ParseCurrentFile.py.

10 def GetKeyNames(self,dir=""):
11  self.cd(dir)
12  return [key.GetName() for key in gDirectory.GetListOfKeys()]
13 TFile.GetKeyNames = GetKeyNames
14 

◆ ReadCurrentHistograms()

def ParseCurrentFile.ReadCurrentHistograms (   aSystFile,
  newjetsdict = [] 
)

Definition at line 15 of file ICHEP2016/ParseCurrentFile.py.

15 def ReadCurrentHistograms(aSystFile,newjetsdict=[]):
16 
17  # Dictionary to translate from Bogdan's names to provider names
18  useJetCollections = ["AntiKt4EMTopo","AntiKt4LCTopo"]
19 
20  # Just one file here with everything in it.
21  systematicFile = TFile(aSystFile,"READ")
22 
23  if newjetsdict!=[] :
24  useJetCollections = newjetsdict
25 
26  histos = {}
27  for key in systematicFile.GetKeyNames() :
28 
29  # Only keep things of the jet collections we are using.
30  foundJetType = False
31  print "looping through useJetCollections",useJetCollections
32  for type in useJetCollections :
33  if key.endswith(type) :
34  jettype = type
35  foundJetType = True
36  if not foundJetType :
37  print "No jet type matches"
38  continue
39  if jettype not in histos :
40  print "Adding extra dict..."
41  histos[jettype] = {}
42 
43  # Only keep things for which we do not have a more current version.
44  systname = key.replace("_"+jettype,"")
45 
46  histo = systematicFile.Get(key)
47  histo.SetDirectory(0)
48  histos[jettype][systname] = histo
49 
50  # Done, return dictionary of histos
51  return histos
52 
53 
54 
55 
ParseCurrentFile.ReadCurrentHistograms
def ReadCurrentHistograms(aSystFile, newjetsdict=[])
Definition: ICHEP2016/ParseCurrentFile.py:15
ParseCurrentFile.GetKeyNames
def GetKeyNames(self, dir="")
Definition: ICHEP2016/ParseCurrentFile.py:10