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
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)
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)
def plot_uniform(self): ''' Create a canvas with transformed x data overlayed with a uniform pdf. ''' self.uplot = self.uniform_var.frame() self.data.plotOn(self.uplot, roo.LineColor(self.color), roo.MarkerColor(self.color)) self.uniform_pdf.plotOn(self.uplot, roo.Range(0, 1), roo.LineColor(self.color)) cname = '_'.join( [self.uniform_var.GetName(), 'of', self.xvar.GetName()]) canvases.next(cname).SetGrid() self.uplot.SetTitle('') self.uplot.Draw()
def run(self): ## Set the range of deltaE to cover all the date plus a small margin. mi = self.modal_interval mi.setFraction(1.) self.deltaE.setRange(mi.lowerBound() - 1, mi.upperBound() + 1) self.model = ParameterizedKeysPdf(self.name + '_model', self.name + '_model', self.deltaE, self.mode, self.effsigma, self.train_data, rho=2) mit = self.modal_interval_training mit.setFraction(0.99) fitrange = roo.Range(mit.lowerBound(), mit.upperBound()) self.fit_result = self.model.fitTo(self.fit_data, roo.NumCPU(8), roo.Save(), fitrange) self.fit_result.SetName(self.name + '_fit_result') self.make_log_plot() self.make_zoom_plot() self.make_fixed_range_log_plot() self.make_fixed_range_zoom_plot() canvases.update()
xyplot = w.var('x').frame() xyplot.SetTitle('') xyplot.GetYaxis().SetTitle('y') yvar.plotOn(xyplot) canvases.next('exp_of_x').SetGrid() xyplot.Draw() yxplot = w.var('y').frame() yxplot.SetTitle('') yxplot.GetYaxis().SetTitle('x') xvar.plotOn(yxplot) canvases.next('log_of_y').SetGrid() yxplot.Draw() yplot = w.var('y').frame(roo.Range(0, 5)) yplot.SetTitle('') data.plotOn(yplot) fY.plotOn(yplot) canvases.next('fY').SetGrid() yplot.Draw() xuplot = w.var('x').frame() xuplot.SetTitle('') xuplot.GetYaxis().SetTitle('u') uvar.plotOn(xuplot) canvases.next('cdf_of_x').SetGrid() xuplot.Draw() uplot = w.var('u').frame() yplot.SetTitle('')
data = fX.generate(ROOT.RooArgSet(w.var('x')), 10000) data.addColumn(FX) xplot = w.var('x').frame() xplot.SetTitle('') data.plotOn(xplot) fX.plotOn(xplot) canvases.next('fX').SetGrid() xplot.Draw() xuplot = w.var('x').frame() xuplot.SetTitle('') xuplot.GetYaxis().SetTitle('u') FX.plotOn(xuplot) canvases.next('FX').SetGrid() xuplot.Draw() uplot = w.var('u').frame() uplot.SetTitle('') data.plotOn(uplot) fU.plotOn(uplot, roo.Range(0, 1)) canvases.next('fU').SetGrid() uplot.Draw() canvases.update() if __name__ == '__main__': import user