63 def plot(data, showThreads=True, batch=False, nevtcolors=10, width=1200, height=500):
    66     tmin = min(f.start 
for f 
in data)
    67     tmax = max(f.end 
for f 
in data)
    68     slots = 1 + max(f.slot 
for f 
in data)
    69     threads = sorted(list(set(f.thread 
for f 
in data)))
    70     threadid = dict((k, v) 
for v, k 
in enumerate(threads))  
    71     ymax = len(threads) 
if showThreads 
else slots
    73     c = ROOT.TCanvas(
'timeline', 
'Timeline', width, height)
    77     c.SetBottomMargin(0.1)
    78     c.coord = ROOT.TH2I(
'coord', 
';Time (ns)', 100,
    79                         0, tmax - tmin, ymax, 0, ymax)
    80     c.coord.GetYaxis().SetTitle((
'Thread' if showThreads 
else 'Slot'))
    81     c.coord.GetYaxis().SetTitleOffset(0.5)
    82     c.coord.GetYaxis().CenterTitle()
    83     c.coord.SetStats(
False)
    84     c.coord.GetYaxis().SetNdivisions(ymax)
    85     c.coord.GetXaxis().CenterTitle()
    95         y = (threadid[d.thread] 
if showThreads 
else d.slot)
    97         if alg 
not in colors 
and len(mycolors) > 0:
    98             colors[alg] = mycolors.pop(0)
    99             if len(mycolors) == 0:
   100                 print "Too many algorithm to show"   107             l = ROOT.TBox(t0, y + .1, t1, y + .8)
   108             l.SetFillColor(colors[alg])
   111             l2 = ROOT.TBox(t0, y + .8, t1, y + .9)
   112             l2.SetFillColor(evtcolors[d.event % nevtcolors])
   121     for k, v 
in tevt.iteritems():
   122         y = ymax + bheight * v[2]
   123         l = ROOT.TBox(v[0] - tmin, y + 0.2 * bheight, v[1] - tmin, y + bheight)
   124         l.SetFillColor(evtcolors[k % nevtcolors])
   129     c.leg = ROOT.TLegend(0.8, 0.4, 0.98, 0.9)
   130     for alg, cl 
in sorted(colors.iteritems(), key=operator.itemgetter(1)):
   131         e = c.leg.AddEntry(
'', alg, 
'F')
   137     bwidth = 0.18 / nevtcolors
   138     for cl 
in range(nevtcolors):
   142         l.SetLineColor(evtcolors[cl])
   143         l.DrawLineNDC(0.807 + bwidth * cl, 0.37,
   144                       0.807 + bwidth * (cl + 1), 0.37)
   146     c.t1 = ROOT.TText(0.807, 0.314, 
'Events')
   149     c.t1.SetTextSize(0.04)
   152     c.t2 = ROOT.TText(0.02, 0.92, 
'Event')
   155     c.t2.SetTextSize(0.03)
   156     c.t2.SetTextAngle(90)
   158     c.t3 = ROOT.TText(0.03, 0.922, 
'Slots')
   161     c.t3.SetTextSize(0.03)
   162     c.t3.SetTextAngle(90)
 def plot(data, showThreads=True, batch=False, nevtcolors=10, width=1200, height=500)
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range. 
def setPalette(nevts, nevtcolors)