ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloCalibUtils
python
PlotCalibrationTiming.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3
4
from
ROOT
import
gStyle, gDirectory, TCanvas, TH1F, TFile
5
import
sys
6
import
os
7
from
optparse
import
OptionParser
8
9
10
def
PlotCalibrationTiming
(input_file_name=None):
11
12
if
input_file_name
is
None
:
13
print
(
"No input file name, assuming output.root"
)
14
input_file_name =
"output.root"
15
16
gStyle.SetPalette(1)
17
gStyle.SetOptStat(0)
18
gStyle.SetOptFit(0)
19
gStyle.SetCanvasColor(10)
20
gStyle.SetFrameFillColor(10)
21
gStyle.SetStatY(0.85)
22
gStyle.SetStatX(0.85)
23
24
25
c1 = TCanvas(
'c1'
,
'Example'
,200,10,700,500)
26
c1.Divide(8,9)
27
28
graphs = TFile(input_file_name)
29
graphs.cd(
'ADC/FineTime'
)
30
key_list = gDirectory.GetListOfKeys()
31
32
run_directory_name =
None
# find name of directory with histos
33
34
try
:
35
for
iii
in
key_list:
36
iii_str = str(iii)
37
line = iii_str.split(
"\""
)
38
for
name
in
line:
39
if
'run#'
in
name:
40
run_directory_name = name
41
if
run_directory_name
is
None
:
42
raise
NameError
43
except
Exception:
44
print
(
"ERROR, the file doesn't contain run# directory!"
)
45
sys.exit(1)
46
47
48
print
(
"Entering directory: "
, run_directory_name)
49
gDirectory.cd(run_directory_name)
50
51
52
c1.Print(
"CalibrationTimingPlots.ps["
)
53
54
ppm_em_2d_profile_etaPhi_adc_fineTime.SetMinimum(-10.)
# noqa: F821
55
ppm_em_2d_profile_etaPhi_adc_fineTime.SetMaximum(10.)
# noqa: F821
56
ppm_em_2d_profile_etaPhi_adc_fineTime.Draw(
"colz"
)
# noqa: F821
57
c1.Print(
"CalibrationTimingPlots.ps"
)
58
59
60
ppm_had_2d_profile_etaPhi_adc_fineTime.SetMinimum(-10.)
# noqa: F821
61
ppm_had_2d_profile_etaPhi_adc_fineTime.SetMaximum(10.)
# noqa: F821
62
ppm_had_2d_profile_etaPhi_adc_fineTime.Draw(
"colz"
)
# noqa: F821
63
c1.Print(
"CalibrationTimingPlots.ps"
)
64
65
# now produce histograms for each partition
66
directory_content = gDirectory.GetListOfKeys()
67
68
69
gStyle.SetOptStat(111111)
70
partition_histos=[]
71
for
key
in
directory_content:
72
print
(key,
" Class name= "
, key.GetClassName(),
" Name="
, key.GetName())
73
if
key.GetClassName() ==
'TDirectoryFile'
:
74
print
(
"OK, I will create new histogram for this partition!"
)
75
print
(
"Name of partition is: "
, key.GetName())
76
partition_histos.append(TH1F(key.GetName()+
'_his'
,
'Timing distribution for partition: '
+key.GetName(),100,-10.,10.))
77
gDirectory.cd()
78
gDirectory.cd(
"/ADC/FineTime/"
+run_directory_name+
"/"
+key.GetName())
79
80
list_of_histos = gDirectory.GetListOfKeys()
81
for
his_key
in
list_of_histos:
82
#timing_value=his_key.ReadObj().GetMaximum()
83
timing_value=his_key.ReadObj().GetBinContent(2)
84
partition_histos[-1].Fill(timing_value)
85
86
87
for
iHisto
in
partition_histos:
88
iHisto.Draw()
89
c1.Print(
"CalibrationTimingPlots.ps"
)
90
91
c1.Print(
"CalibrationTimingPlots.ps]"
)
92
93
os.system(
"ps2pdf CalibrationTimingPlots.ps"
)
94
95
print
(
"Finished!"
)
96
97
98
if
__name__ ==
"__main__"
:
99
100
print
(
"Starting PlotCalibrationTiming"
)
101
102
parser = OptionParser()
103
parser.add_option(
"-f"
,
"--InputFile"
,action=
"store"
,type=
"string"
,dest=
"input_file_name"
,help=
"Name of input file"
)
104
(options, args) = parser.parse_args()
105
106
PlotCalibrationTiming
(options.input_file_name)
107
108
109
110
PlotCalibrationTiming
Definition
PlotCalibrationTiming.py:1
Generated on
for ATLAS Offline Software by
1.17.0