How to add TLegend in roofit?

Hi Experts,
I have TLegend like this now. All the text is within the box now.
First I want to remove the box. And “Belle II 2020” will be bold and “prelimenery” will not be in bold.
And B -> D* pi will be like this — B -> D* pi(— should highlight the blue colour) and same thing for bkg it should be in green colour.

I have tried this and my output is something like this.

Please suggest me what should I do ?

Thanks

  TLegend *leg1 = new TLegend(0.8, 0.5, 0.3, 0.9);
  leg1->SetFillColor(kWhite);
  leg1->AddEntry(deltam, "Belle II 2020 (Preliminary)", "");
  leg1->AddEntry(deltam, "N = (3395 #pm 61)", "");
  leg1->AddEntry(deltam, "#intL dt = 72 fb^{-1}", "");
  leg1->AddEntry(deltam, "B^{0} -> D^{*}#pi", "");
  leg1->AddEntry(deltam, "bkg", "");
  leg1->Draw();

Hi,

– add
leg1->SetBorderSize(0);
right before
leg1->Draw();

– I believe this should not be a part of the legend. The legend is usually there to explain what different lines/points/bands refer to. For everything else you should just create a TText or a TLatex object on the canvas.

– to do this, instead of deltam in both
leg1->AddEntry(deltam, "B^{0} -> D^{}#pi", “”);
and
leg1->AddEntry(deltam, “bkg”, “”);
you should provide a name of the object holding the blue solid line and green dashed line, respectively.

P.S. You really REALLY don’t want to abbreviate “background” to “bkg” in the legend.

What is deltam ? the first parameter of AddEntry should be a ROOT object inheriting from the TAttxxx classes… See the TLegend documentation

Thanks.It did help.

#textbf{Belle II} Simulation didn’t work.

Don’t know why ?

I got this now.

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.