ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
testingMacros
InputScripts
Moriond2016
Moriond2016/ParsePileupInput.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3
from
ROOT
import
*
4
from
array
import
array
5
import
glob
6
import
re
7
import
math
8
import
ProviderHistoHelpers
9
10
11
SystematicNames = [
'Pileup_OffsetNPV'
,
'Pileup_OffsetMu'
]
#,'Pileup_PtTerm_NPV','Pileup_PtTerm_Mu','Pileup_RhoTopology']
12
13
jetDefs = {
'AntiKt4EMTopo'
:
'AntiKt4Topo_EMJES'
}
#,'AntiKt6Topo_EMJES','AntiKt4Topo_LCJES','AntiKt6Topo_LCJES']
14
15
def
ReadPileupHistograms(dirName):
16
if
not
dirName.endswith(
"/"
):
17
dirName = dirName +
"/"
18
19
# We're just taking it from the old ROOT file...
20
# Ensure there is just one such file
21
rootFileList = sorted(glob.glob(dirName+
"*.root"
))
22
23
histos = {}
24
25
for
aJetDef
in
jetDefs.keys():
26
histos[jetDefs[aJetDef]] = {}
27
28
for
file
in
rootFileList :
29
rootFile = TFile(file,
"READ"
)
30
31
# Loop over the desired systematics
32
for
aSystName
in
SystematicNames:
33
systematicName = aSystName +
"_"
+ aJetDef
34
if
systematicName
not
in
rootFile.GetKeyNames() :
35
continue
36
histo = rootFile.Get(systematicName)
37
if
histo
is
None
:
38
print
"Failed to get histogram:"
,systematicName
39
return
None
40
41
histo.SetDirectory(0)
42
43
histos[jetDefs[aJetDef]][aSystName] = histo
44
45
# Done reading, close the file
46
rootFile.Close()
47
48
# one extra file: rho topology and pt terms come from current prerecs
49
# THIS IS A GIANT FIXME
50
rootFile = TFile(
"/cluster/warehouse/kpachal/JetCalibration/JetUncertainties/JetUncertainties/share/JES_2015/Prerec/JESUncertainty_2015.root"
,
"READ"
)
51
for
term
in
[
'Pileup_PtTerm_NPV'
,
'Pileup_PtTerm_Mu'
,
'Pileup_RhoTopology'
] :
52
histo = rootFile.Get(term+
"_"
+aJetDef)
53
histo.SetDirectory(0)
54
histos[jetDefs[aJetDef]][term] = histo
55
56
return
histos
57
58
59
Generated on
for ATLAS Offline Software by
1.17.0