Is it possible to copy tree branch contents to a TH1?

[color=darkred]Dear rooters,

I have come across having to convert a 1D tree plot to a 1D histogram. Is there actually a way to do that? Maybe create an empty TH1F and copy the tree branch into it!? :confused:

Thanks in advance for your help,
Maryam M. [/color]

Maryam,

Humm … what do you mean? How did you ‘obtain’ the original “1D tree plot”? Most likely it is just a matter of tuning of the parameter of the call creating the plot?

Cheers,
Philippe

[color=darkred]Hi Philippe,
Thanks for your reply. I was just trying to avoid running my code again, because I fill a tree and create my root file within my c++ code. I was trying to find a way to play with my rootfile without having to do another round of running and waiting. But I guess I will need to do that anyway! :wink:

Thanks again,
Maryam[/color]

[quote]I was trying to find a way to play with my rootfile without having to do another round of running and waiting. But I guess I will need to do that anyway! Wink[/quote]Humm … I must be missing something important :slight_smile: … Avoiding to re-run the code that produced the TTree is the raison d’etre of storing you data in a TTree to begin with. You have many tools (you might want to re-read the User’s Guide chapter on analyses of TTree) at your disposable to re-read data (TTreeViewer, TTree::Draw, TTree::MakeSelector, etc.).

Philippe.