4 from array
import array
8 import ProviderHistoHelpers
11 SystematicNameDictionary = {
12 'gammajetdphi' :
'Gjet_dPhi',
13 'gammajetgenerator' :
'Gjet_Generator',
14 'gammajetoutofcone' :
'Gjet_OOC',
15 'gammajetphscalemat' :
'Gjet_GamESmaterial',
16 'gammajetphscaleps' :
'Gjet_GamESpresampler',
17 'gammajetphscalez' :
'Gjet_GamESZee',
18 'gammajetphsmear' :
'Gjet_GamEsmear',
19 'gammajetpurity' :
'Gjet_Purity',
20 'gammajetstat1' :
'Gjet_Stat1',
21 'gammajetstat2' :
'Gjet_Stat2',
22 'gammajetstat3' :
'Gjet_Stat3',
23 'gammajetstat4' :
'Gjet_Stat4',
24 'gammajetstat5' :
'Gjet_Stat5',
25 'gammajetstat6' :
'Gjet_Stat6',
26 'gammajetstat7' :
'Gjet_Stat7',
27 'gammajetstat8' :
'Gjet_Stat8',
28 'gammajetstat9' :
'Gjet_Stat9',
29 'gammajetstat10' :
'Gjet_Stat10',
30 'gammajetstat11' :
'Gjet_Stat11',
31 'gammajetstat12' :
'Gjet_Stat12',
32 'gammajetstat13' :
'Gjet_Stat13',
33 'gammajetsubleadingjet' :
'Gjet_Veto',
34 'mjbalpha' :
'MJB_Alpha',
35 'mjbbeta' :
'MJB_Beta',
36 'mjbmodelling' :
'MJB_Fragmentation',
37 'mjbptasymm' :
'MJB_Asym',
38 'mjbptthreshold' :
'MJB_Threshold',
39 'mjbstat1' :
'MJB_Stat1',
40 'mjbstat2' :
'MJB_Stat2',
41 'mjbstat3' :
'MJB_Stat3',
42 'mjbstat4' :
'MJB_Stat4',
43 'mjbstat5' :
'MJB_Stat5',
44 'mjbstat6' :
'MJB_Stat6',
45 'mjbstat7' :
'MJB_Stat7',
46 'mjbstat8' :
'MJB_Stat8',
47 'mjbstat9' :
'MJB_Stat9',
48 'mjbstat10' :
'MJB_Stat10',
49 'mjbstat11' :
'MJB_Stat11',
50 'zjetdphi' :
'Zjet_dPhi',
51 'zjetescalemat' :
'Zjet_ElecESmaterial',
52 'zjetescaleps' :
'Zjet_ElecESpresampler',
53 'zjetescalez' :
'Zjet_ElecESZee',
54 'zjetesmear' :
'Zjet_ElecEsmear',
55 'zjetgenerator' :
'Zjet_MC',
56 'zjetjvf' :
'Zjet_JVF',
57 'zjetmuscale' :
'Zjet_MuScale',
58 'zjetmusmearid' :
'Zjet_MuSmearID',
59 'zjetmusmearms' :
'Zjet_MuSmearMS',
60 'zjetoutofcone' :
'Zjet_KTerm',
61 'zjetstat1' :
'Zjet_Stat1',
62 'zjetstat2' :
'Zjet_Stat2',
63 'zjetstat3' :
'Zjet_Stat3',
64 'zjetstat4' :
'Zjet_Stat4',
65 'zjetstat5' :
'Zjet_Stat5',
66 'zjetstat6' :
'Zjet_Stat6',
67 'zjetstat7' :
'Zjet_Stat7',
68 'zjetstat8' :
'Zjet_Stat8',
69 'zjetstat9' :
'Zjet_Stat9',
70 'zjetstat10' :
'Zjet_Stat10',
71 'zjetstat11' :
'Zjet_Stat11',
72 'zjetsubleadingjet' :
'Zjet_Veto'
76 'EMJES_R4' :
'AntiKt4Topo_EMJES',
77 'EMJES_R6' :
'AntiKt6Topo_EMJES',
78 'LCJES_R4' :
'AntiKt4Topo_LCJES',
79 'LCJES_R6' :
'AntiKt6Topo_LCJES'
83 if not dirName.endswith(
"/"):
84 dirName = dirName +
"/"
88 subDirs =
sorted(glob.glob(dirName+
"*"))
89 for aSubDirName
in subDirs:
92 for aDirDef,aJetDef
in jetDefDict.iteritems():
93 if aDirDef
in aSubDirName:
97 print "Failed to determine jet definition for directory:",aSubDirName
102 systFiles =
sorted(glob.glob(aSubDirName+
"/SystError_*.txt"))
103 for aSystFile
in systFiles:
105 systematicNameHandle = re.sub(aSubDirName+
"/SystError_",
"",aSystFile)
106 systematicNameHandle = re.sub(
".txt",
"",systematicNameHandle)
107 systematicName = SystematicNameDictionary[systematicNameHandle]
111 systematicFile =
open(aSystFile,
"r")
116 for line
in systematicFile.readlines():
117 line = line.strip(
"\r\n")
118 lowEdge =
float(line.split()[0])
119 systVal =
float(line.split()[2].strip())
121 lowBinEdges.append(lowEdge)
122 systValues.append(systVal)
125 systematicFile.close()
128 lowBinEdges.append(2500.)
129 systValues.append(systValues[-1])
132 lowBinEdgesArray =
array(
'd',lowBinEdges)
133 systValuesArray =
array(
'd',systValues)
134 histoName = systematicName+
"_"+jetDef
135 histo1D = TH1D(histoName+
"_1D",histoName+
"_1D",len(lowBinEdges)-1,lowBinEdgesArray)
138 for iBin
in xrange(1,histo1D.GetNbinsX()+1):
139 histo1D.SetBinContent(iBin,systValues[iBin-1])
143 histo.SetDirectory(0)
144 histos[jetDef][systematicName] = histo
149 systematicName = SystematicNameDictionary[
'mjbstat11']