ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
testingMacros
InputScripts
Prerec2012
Prerec2012/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
print
key, type
34
if
key.endswith(type) :
35
jettype = type
36
foundJetType =
True
37
if
not
foundJetType :
38
print
"No jet type matches"
39
continue
40
if
jettype
not
in
histos :
41
print
"Adding extra dict..."
42
histos[jettype] = {}
43
44
# Only keep things for which we do not have a more current version.
45
systname = key.replace(
"_"
+jettype,
""
)
46
47
histo = systematicFile.Get(key)
48
histo.SetDirectory(0)
49
histos[jettype][systname] = histo
50
51
# Done, return dictionary of histos
52
return
histos
53
54
55
56
Generated on
for ATLAS Offline Software by
1.17.0