ATLAS Offline Software
BadCellsFromCOOLPrint.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
3 #
4 #**************************************************************
5 #
6 #============================================================
7 #=== graphic tuning of the histograms
8 #============================================================
9 
10 from ROOT import *
11 from array import array
12 gStyle.SetOptStat(0)
13 gStyle.SetFrameBorderMode(0)
14 gStyle.SetCanvasBorderMode(0)
15 gStyle.SetPadBorderMode(0)
16 gStyle.SetPadColor(0)
17 gStyle.SetCanvasColor(0)
18 gStyle.SetStatColor(0)
19 gStyle.SetFrameFillColor(10)
20 gStyle.SetTitleFillColor(10)
21 gStyle.SetFillColor(10)
22 def set_palette(ncontours=50):
23  """Set a color palette from a given RGB list
24  stops, red, green and blue should all be lists of the same length
25  see set_decent_colors for an example"""
26 
27  stops = [0.00, 0.25, 0.75, 1.00]
28  red = [0.00, 1.00, 1.00, 1.00]
29  green = [1.00, 1.00, 0.70, 0.00]
30  blue = [0.00, 0.00, 0.00, 0.00]
31 
32  s = array('d', stops)
33  r = array('d', red)
34  g = array('d', green)
35  b = array('d', blue)
36 
37  npoints = len(s)
38  TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours)
39  gStyle.SetNumberContours(ncontours)
40 
41 
42 f = TFile('tileBadCells.root')
44 c1 = TCanvas("c1","c1",0,0,700,600)
45 for cell in ['','A','BC','D','Gap']:
46  c1.SetGridx(1)
47  c1.SetGridy(1)
48  c1.SetTickx(1)
49  c1.SetTicky(1)
50  h = f.Get('m_h_badCell'+cell)
51  h.SetMaximum(3)
52  h.Draw('colz')
53  c1.SetFrameFillColor(kGreen)
54  h.SetXTitle("#eta")
55  h.SetYTitle("#phi")
56  h.GetXaxis().SetTitleOffset(0.8)
57  h.GetYaxis().SetTitleOffset(0.8)
58 
59  c1.Update()
60  c1.SaveAs("tileBadCells%s.png" % cell)
array
BadCellsFromCOOLPrint.set_palette
def set_palette(ncontours=50)
Definition: BadCellsFromCOOLPrint.py:22