ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
testingMacros
InputScripts
Final2012
Final2012/ParseEtaIntercalInput.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
SystematicNames = [
'EtaIntercalibration_TotalStat'
,
'EtaIntercalibration_Modelling'
]
11
12
jetDefDict = {
13
'AntiKt4TopoEM'
:
'AntiKt4Topo_EMJES'
,
14
'AntiKt6TopoEM'
:
'AntiKt6Topo_EMJES'
,
15
'AntiKt4LCTopo'
:
'AntiKt4Topo_LCJES'
,
16
'AntiKt6LCTopo'
:
'AntiKt6Topo_LCJES'
17
}
18
19
def
ReadEtaIntercalibrationHistograms
(dirName):
20
if
not
dirName.endswith(
"/"
):
21
dirName = dirName +
"/"
22
23
# Run over each file (one per jet definition)
24
histos = {}
25
files = sorted(glob.glob(dirName+
"*.root"
))
26
for
aFileName
in
files:
27
# Determine the jet definition
28
jetDef =
""
29
for
aFileDef,aJetDef
in
jetDefDict.iteritems():
30
if
aFileDef
in
aFileName:
31
jetDef = aJetDef
32
break
33
if
jetDef ==
""
:
34
print
"Failed to determine jet definition for file:"
,aFileName
35
return
None
36
histos[jetDef] = {}
37
38
# Read in the histograms of interest from the file
39
inFile = TFile(aFileName,
"READ"
)
40
for
aName
in
SystematicNames:
41
systematicName = aName +
"_"
+ jetDef
42
histo = inFile.Get(systematicName)
43
if
histo
is
None
:
44
print
"Failed to get histogram:"
,systematicName
45
return
None
46
histo.SetName(systematicName+
"_old"
)
47
48
# Histo has different range, extend it
49
histoNew =
ProviderHistoHelpers.ExtendPtRangeOfHisto
(histo,systematicName)
50
histoNew.SetDirectory(0)
51
histos[jetDef][aName] = histoNew
52
53
# Done reading, close the file
54
inFile.Close()
55
56
return
histos
ParseEtaIntercalInput.ReadEtaIntercalibrationHistograms
ReadEtaIntercalibrationHistograms(dirName)
Definition
Final2012/ParseEtaIntercalInput.py:19
ProviderHistoHelpers.ExtendPtRangeOfHisto
ExtendPtRangeOfHisto(histo, histoName)
Definition
Final2012/ProviderHistoHelpers.py:97
Generated on
for ATLAS Offline Software by
1.17.0