ATLAS Offline Software
Loading...
Searching...
No Matches
Hough_plots Namespace Reference

Functions

 main (filepath)

Detailed Description

@file Hough_plots.py
@author Riley Xu - riley.xu@cern.ch
@date Nov 1st, 2020
@brief Dumps images from a Hough transform monitoring file

Usage: Hough_plots.py loghits.root

Function Documentation

◆ main()

Hough_plots.main ( filepath)

Definition at line 19 of file Hough_plots.py.

19def 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
int main()
Definition hello.cxx:18