Hi,
I have an NTuple and I want to do some fast analysis. When
I do ntuple->Draw("variable") it draws a nice histogram. How can I get a
copy of it? In the following macro I use a trick with cloning histogram
htemp created by TNtuple::Draw. However, this is not working for 2D
histograms. What is wrong? Is there any way to get a histogram from
TNtuple::DrawClone() ?
Regards,
Miro
I'm using version 25_03 for SuSe Linux
Macro:
{
// first generate ntuple
TNtuple *ntuple = new TNtuple("ntuple","ntuple","Ehit:yhit");
Double_t Ehit,yhit;
for (Int_t i=0;i<100;i++) {
Ehit = gRandom->Gaus(10.,0.5);
yhit= gRandom->Gaus(0.,0.7);
ntuple->Fill(Ehit,yhit);
}
// plots
TCanvas* c1 = new TCanvas("c1","c1",1);
c1->Divide(2,2);
// trick with 1D histograms
c1->cd(1);
ntuple->Draw("Ehit");
TH1F * myh1 =(TH1F *) htemp->Clone();
myh1->SetName("myh1");
c1->cd(2);
myh1->Draw(); // this works
// trick with 2D histograms - doesn't work!
c1->cd(3);
ntuple->Draw("Ehit:yhit");
TH2F *myh2 = (TH2F *) htemp->Clone();
myh2->SetName("myh2");
c1->cd(4);
myh2->Draw(); // it is empty!
}
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:37 MET