Esempio n. 1
0
          # top level path empty so break
          if not topLevelPath:
            break
        plots_path = plots_paths.get(topLevelPath, {})

        # create new canvas
        canvasConfigs = copy.copy(plots_config.get('canvas', {}))
        canvasConfigs.update(plots_path.get('canvas', {}))
        canvas = Canvas(canvasConfigs.get('width', 500), canvasConfigs.get('height', 500))

        canvas.SetRightMargin(canvasConfigs.get('rightmargin', 0.1))
        canvas.SetBottomMargin(canvasConfigs.get('bottommargin', 0.2))
        canvas.SetLeftMargin(canvasConfigs.get('leftmargin', 0.2))

        if canvasConfigs.get('logy', False) == True:
          canvas.set_logy()

        # create a legend (an entry for each group)
        legendConfigs = copy.copy(plots_config.get('legend', {}))
        legendConfigs.update(plots_path.get('legend', {}))
        legend_numColumns = legendConfigs.get('numcolumns', 1)
        if "numcolumns" in legendConfigs: del legendConfigs['numcolumns']
        legend = Legend(len(h), **legendConfigs)
        legend.SetNColumns(legend_numColumns)

        # scale the histograms before doing anything else
        for hgroup in h:
          if groups.get(hgroup.group).get('do not scale me', False):
            logger.info("Skipping %s for scaling" % hgroup.group)
            continue
          for hist in hgroup:
Esempio n. 2
0
          # top level path empty so break
          if not topLevelPath:
            break
        plots_path = plots_paths.get(topLevelPath, {})

        # create new canvas
        canvasConfigs = copy.copy(plots_config.get('canvas', {}))
        canvasConfigs.update(plots_path.get('canvas', {}))
        canvas = Canvas(canvasConfigs.get('width', 500), canvasConfigs.get('height', 500))

        canvas.SetRightMargin(canvasConfigs.get('rightmargin', 0.1))
        canvas.SetBottomMargin(canvasConfigs.get('bottommargin', 0.2))
        canvas.SetLeftMargin(canvasConfigs.get('leftmargin', 0.2))

        if canvasConfigs.get('logy', False) == True:
          canvas.set_logy()

        # create a legend (an entry for each group)
        legendConfigs = copy.copy(plots_config.get('legend', {}))
        legendConfigs.update(plots_path.get('legend', {}))
        legend = Legend(len(h), **legendConfigs)

        # scale the histograms before doing anything else
        for hgroup in h:
          if groups.get(hgroup.group).get('do not scale me', False):
            logger.info("Skipping %s for scaling" % hgroup.group)
            continue
          for hist in hgroup:
            # scale the histograms, look up weights by did
            did = get_did(hist)
            weight = weights.get(did)