ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
MuonID
MuonIDAnalysis
MuonEfficiencyCorrections
macros
plotTrigSF.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3
#!/usr/bin/env python
4
from
optparse
import
OptionParser
5
6
p = OptionParser(usage=
"usage: <path:ROOT file directory>"
, version=
"0.1"
)
7
8
p.add_option(
'--pref'
, type=
'string'
, default=
None
, dest=
'pref'
)
9
p.add_option(
'--outdir'
,
'-o'
, type=
'string'
, default=
'plot-flip'
, dest=
'outdir'
)
10
p.add_option(
'--rfile'
,
'-r'
, type=
'string'
, default=
None
, dest=
'rfile'
)
11
12
p.add_option(
'--debug'
, action=
'store_true'
, default=
False
, dest=
'debug'
)
13
p.add_option(
'--save'
,
'-s'
, action=
'store_true'
, default=
False
, dest=
'save'
)
14
p.add_option(
'--wait'
,
'-w'
, action=
'store_true'
, default=
False
, dest=
'wait'
)
15
p.add_option(
'--do-err'
, action=
'store_true'
, default=
False
, dest=
'do_err'
)
16
17
(options, args) = p.parse_args()
18
19
import
os
20
import
re
21
import
sys
22
import
time
23
import
ROOT
24
25
#-----------------------------------------------------------------------------
26
# Configure python and C++ objects, add input files and execute C++ code
27
#
28
def
main
():
29
30
import
PhysicsLight.PhysicsLightConfig
as
Config
31
32
Config.setPlotDefaults(ROOT)
33
34
can = ROOT.TCanvas(
'can'
,
'can'
, 650, 600)
35
can.Draw()
36
37
ROOT.gStyle.SetPaintTextFormat(
'0.2f'
)
38
ROOT.gStyle.SetPalette(1)
39
ROOT.gROOT.ForceStyle()
40
41
rf = ROOT.TFile(args[0],
'READ'
)
42
43
regions = [
'barrel_sf'
,
'endcap_sf'
]
44
45
err_hists = [
'err_stat_up'
,
46
'err_stat_dw'
,
47
'err_syst_up'
,
48
'err_syst_dw'
,
49
]
50
51
for
r
in
regions:
52
plotNom
(r, rf, can)
53
54
if
options.do_err:
55
for
h
in
err_hists:
56
plotErr
(r,
'%s_%s'
%(r, h), rf, can)
57
58
#-----------------------------------------------------------------------------
59
def
plotErr
(hbase, hsyst, rf, can):
60
61
print
'plotErr - %s / %s'
%(hsyst, hbase)
62
63
hb = rf.Get(hbase)
64
hs = rf.Get(hsyst)
65
66
hb.SetStats(
False
)
67
hs.SetStats(
False
)
68
69
hs.Divide(hb)
70
71
hs.Draw(
'COLZ TEXT'
)
72
73
updateCanvas
(can,
'%s_over_nominal'
%hsyst)
74
75
#-------------------------------------------------------------------------
76
def
updateCanvas
(can, name=None):
77
78
if
not
can:
79
sys.exit(0)
80
81
can.Modified()
82
can.Update()
83
84
if
options.wait:
85
can.WaitPrimitive()
86
87
if
not
can:
88
sys.exit(0)
89
90
if
options.save
and
name !=
None
:
91
can.Print(
'%s.pdf'
%name,
'pdf'
)
92
93
#-----------------------------------------------------------------------------
94
def
plotNom
(hbase, rf, can):
95
96
print
'plotNom - %s'
%(hbase)
97
98
hb = rf.Get(hbase)
99
100
hb.SetStats(
False
)
101
hb.Draw(
'COLZ TEXT'
)
102
103
updateCanvas
(can, hbase)
104
105
if
__name__ ==
"__main__"
:
106
main
()
plotTrigSF.updateCanvas
updateCanvas(can, name=None)
Definition
plotTrigSF.py:76
plotTrigSF.main
main()
Definition
plotTrigSF.py:28
plotTrigSF.plotErr
plotErr(hbase, hsyst, rf, can)
Definition
plotTrigSF.py:59
plotTrigSF.plotNom
plotNom(hbase, rf, can)
Definition
plotTrigSF.py:94
Generated on
for ATLAS Offline Software by
1.17.0