Hi everyone,
i’m trying to write more histograms to a file.
I’m doing:
TH1D **h=new TH1D*[5];
for (int i=0;i<5;i++){
h[i]=new TH1D(name,title,nbinsx,xmin,xmax); //all parameters are present, and names are different
}
..
..
TFile f("out.root","recreate");
f.cd();
for (int i=0;i<5;i++){
h[i]->Write();
}
f.Write();
f.Close();
When i open the TFile, and use ls(), i see only the last histogram: how can i save all of them?
Thanks in advance
[quote]When i open the TFile, and use ls(), i see only the last histogram: how can i save all of them?
Thanks in advance[/quote]This must mean that the name are not different (your code snippet does use the same name for all histo).