Exemple #1
0
    def run(self):
        # Apply TDR style to all plots
        style = root.style.tdr()
        style.cd()

        # print run configuration
        if self._verbose:
            print("{0:-<80}".format("-- Configuration "))
            print(self)
            print()

        self._load()
        self._plot()
Exemple #2
0
def main(argv = sys.argv):
    '''
    application entry point

    run executable without arguments to see usage
    '''
    
    try:
        if 2 > len(argv):
            raise Exception("input is not specified")

        style = root.style.tdr()
        style.SetOptStat(111111)
        style.cd()

        templates = Templates()
        #templates.use_folders = ["jet1", "jet2", "top", "jet1_parton" ]
        #templates.use_folders = ["top", "jet1_vs_jet2", "jet1", "jet2", "jet1_parton", "jet2_parton"]
        #templates.use_folders = ["ttbar_reco_delta", "ttbar_gen_delta"]
        #templates.use_folders = ["ttbar_reco", "ttbar_gen"]
        #templates.use_folders = ["top", "gen_top"]
        #templates.use_folders = ["jet1", "jet1_parton"]
        #templates.use_folders = ["jet2", "jet2_parton"]
        templates.use_folders = ["jet1_vs_jet2", "jet1_parton_vs_jet2_parton"]
        #templates.use_folders = ["ttbar_reco", "ttbar_gen", "ttbar_reco_delta", "ttbar_gen_delta"]
        templates.ban_plots = [ "px", "py", "pz", "phi", "ptrel"]

        templates.parton_rebin["mass"] = 1
        templates.parton_rebin["mt"] = 1

        templates.ttbar_rebin["eta"] = 25

        templates.load(argv[1])

        if not templates:
            raise Exception("failed to laod templates")

        canvases = templates.draw()
        raw_input("enter")

    except Exception as error:
        print(error, file = sys.stderr)
        print()
        print(usage(argv))

        return 0
    else:
        return 1
    def run(self):
        '''
        Entry point: run application
        '''

        # Apply TDR style to all plots
        style = root.style.tdr()
        style.cd()

        # print run configuration
        if self._verbose:
            print("{0:-<80}".format("-- Configuration "))
            print(self)
            print()

        self._process()
    def run(self):
        # Apply TDR style to all plots
        style = root.style.tdr()
        style.cd()

        # print run configuration
        if self._verbose:
            print("{0:-<80}".format("-- Configuration "))
            print(self)
            print()

        self._load()
        canvases = self._plot()

        # Save canvases
        for obj in canvases:
            canvas = obj.canvas.canvas
            canvas.SaveAs(self._canvas_template.format(
                canvas.GetName()))

        if canvases and not self._batch_mode:
            raw_input('enter')
Exemple #5
0
                    pad.SetBottomMargin(0.2)
                    pad.SetRightMargin(5)
                    pad.SetGrid()

                canvas.cd(1)

            self.__canvas = canvas

        return self.__canvas


if "__main__" == __name__:
    import root.style

    style = root.style.tdr()
    style.cd()

    # Prepare function for later random fill
    my_gaus1 = ROOT.TF1("my_gaus1", "gaus(0)", 0, 100)
    my_gaus1.SetParameters(1, 50, 10)

    my_gaus2 = ROOT.TF1("my_gaus2", "gaus(0)", 0, 100)
    my_gaus2.SetParameters(1, 40, 10)

    # Create plot and randomly fill with above function
    plot1 = ROOT.TH1F("plot1", "plot1", 50, 0, 100)
    plot1.FillRandom("my_gaus1", 10000)
    plot1.SetLineColor(ROOT.kRed + 1)

    plot2 = ROOT.TH1F("plot2", "plot2", 50, 0, 100)
    plot2.FillRandom("my_gaus2", 10000)