2 from array
import array
6 import ProviderHistoHelpers
11 return [key.GetName()
for key
in gDirectory.GetListOfKeys()]
12 TFile.GetKeyNames = GetKeyNames
14 jetDefList = [
'AntiKt4Topo_EMJES',
"AntiKt4PFlow_EMJES"]
19 for jetDef
in jetDefList :
21 inFile = TFile(fileName,
"READ")
22 uncNames = [
"SingleParticle_HighPt"]
23 jetCollections = {
"AntiKt4EMTopo" :
"AntiKt4Topo_EMJES",
"AntiKt4EMPFlow" :
"AntiKt4PFlow_EMJES"}
24 for name
in uncNames :
25 for jetCollection
in jetCollections.keys() :
26 getJetType = jetCollections[jetCollection]
27 fetchName = name+
"_"+getJetType
28 hist = inFile.Get(fetchName)
29 print "retrieved",fetchName
31 histos[jetCollections[jetCollection]][name] = hist
37 if os.path.isdir(dirName):
38 fileList =
sorted(glob.glob(dirName+
"*.root"))
39 if len(fileList) > 1 :
43 file = TFile(fileList[0],
"READ")
45 file = TFile(dirName,
"READ")
60 for aJetDef
in jetDefList:
74 for histName
in rootFile.GetKeyNames():
75 if aJetDef
not in histName:
continue
76 histo = rootFile.Get(histName)
78 print "Failed to get histogram:",histName
80 histo.SetName(histName+
"_1D")
83 histos[aJetDef][re.sub(
"_%s"%(aJetDef),
"",histName)].
SetDirectory(0)