Functions | Variables
plot_impactresponse Namespace Reference

Functions

def bilogify (hist, lmin=None)
 
def set_palette (which="custom")
 
def draw_wires ()
 

Variables

 stops = array('d',[ 0.00, 0.45, 0.50, 0.55, 1.00 ])
 
 reds = array('d',[ 0.00, 0.00, 1.00, 1.00, 0.51 ])
 
 greens = array('d',[ 0.00, 0.81, 1.00, 0.20, 0.00 ])
 
 blues = array('d',[ 0.51, 1.00, 1.00, 0.00, 0.00 ])
 
 fp = ROOT.TFile.Open("build/util/test_impactresponse.root")
 
string outname = "test_impactresponse.pdf"
 
 c = ROOT.TCanvas()
 
 limits
 
 lmins
 
 wline = ROOT.TLine()
 
 hline = ROOT.TLine()
 
 hist = fp.Get("h%s_%c" % (name, letter))
 
 lim = limits[name][iplane]
 
 lminin = lmins[name][iplane]
 
 lminout = bilogify(hist, lminin)
 
 title = hist.GetTitle()
 

Function Documentation

def plot_impactresponse.bilogify (   hist,
  lmin = None 
)
Modify histogram so that it is rescaled in a "bilog" manner.
Negative values are -log10(-z).  An offset in log10 is returned
and represents the 0.

Definition at line 6 of file plot_impactresponse.py.

6 def bilogify(hist, lmin = None):
7  """
8  Modify histogram so that it is rescaled in a "bilog" manner.
9  Negative values are -log10(-z). An offset in log10 is returned
10  and represents the 0.
11  """
12  nx,ny = hist.GetNbinsX(), hist.GetNbinsY()
13  zmax = max(abs(hist.GetMinimum()), abs(hist.GetMaximum()))
14 
15  if lmin is None:
16  zmin = sum([abs(hist.GetBinContent(99,iy)) for iy in range(ny)]) / ny
17  lmin = int(log10(zmin))
18 
19  lmax = 1+int(log10(zmax))
20 
21  for ix in range(hist.GetNbinsX()):
22  for iy in range(hist.GetNbinsY()):
23  val = hist.GetBinContent(ix, iy)
24  if val == 0.0:
25  hist.SetBinContent(ix, iy, 0.0)
26  continue
27 
28  sign = 1.0
29  if val > 0: # opposite sign to match Xin
30  sign = -1.0
31  lval = log10(abs(val))
32  if lval < lmin:
33  lval = 0.0
34  else:
35  lval -= lmin
36  lval *= sign
37  hist.SetBinContent(ix, iy, lval)
38  continue
39  continue
40 
41  lhmax = lmax - lmin
42 
43  hist.SetMaximum(lhmax)
44  hist.SetMinimum(-lhmax)
45  return lmin
46 
47 
T abs(T value)
def bilogify(hist, lmin=None)
static int max(int a, int b)
def plot_impactresponse.draw_wires ( )

Definition at line 89 of file plot_impactresponse.py.

89 def draw_wires():
90  for wpitch in range(0,36,3):
91  wline.DrawLine(0, wpitch, 100, wpitch)
92  wline.DrawLine(0, -wpitch, 100, -wpitch)
93  if wpitch:
94  hline.DrawLine(0, wpitch-1.5, 100, wpitch-1.5)
95  hline.DrawLine(0, -wpitch+1.5, 100, -wpitch+1.5)
96 
def plot_impactresponse.set_palette (   which = "custom")

Definition at line 57 of file plot_impactresponse.py.

57 def set_palette(which = "custom"):
58  if not which or which == "custom":
59  ROOT.TColor.CreateGradientColorTable(len(stops), stops, reds, greens, blues, 100)
60  return
61  ROOT.gStyle.SetPalette(which)
62 
63 
def set_palette(which="custom")

Variable Documentation

plot_impactresponse.blues = array('d',[ 0.51, 1.00, 1.00, 0.00, 0.00 ])

Definition at line 52 of file plot_impactresponse.py.

plot_impactresponse.c = ROOT.TCanvas()

Definition at line 70 of file plot_impactresponse.py.

plot_impactresponse.fp = ROOT.TFile.Open("build/util/test_impactresponse.root")

Definition at line 64 of file plot_impactresponse.py.

plot_impactresponse.greens = array('d',[ 0.00, 0.81, 1.00, 0.20, 0.00 ])

Definition at line 51 of file plot_impactresponse.py.

plot_impactresponse.hist = fp.Get("h%s_%c" % (name, letter))

Definition at line 99 of file plot_impactresponse.py.

plot_impactresponse.hline = ROOT.TLine()

Definition at line 86 of file plot_impactresponse.py.

plot_impactresponse.lim = limits[name][iplane]

Definition at line 105 of file plot_impactresponse.py.

plot_impactresponse.limits
Initial value:
1 = dict(fr = [0.5e-12, 0.3e-12, 0.8e-12],
2  dr = [9.0e-12, 9.0e-12, 20.0e-12])

Definition at line 76 of file plot_impactresponse.py.

plot_impactresponse.lminin = lmins[name][iplane]

Definition at line 110 of file plot_impactresponse.py.

plot_impactresponse.lminout = bilogify(hist, lminin)

Definition at line 111 of file plot_impactresponse.py.

plot_impactresponse.lmins
Initial value:
1 = dict(fr = [-17, -17, -17],
2  dr = [-15, -15, -15])

Definition at line 78 of file plot_impactresponse.py.

string plot_impactresponse.outname = "test_impactresponse.pdf"

Definition at line 68 of file plot_impactresponse.py.

plot_impactresponse.reds = array('d',[ 0.00, 0.00, 1.00, 1.00, 0.51 ])

Definition at line 50 of file plot_impactresponse.py.

plot_impactresponse.stops = array('d',[ 0.00, 0.45, 0.50, 0.55, 1.00 ])

Definition at line 49 of file plot_impactresponse.py.

plot_impactresponse.title = hist.GetTitle()

Definition at line 113 of file plot_impactresponse.py.

plot_impactresponse.wline = ROOT.TLine()

Definition at line 82 of file plot_impactresponse.py.