I would like to save for each event in the tree corresponding TH1F histos, and TMulitGraph objects (for checking and other reasons). I meet two problems with this:
I save TH1F histo as follows:
in event.h:
class event: public TObject {
public:
SetHisto(TH1F* p ) {p->Copy(fHisto)};
private:
TH1F fHisto; //|| histo to save as a leaf
};
TH1F *p = new TH1F(…);
p->Fill(something);
event->SetHisto§;
Afterwards it is saved into the root file without any complains. The problem is : how to access it for each event? Is there an elegant way to navigate event by event and plot the histos?
second problem is with TMultiGraph object: I do not understand how to save it to event? Copy() does not work (it does not comlain but also does nothing), there is no copy constructor, …
Please help if you know the solution.
Best regards, Dmitry
It works (saves in the tree). I am still missed how to read it back. Let me illustrate my problem by the following small test macro. It can be run as
root[] .L testTMultiGraph.C
root[] testTMultiGraph()
root[] Plot(1);
it crashes when I want to access the TMultiGraph object because most probably I am doing it wrongly.
Thanks a lot.
Dmitry