ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
testingMacros
InputScripts
ICHEP2016
ICHEP2016/ParseCurrentFile.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3
from
ROOT
import
*
4
from
array
import
array
5
import
glob
6
import
re
7
import
math
8
import
ProviderHistoHelpers
9
10
def
GetKeyNames
(self,dir=""):
11
self.cd(dir)
12
return
[key.GetName()
for
key
in
gDirectory.GetListOfKeys()]
13
TFile.GetKeyNames = GetKeyNames
14
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
ReadCurrentHistograms(aSystFile, newjetsdict=[])
Definition
ICHEP2016/ParseCurrentFile.py:15
ParseCurrentFile.GetKeyNames
GetKeyNames
Definition
ICHEP2016/ParseCurrentFile.py:13
Generated on
for ATLAS Offline Software by
1.17.0