ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetMonitoring
TRTMonitoringRun3
python
TRTPostProcessing.py
Go to the documentation of this file.
1
#
2
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
#
4
def
hOccupancy
(inputs):
5
import
ROOT
6
element = inputs[0][0][
'element'
]
7
name =
'hOccupancy'
+ element
8
if
element ==
'C'
: title =
'Chip'
9
if
element ==
'S'
: title =
'Straw'
10
rh = ROOT.TH1F(name, title +
' Occupancy Distribution'
, 201, 0, 1.005)
11
rh.GetXaxis().SetTitle(
'Occupancy'
)
12
rh.GetYaxis().SetTitle(
'Number of '
+ title +
's'
)
13
plots = [_[1][0]
for
_
in
inputs]
# all plots passed as first element of list
14
for
plot
in
plots:
15
nBins = plot.GetNbinsX()
16
for
j
in
range(nBins):
#range of the input histogram, not the output
17
rh.Fill(plot.GetBinContent(j + 1))
18
return
[rh]
19
20
def
hHitXonTMap
(inputs):
21
import
ROOT
22
hist = inputs[1][0][
'histogram'
][9:]
#removing "unscaled_" prefix
23
element = inputs[1][0][
'element'
]
24
if
element ==
'S'
:
25
name = hist +
'S'
26
titleElement =
'Straws'
27
if
element ==
'C'
:
28
name = hist +
'C'
29
titleElement =
'Chips'
30
if
hist ==
'hHitHWonTMap'
: title =
'HL Hit(In time Window) on Track: '
31
if
hist ==
'hHitWonTMap'
: title =
'Leading Edge on Track in Time Window: '
32
if
hist ==
'hHitAonTMap'
: title =
'Any LL Bit on Track: '
33
if
hist ==
'hHitAWonTMap'
: title =
'Any LL Bit on Track in Time Window: '
34
if
hist ==
'hHitHonTMap'
: title =
'HL Hit on Track: '
35
rh = ROOT.TH1F(name, title + titleElement, 1, 0, 1)
36
rh.GetXaxis().SetTitle(titleElement[:-1] +
' Number in Stack'
)
37
rh.GetYaxis().SetTitle(
'Probability'
)
38
for
i
in
range(len(inputs[0][1])):
39
plots = [_[1][i]
for
_
in
inputs]
40
if
i < 3:
41
for
m
in
range(int(len(plots)/2)):
42
plot0 = plots[2*m]
43
plot1 = plots[2*m + 1]
44
nBins = plots[0].GetNbinsX()
45
rh.SetBins(nBins, 0, nBins)
46
for
j
in
range(nBins):
#range of the input histogram, not the output
47
if
plot0.GetBinEntries(j + 1) > 0:
48
rh.SetBinContent(j + 1, plot1.GetBinContent(j + 1)*1./plot0.GetBinEntries(j + 1))
49
else
:
50
rh.SetBinContent(j + 1, 0)
51
return
[rh]
52
53
def
hHitXonTMap2
(inputs):
54
# Refactored version of hHitXonTMap that works in online because it orders inputs
55
import
ROOT
56
hist = inputs[0][0][
'histogram'
]
#removing "unscaled_" prefix
57
element = inputs[0][0][
'element'
]
58
if
element ==
'S'
:
59
name = hist +
'S'
60
titleElement =
'Straws'
61
if
element ==
'C'
:
62
name = hist +
'C'
63
titleElement =
'Chips'
64
if
hist ==
'hHitHWonTMap'
: title =
'HL Hit(In time Window) on Track: '
65
if
hist ==
'hHitWonTMap'
: title =
'Leading Edge on Track in Time Window: '
66
if
hist ==
'hHitAonTMap'
: title =
'Any LL Bit on Track: '
67
if
hist ==
'hHitAWonTMap'
: title =
'Any LL Bit on Track in Time Window: '
68
if
hist ==
'hHitHonTMap'
: title =
'HL Hit on Track: '
69
rh = ROOT.TProfile(name, title + titleElement, 1, 0, 1)
70
rh.GetXaxis().SetTitle(titleElement[:-1] +
' Number in Stack'
)
71
rh.GetYaxis().SetTitle(
'Probability'
)
72
73
plot0 = inputs[0][1][1]
74
plot1 = inputs[0][1][0]
75
nBins = plot1.GetNbinsX()
76
rh.SetBins(nBins, 0, nBins)
77
for
j
in
range(1,nBins+2):
#range of the input histogram, not the output
78
if
plot0.GetBinEntries(j) > 0:
79
rh.Fill(j, plot1.GetBinContent(j)*1./plot0.GetBinEntries(j))
80
return
[rh]
81
82
def
hHitOnTrackVsAll
(inputs):
83
import
ROOT
84
element = inputs[0][0][
'element'
]
85
if
element ==
'S'
:
86
name =
'S'
87
titleElement =
'Straws'
88
if
element ==
'C'
:
89
name =
'C'
90
titleElement =
'Chips'
91
rh = ROOT.TH1F(
'hHitonTrackVsAll'
+ name,
'(Hit on Track) / (Any LL Bit): '
+ titleElement, 1, 0, 1)
92
rh.GetXaxis().SetTitle(titleElement[:-1] +
' Number in Stack'
)
93
rh.GetYaxis().SetTitle(
'Ratio'
)
94
for
i
in
range(len(inputs[0][1])):
95
plots = [_[1][i]
for
_
in
inputs]
96
if
i < 4:
97
for
m
in
range(int(len(plots)/3)):
98
plot0 = plots[3*m]
99
plot1 = plots[3*m + 1]
100
plot2 = plots[3*m + 2]
101
nBins = plots[0].GetNbinsX()
102
rh.SetBins(nBins, 0, nBins)
103
for
j
in
range(nBins):
#range of the input histogram, not the output
104
if
(plot0.GetBinContent(j + 1)*plot1.GetBinContent(j + 1)) > 0:
105
rh.SetBinContent(j + 1, plot2.GetBinContent(j + 1)/(plot0.GetBinContent(j + 1)*plot1.GetBinContent(j + 1)))
106
else
:
107
rh.SetBinContent(j + 1, 0)
108
return
[rh]
109
110
def
hEfficiency
(inputs):
111
import
ROOT
112
region = inputs[0][0][
'region'
]
113
side = inputs[0][0][
'side'
]
114
if
region ==
'Barrel'
:
115
name =
'hEfficiencyBarrel'
+ str(side)
116
if
region ==
'Endcap'
:
117
name =
'hEfficiencyEndCap'
+ str(side)
118
rh = ROOT.TH1F(name,
'Straw Efficiency ('
+ name[11:] +
')'
, 500, -0.01, 1.01)
119
rh.GetXaxis().SetTitle(
'Efficiency'
)
120
rh.GetYaxis().SetTitle(
'Number of Straws'
)
121
for
i
in
range(len(inputs[0][1])):
122
plots = [_[1][i]
for
_
in
inputs]
123
for
plot
in
plots:
124
for
nStraw
in
range(plot.GetXaxis().GetNbins()):
125
rh.Fill(plot.GetBinContent(nStraw + 1))
126
return
[rh]
127
128
def
hEfficiencyIntegral
(inputs):
129
import
ROOT
130
region = inputs[0][0][
'region'
]
131
side = inputs[0][0][
'side'
]
132
if
region ==
'Barrel'
:
133
name =
'hEfficiencyBarrel'
+ str(side)
134
if
region ==
'Endcap'
:
135
name =
'hEfficiencyEndCap'
+ str(side)
136
rh = ROOT.TH1F(name,
'Straw Efficiency ('
+ name[11:] +
')'
, 500, -0.01, 1.01)
137
rh.GetXaxis().SetTitle(
'Efficiency'
)
138
rh.GetYaxis().SetTitle(
'Fraction of Straws'
)
139
for
i
in
range(len(inputs[0][1])):
140
plots = [_[1][i]
for
_
in
inputs]
141
for
plot
in
plots:
142
for
nStraw
in
range(plot.GetXaxis().GetNbins()):
143
rh.Fill(plot.GetBinContent(nStraw + 1))
144
totalEntries = 0.
145
entries = rh.GetEntries()
146
for
nStraw
in
range(rh.GetXaxis().GetNbins()):
147
totalEntries += rh.GetBinContent(nStraw + 1)
148
rh.SetBinContent(nStraw + 1, totalEntries/float(entries))
149
return
[rh]
TRTPostProcessing.hOccupancy
hOccupancy(inputs)
Definition
TRTPostProcessing.py:4
TRTPostProcessing.hHitOnTrackVsAll
hHitOnTrackVsAll(inputs)
Definition
TRTPostProcessing.py:82
TRTPostProcessing.hEfficiency
hEfficiency(inputs)
Definition
TRTPostProcessing.py:110
TRTPostProcessing.hHitXonTMap2
hHitXonTMap2(inputs)
Definition
TRTPostProcessing.py:53
TRTPostProcessing.hEfficiencyIntegral
hEfficiencyIntegral(inputs)
Definition
TRTPostProcessing.py:128
TRTPostProcessing.hHitXonTMap
hHitXonTMap(inputs)
Definition
TRTPostProcessing.py:20
Generated on
for ATLAS Offline Software by
1.17.0