18def ReadHighPtHistograms(dirName):
19 if not dirName.endswith("/"):
20 dirName = dirName + "/"
21
22
23 emFileList = sorted(glob.glob(dirName+"EM*/*.root"))
24 lcFileList = sorted(glob.glob(dirName+"LC*/*.root"))
25 if len(emFileList) != 1:
26 print "Found a number of EM root files not equal to 1 in dir:",dirName
27 return None
28 if len(lcFileList) != 1:
29 print "Found a number of LC root files not equal to 1 in dir:",dirName
30 return None
31 emFile = TFile(emFileList[0],"READ")
32 lcFile = TFile(lcFileList[0],"READ")
33
34 histos = {}
35 for aJetDef in jetDefList:
36 histos[aJetDef] = {}
37
38 rootFile = None
39 if "EMJES" in aJetDef:
40 rootFile = emFile
41 elif "LCJES" in aJetDef:
42 rootFile = lcFile
43 else:
44 print "Unexpected jet def:",aJetDef
45 return None
46
47 for histName in rootFile.GetKeyNames():
48 if aJetDef not in histName: continue
49 histo = rootFile.Get(histName)
50 if histo is None:
51 print "Failed to get histogram:",histName
52 return None
53 histo.SetName(histName+"_1D")
54
56 histos[aJetDef][re.sub("_%s"%(aJetDef),"",histName)].SetDirectory(0)
57
58 lcFile.Close()
59 emFile.Close()
60
61
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
85
86 return histos
87
ConvertPtHistoToProviderHisto(histo1D, histoName)