How do I draw a tree more than once?


I have filled a TTree from a file, and can draw it to a canvas using the command:


However, when I draw it again on a different canvas, the graph is severely distorted. The only way I found to fix this is by TTree->CloneTree(). Is there a better way? My end goal is to draw the TTree to a histogram (I don’t care about drawing the Tree on a canvas). Right now after I create the histogram with:

TH1 ht = (TH1)gDirectory->Get(“fft”);

The histogram is severely distorted. How can I fix this?

Thanks for your help,

When doing Tree->Draw(“rate:time”) 2 objects are generated
-an empty “temp” TH2F used to set the pad range and axis.
-a TGraph containing all the points with the original precision.

When doing Tree->Draw(“rate:time>>fft”) one TH2F object named “fft” is created.
This histogram contains the ratime:time points filled in bins, so loosing
the original resolution.
You can do the following:

Tree->Draw("rate:time>>fft"); TH1 *ht = (TH1*)gDirectory->Get("fft"); TGraph *g = (TGraph*)gPad->GetPrimitive("Graph"); gPad->GetListOfPrimitives()->Remove(g); ht->Reset(); ht->GetListOfFunctions()->Add(g,"p"); ht->Draw();