def __new__(cls, r, g, b, name=""): self = int.__new__(cls, TColor.GetFreeColorIndex()) self.object = TColor(self, float(r) / float(255), float(g) / float(255), float(b) / float(255), name, 1.0) self.name = name return self
import ROOT from ROOT import TColor palette = { 'blue': TColor(TColor.GetFreeColorIndex(), 31. / 256., 119. / 256., 180. / 256.), 'red': TColor(TColor.GetFreeColorIndex(), 214. / 256., 39. / 256., 40. / 256.), } d = ROOT.ROOT.RDataFrame("T", "htree.root") d = d.Define("cosTheta", "cos(event.theta)") d = d.Define("negHelMinus", "-event.helMinus") c = ROOT.TCanvas("c", "c", 600, 600) c.SetLeftMargin(.15) c.SetBottomMargin(.15) c.SetRightMargin(.05) c.SetTopMargin(.05) ROOT.gStyle.SetOptFit(1) ROOT.gStyle.SetOptStat("e") model = ("", "", 40, -1., 1.) p1 = d.Profile1D(model, "cosTheta", "negHelMinus") p2 = p1.Clone("p2") p3 = p1.Clone("p3") print( f"Underflow : {p1.GetBinContent(0)}\t\tOverflow : {p1.GetBinContent(p1.GetNbinsX()+1)}" ) p1.Draw()
from ROOT import TColor palette = { 'blue': TColor(TColor.GetFreeColorIndex(), 31. / 255., 119. / 255., 180. / 255.), 'orange': TColor(TColor.GetFreeColorIndex(), 255. / 255., 127. / 255., 14. / 255.), 'green': TColor(TColor.GetFreeColorIndex(), 44. / 255., 160. / 255., 44. / 255.), 'red': TColor(TColor.GetFreeColorIndex(), 214. / 255., 39. / 255., 40. / 255.), 'purple': TColor(TColor.GetFreeColorIndex(), 148. / 255., 103. / 255., 189. / 255.), 'brown': TColor(TColor.GetFreeColorIndex(), 140. / 255., 86. / 255., 75. / 255.), 'pink': TColor(TColor.GetFreeColorIndex(), 227. / 255., 119. / 255., 194. / 255.), 'grey': TColor(TColor.GetFreeColorIndex(), 127. / 255., 127. / 255., 127. / 255.), 'lightgreen': TColor(TColor.GetFreeColorIndex(), 188. / 255., 189. / 255., 34. / 255.), 'cyan': TColor(TColor.GetFreeColorIndex(), 23. / 255., 190. / 255., 207. / 255.) } palette['neutral'] = palette['grey'] palette['e-'] = palette['blue'] palette['pi-'] = palette['red'] palette['mu-'] = palette['orange'] palette['gamma'] = palette['green'] palette['Scnt'] = palette['red']