Putting text in an histo linked to a root file


I add to a root file a histogram TH2I just creating and filing in my code :
TH2I *TRIG = new TH2I(…);
My histo is added to the root file, no problem.

Now I would like to add a text area in this TH2I. I looked at TLegend, TPavText… but every time the function used to put the text is draw() which displays in the current pad but not in the TH2I itself.
I didn’t find any answer of my problem in the forum, is there a way to do that?

Thanks a lot!

Two ways:

  1. you create a Canvas, draw your histogram, draw your legend and Save the canvas. The saved canvas will contain the histogram and the Legend.

  2. you add the legend in the histogram’s list of functions using h->GetListOfFunctions()->Add(leg);

Thanks a lot !