2 from array
import array
6 import ProviderHistoHelpers
10 return [key.GetName()
for key
in gDirectory.GetListOfKeys()]
11 TFile.GetKeyNames = GetKeyNames
13 SystematicNames = {
'EtaIntercalibration_TotalStat' :
'EtaIntercalibration_TotalStat',\
14 'EtaIntercalibration_TotalSyst' :
'EtaIntercalibration_Modelling',\
15 'E_4TeV' :
'EtaIntercalibration_NonClosure_highE',\
16 'Eta_2p4_to_2p6' :
'EtaIntercalibration_NonClosure_posEta',\
17 'Eta_m2p6_to_m2p4' :
'EtaIntercalibration_NonClosure_negEta'
21 'AntiKt4EMTopo' :
'AntiKt4Topo_EMJES',
22 'AntiKt4EMPFlow' :
'AntiKt4PFlow_EMJES',
26 if not dirName.endswith(
"/"):
27 dirName = dirName +
"/"
31 files =
sorted(glob.glob(dirName+
"*.root"))
32 for aFileName
in files:
35 for aFileDef,aJetDef
in jetDefDict.iteritems():
36 if aFileDef
in aFileName:
40 print "Failed to determine jet definition for file:",aFileName
42 if jetDef
not in histos.keys() :
46 inFile = TFile(aFileName,
"READ")
47 contents = inFile.GetKeyNames()
48 for aName
in SystematicNames.keys():
49 if not "NonClosure" in SystematicNames[aName] :
51 getsystematicName = aName +
"_" + jetDef.replace(
"Topo",
"")
53 getsystematicName = aName +
"_" + jetDef.replace(
"4PFlow",
"4EMPFlow").
replace(
"_EMJES",
"_PFlowJES")
55 getsystematicName = aName
57 if not getsystematicName
in contents :
60 histo = inFile.Get(getsystematicName)
62 systematicName = SystematicNames[aName] +
"_" + jetDef
63 histo.SetName(systematicName+
"_old")
67 histoNew.SetDirectory(0)
68 histos[jetDef][SystematicNames[aName]] = histoNew
74 for aName,storeName
in SystematicNames.iteritems():
75 for aJetDef
in histos.keys():
76 if not storeName
in histos[aJetDef].
keys() :
77 print "Failed to find histogram:", storeName,
"for jet definition",aJetDef
79 print "About to return eta intercalib histos"