def make_mixer_class(input_dict):
    gen_tmplt_input = tmpl_fit.rebin_chhadiso(gen_mixer_input(input_dict))
    class HistoMixer(ppt.FSStackPlotter):
        def configure(self):
            self.result = []
            for d in gen_tmplt_input:
                self.result.append(d)

        def make_mixed_histo(self, scale_factors):
            assert(len(scale_factors) == len(self.result))
            mix = op.sum((
                op.prod([tmplt, wrp.FloatWrapper(float(scale))])
                for scale,tmplt in itertools.izip(scale_factors, self.result)
            ))
            mix.legend      = "mix:"+(len(scale_factors)*" %d") % tuple(scale_factors)
            mix.name        = "pseudo data"
            mix.draw_option = "E1X0"
            mix.draw_option_legend = "p"
            #mix.draw_option_legend = ""
            mix.histo.SetMarkerStyle(24)
            return [mix]

        def set_up_stacking(self):
            gen_inp = lambda w: tmpl_fit.cosmetica1([op.norm_to_integral(w)])  # clone histo and color..
            self.stream_stack = (
                gen_inp(w) for w in self.result
            )
    return HistoMixer
        def run(self):
            wrps = tmpl_fit.rebin_chhadiso(gen.fs_filter_sort_load({
                "analyzer": "PlotSBID",
                "sample": sample,
            }))
            wrp = gen.op.merge(wrps)

            # multiply with weight
            if tmpl_fit.do_dist_reweighting:
                wrp = gen.op.prod((
                    settings.post_proc_dict["TemplateFitToolChHadIsoSBIDInputBkgWeight"],
                    wrp,
                ))

            wrps = gen.gen_norm_to_data_lumi((wrp,))
            wrps = list(wrps)
            self.result = wrps
            gen.consume_n_count(
                gen.save(
                    gen.canvas((wrps,)),
                    lambda c: self.plot_output_dir + c.name
                )
            )