ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
FPGATrackSim
FPGATrackSimHough
scripts
Hough_plots.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3
#!/usr/bin/env python
4
5
'''
6
@file Hough_plots.py
7
@author Riley Xu - riley.xu@cern.ch
8
@date Nov 1st, 2020
9
@brief Dumps images from a Hough transform monitoring file
10
11
Usage: Hough_plots.py loghits.root
12
'''
13
14
import
sys
15
sys.argv.append(
'-b'
)
16
17
import
ROOT
18
19
def
main
(filepath):
20
ROOT.gStyle.SetOptStat(0)
21
f = ROOT.TFile(filepath)
22
for
key
in
f.Get(
"Hough/Images"
).GetListOfKeys():
23
if
key.GetClassName() ==
"TH2I"
:
24
c = ROOT.TCanvas(
"c1"
,
"c1"
,800,600)
25
h = key.ReadObj()
26
h.Draw(
"COLZ"
)
27
28
# Draw boxes around fired roads.
29
# Hough monitoring tool uses the bin error to indicate if a road was found.
30
# Bin errors are sqrt(n), so anything > sqrt(n_layers) is safe to use.
31
# Error is set to 100 + nLayers_missed.
32
boxes = []
# need to store so they don't get garbage collected
33
for
x
in
range(1, h.GetNbinsX() + 1):
34
for
y
in
range(1, h.GetNbinsY() + 1):
35
if
h.GetBinError(x, y) >= 100:
36
b = ROOT.TBox(h.GetXaxis().GetBinLowEdge(x),
37
h.GetYaxis().GetBinLowEdge(y),
38
h.GetXaxis().GetBinWidth(x) + h.GetXaxis().GetBinLowEdge(x),
39
h.GetYaxis().GetBinWidth(y) + h.GetYaxis().GetBinLowEdge(y))
40
b.SetFillColor(ROOT.kRed + int(h.GetBinError(x, y)) - 100)
41
b.Draw()
42
boxes.append(b)
43
44
c.Print(h.GetName() +
".png"
)
45
46
47
if
__name__ ==
"__main__"
:
48
main
(sys.argv[1])
main
int main()
Definition
hello.cxx:18
Generated on
for ATLAS Offline Software by
1.17.0