Example #1
0
    def make_fixed_range_log_plot(self):
        c1 = canvases.next(self.name + '_log_fixedrange')
        c1.SetGrid()
        c1.SetLogy()
        self.canvases.append(c1)

        ## Use the ModalInterval class to display the shortest range containing
        ## 100% of all the entries.
        mi = self.modal_interval
        mi.setFraction(1)

        fullrange = (mi.lowerBound(), mi.upperBound())
        plot = self.deltaE.frame(roo.Range(*self.fixed_range_log))
        plot.SetTitle(', '.join(self.labels))
        self.fit_data.plotOn(plot, roo.MarkerColor(self.color_data),
                             roo.MarkerStyle(self.marker_style),
                             roo.LineColor(self.color_data))
        self.model.plotOn(plot, roo.LineColor(self.color_model))
        if fullrange[0] + fullrange[1] > 0:
            layout = (0.6, 0.9, 0.87)
        else:
            layout = (0.2, 0.5, 0.87)
        self.model.paramOn(plot, roo.Format("NEU", roo.AutoPrecision(2)),
                           roo.Layout(*layout))
        ## Fine tune the y-axis range so that we see all the events.
        plot.SetMinimum(0.5)
        ## Add a larger top margin to the y-axis range
        plot.SetMaximum(pow(plot.GetMaximum(), 1.1))
        plot.Draw()
        self.plots.append(plot)
Example #2
0
def make_uuplot(ux, uy):
    plot = ux.uniform_var.frame()
    ux.data.plotOn(plot, roo.LineColor(ux.color), roo.MarkerColor(ux.color))
    ux.uniform_pdf.plotOn(plot, roo.LineColor(ux.color), roo.Range(0, 1))
    uy.uniform_pdf.plotOn(plot, roo.LineColor(uy.color), roo.Range(0, 1),
                          roo.LineStyle(ROOT.kDashed))
    uy.data.plotOn(plot, roo.LineColor(uy.color), roo.MarkerColor(uy.color),
                   roo.MarkerStyle(4))
    canvases.next('uu')
    plot.Draw()
    return plot
Example #3
0
 def get_validation_plot(self):
     plot = self.variable.frame()
     plot.SetTitle(self.GetTitle() + ' Validation')
     scale = self.target_data.sumEntries() / self.raw_data.sumEntries()
     self.corrected_data = self.get_corrected_data()
     self.target_data.plotOn(plot, roo.Name('target'),
                             *color_args(self.target_color))
     self.raw_data.plotOn(plot, roo.Name('raw'), roo.Rescale(scale),
                          roo.MarkerStyle(24), *color_args(self.raw_color))
     self.corrected_data.plotOn(plot, roo.Name('corrected'),
                                roo.Rescale(scale), roo.MarkerStyle(25),
                                *color_args(self.qq_color))
     names = 'target raw corrected'.split()
     histos = [plot.findObject(name) for name in names]
     titles = [name.capitalize() for name in names]
     plot.legend = Legend(histos, titles)
     ## Some syntactic sugar to get automatic legend drawing
     plot.DrawBase = plot.Draw
     plot.Draw = lambda: plot.DrawBase() or plot.legend.draw()
     return plot
Example #4
0
 def make_fixed_range_zoom_plot(self):
     c1 = canvases.next(self.name + '_lin_fixedrange')
     c1.SetGrid()
     self.canvases.append(c1)
     plot = self.deltaE.frame(roo.Range(*self.fixed_range_zoom))
     plot.SetTitle(', '.join(self.labels))
     self.fit_data.plotOn(plot, roo.MarkerColor(self.color_data),
                          roo.MarkerStyle(self.marker_style),
                          roo.LineColor(self.color_data))
     self.model.plotOn(plot, roo.LineColor(self.color_model))
     self.model.paramOn(plot, roo.Format("NEU", roo.AutoPrecision(2)),
                        roo.Layout(0.2, 0.52, 0.87))
     plot.Draw()
     self.plots.append(plot)
Example #5
0
def test_downsampling():
    '''
    Tests the downsampling.
    '''
    import FWLite.Tools.canvases as canvases
    print '== Downsampling Test =='
    big_data = get_toy_data(1000)
    resampler = Resampler(big_data)
    small_data = resampler.downsample(50)
    keep(big_data, small_data)
    big_data.Print()
    small_data.Print()

    xvar = big_data.get()['x']
    xvar.setBins(20)
    plot = xvar.frame()
    big_data.plotOn(plot, roo.MarkerColor(ROOT.kRed), roo.LineColor(ROOT.kRed))
    small_data.plotOn(plot, roo.MarkerStyle(24))
    canvases.next('downsampling_test')
    plot.Draw()
    keep(plot)