Hello,
I’m trying to do the following:
-
retreave several TH2F objects from the same TTree but with different selection cuts, and add them to a TList:
TList* list;
tree->Draw(“variable(binning)”, cut1);
TH2F* histo1 = (TH2F*) tree->GetHistogram();
list->Add(histo1);
tree->Draw(“variable(binning)”, cut2);
TH2F* histo2 = (TH2F*) tree->GetHistogram();
list->Add(histo2);
etc … -
to merge them into a final TTree:
TH2F* finalhisto = (TH2F*) histo1->Clone(“finalhisto”);
finalhisto->Reset();
finalhisto->Merge(list);
I have the following message:
Error in TH2F::Add: Attempt to add object of class: TObject to a TH2F
but I define the TH2F* histogrammes I merge properly …
Thank you very much for your help.
Best regards, Selim