Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
Hi, i made a simple macros DrawBox.C :
void DrawBox (double energy)
{
TBox box (0.02, energy - 0.02, 0.06, energy + 0.02);
box.SetLineColor(1);
box.SetFillStyle(0);
box.SetLineWidth(2);
box.Draw();
}
I open histogram in .root file, use DrawBox, but box didn’t draw on histogram. Why&
It works, thanks.
Can I build a box right away in a histogram when creating or filling in?
{
TH1F *h = new TH1F("h", "h", 100, -3., 3.);
h->FillRandom("gaus", 5000); // fill here ...
#if 1 /* 0 or 1 */
TBox *box = new TBox(1.75, 80., 2.75, 100.);
box->SetLineColor(1);
box->SetFillStyle(0);
box->SetLineWidth(2);
h->GetListOfFunctions()->Add(box);
#endif /* 0 or 1 */
h->FillRandom("gaus", 5000); // ... or/and here
h->Draw();
}
system
Closed
15
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.