Ejemplo n.º 1
0
          get_axis(hist, 'y').set_title_font(canvasConfigs.get('title font', 43))

        # draw the text we need
        textConfigs = plots.get('config', {}).get('texts', [])
        textLocals = plots_path.get('texts', [])
        for text in chain(textConfigs, textLocals):
          # attach the label
          label = ROOT.TLatex(text['x'], text['y'], text['label'])
          label.SetTextFont(text['font'])
          label.SetTextSize(text['size'])
          label.SetNDC()
          label.Draw()

        # draw the ratio
        if plots_path.get('ratio', plots_config.get('ratio', False)):
          canvas.get_pad(0).set_bottom_margin(0.3)
          p = Pad(0,0,1,1)  # create new pad, fullsize to have equal font-sizes in both plots
          #p.set_top_margin(1-canvas.get_bottom_margin())  # top-boundary (should be 1-thePad->GetBottomMargin())
          p.set_top_margin(1-canvas.get_pad(0).get_bottom_margin())  # top-boundary (should be 1-thePad->GetBottomMargin())
          p.set_right_margin(canvas.get_right_margin())
          p.set_left_margin(canvas.get_left_margin())
          p.set_fill_style(0)  # needs to be transparent
          p.set_gridy(True)
          p.Draw()
          p.cd()

          # do ratio for each histogram in solo hist
          for i,hist in enumerate(soloHists):
            # if (i>0): continue

            ratio = Hist.divide(hist, sum(hstack))
Ejemplo n.º 2
0
          get_axis(hist, 'x').SetNdivisions(canvasConfigs.get('ndivisions', 5))

        # draw the text we need
        textConfigs = plots.get('config', {}).get('texts', [])
        textLocals = plots_path.get('texts', [])
        for text in chain(textConfigs, textLocals):
          # attach the label
          label = ROOT.TLatex(text['x'], text['y'], text['label'])
          label.SetTextFont(text['font'])
          label.SetTextSize(text['size'])
          label.SetNDC()
          label.Draw()

        # draw the ratio
        if plots_path.get('ratio', False):
          canvas.get_pad(0).set_bottom_margin(0.3)
          p = Pad(0,0,1,1)  # create new pad, fullsize to have equal font-sizes in both plots
          #p.set_top_margin(1-canvas.get_bottom_margin())  # top-boundary (should be 1-thePad->GetBottomMargin())
          p.set_top_margin(1-canvas.get_pad(0).get_bottom_margin())  # top-boundary (should be 1-thePad->GetBottomMargin())
          p.set_right_margin(canvas.get_right_margin())
          p.set_left_margin(canvas.get_left_margin())
          p.set_fill_style(0)  # needs to be transparent
          p.set_gridy(True)
          p.Draw()
          p.cd()

          # do ratio for each histogram in solo hist
          for hist in soloHists:
            ratio = Hist.divide(hist, sum(hstack))
            ratio.draw()
            #set_minmax(ratio, plots_path)
Ejemplo n.º 3
0
                    plots_config.get('ratio', False)) and plots_path.get(
                        'composition', plots_config.get('composition', False))

                single_div_height = 0.3
                double_div_top_height = 0.13
                double_div_bottom_height = 0.28  # needs to be larger to leave room for axis labels, just set by eye

                # draw the ratio
                if plots_path.get('ratio', plots_config.get('ratio', False)):
                    p = Pad(
                        0, 0, 1, 1
                    )  # create new pad, fullsize to have equal font-sizes in both plots

                    if ratio_and_composition:
                        # ratio below composition
                        canvas.get_pad(0).set_bottom_margin(
                            double_div_top_height + double_div_bottom_height)
                        p.set_top_margin(1 - double_div_bottom_height)
                    else:
                        # ratio on the bottom
                        canvas.get_pad(0).set_bottom_margin(single_div_height)
                        p.set_top_margin(
                            1 - canvas.get_pad(0).get_bottom_margin()
                        )  # top-boundary (should be 1-thePad->GetBottomMargin())

                    p.set_right_margin(canvas.get_right_margin())
                    p.set_left_margin(canvas.get_left_margin())
                    p.set_fill_style(0)  # needs to be transparent
                    p.set_gridy(True)
                    p.Draw()
                    p.cd()
Ejemplo n.º 4
0
          label.Draw()

        # setup variables for ratio and composition plots
        ratio_and_composition = plots_path.get('ratio', plots_config.get('ratio', False)) and plots_path.get('composition', plots_config.get('composition', False))

        single_div_height = 0.3
        double_div_top_height = 0.13
        double_div_bottom_height = 0.28 # needs to be larger to leave room for axis labels, just set by eye

        # draw the ratio
        if plots_path.get('ratio', plots_config.get('ratio', False)):
          p = Pad(0,0,1,1)  # create new pad, fullsize to have equal font-sizes in both plots

          if ratio_and_composition:
            # ratio below composition
            canvas.get_pad(0).set_bottom_margin(double_div_top_height+double_div_bottom_height)
            p.set_top_margin(1-double_div_bottom_height)
          else:
            # ratio on the bottom
            canvas.get_pad(0).set_bottom_margin(single_div_height)
            p.set_top_margin(1-canvas.get_pad(0).get_bottom_margin())  # top-boundary (should be 1-thePad->GetBottomMargin())

          p.set_right_margin(canvas.get_right_margin())
          p.set_left_margin(canvas.get_left_margin())
          p.set_fill_style(0)  # needs to be transparent
          p.set_gridy(True)
          p.Draw()
          p.cd()

          # do ratio for each histogram in solo hist
          for hist in soloHists: