4 from array
import array
8 import ProviderHistoHelpers
13 return [key.GetName()
for key
in gDirectory.GetListOfKeys()]
14 TFile.GetKeyNames = GetKeyNames
16 jetDefList = [
'AntiKt4Topo_EMJES']
21 for jetDef
in jetDefList :
23 inFile = TFile(fileName,
"READ")
24 uncNames = [
"SingleParticle_HighPt"]
25 jetCollections = {
"AntiKt4EMTopo" :
"AntiKt4Topo_EMJES"}
26 for name
in uncNames :
27 for jetCollection
in jetCollections.keys() :
28 getJetType = jetCollections[jetCollection]
29 fetchName = name+
"_"+getJetType
30 hist = inFile.Get(fetchName)
32 histos[jetCollections[jetCollection]][name] = hist
37 if not dirName.endswith(
"/"):
38 dirName = dirName +
"/"
41 emFileList =
sorted(glob.glob(dirName+
"EM*/*.root"))
42 lcFileList =
sorted(glob.glob(dirName+
"LC*/*.root"))
43 if len(emFileList) != 1:
44 print "Found a number of EM root files not equal to 1 in dir:",dirName
46 if len(lcFileList) != 1:
47 print "Found a number of LC root files not equal to 1 in dir:",dirName
49 emFile = TFile(emFileList[0],
"READ")
50 lcFile = TFile(lcFileList[0],
"READ")
53 for aJetDef
in jetDefList:
57 if "EMJES" in aJetDef:
59 elif "LCJES" in aJetDef:
62 print "Unexpected jet def:",aJetDef
65 for histName
in rootFile.GetKeyNames():
66 if aJetDef
not in histName:
continue
67 histo = rootFile.Get(histName)
69 print "Failed to get histogram:",histName
71 histo.SetName(histName+
"_1D")
74 histos[aJetDef][re.sub(
"_%s"%(aJetDef),
"",histName)].
SetDirectory(0)