def Print(self, outputdir, **kwargs): # TODO: Use actual signal and background histograms for the SensitivityScan as # defined in Register instead of what is 'guessed' by Stack.Print. kwargs.setdefault("sensitivity", True) self.CreateHistograms() for varexp, comparator, cutvalue in self._drawcuts: if not varexp in self._binning: continue stack = Stack() for histotype, histos in self._store.items(): for i, histo in histos.items(): stack.Register(histo[varexp, cutvalue]) direction = "-" if "<" in comparator else "+" cutmarkerprops = { "direction": direction, "drawarrow": any([s in comparator for s in "<>"]), } if kwargs.get("sensitivity"): kwargs["direction"] = direction cutmarker = CutMarker(float(cutvalue), **cutmarkerprops) stack.Print(os.path.join( outputdir, self.FormatOutput(varexp=varexp, comparator=comparator, cutvalue=cutvalue), ), xtitle=self._vartitle.get(varexp, varexp), xunits=self._varunits.get(varexp, None), inject0=cutmarker, mkdir=True, **kwargs)
self.BuildStack(sort=False) if __name__ == "__main__": from Plot import Plot from Histo1D import Histo1D from IOManager import IOManager filename = "../data/ds_data18.root" h1 = Histo1D("h1", "h1", 20, 0.0, 400.0) h2 = Histo1D("h2", "h2", 20, 0.0, 400.0) h3 = Histo1D("h3", "h3", 20, 0.0, 400.0) h1.Fill(filename, tree="DirectStau", varexp="MET", cuts="tau1Pt>600") h2.Fill(filename, tree="DirectStau", varexp="MET", cuts="tau1Pt>725") h3.Fill(filename, tree="DirectStau", varexp="MET", cuts="tau1Pt>850") s = Stack() s.Register(h1, stack=True, template="background", fillcolor=ROOT.kBlue) s.Register(h2, stack=True, template="background", fillcolor=ROOT.kGreen) s.Register(h3, stack=True, template="background", fillcolor=ROOT.kRed) c = ContributionPlot(s) # p1 = Plot(npads=1) # p1.Register(c, 0, logy=False, ymax=1) # p1.Print("contributionplot_test.pdf") c.Print("contributionplot_test.pdf", logy=False, ymax=1)