I have some trouble with TH3F stored in TFile. Somehow if I look at them using the TBrowser the axis ranges are corrupt (e.g. the have been produced for z in 0,20, but are shown from 8 to 20) and thus the stats (e.g. mean) don’t make sense, even if I reset the range by SetRangeUser. However if I use them in a tool, which basically reads the bin content for a given (x,y,z) point the information is correct. The problem now is that I have to validate a new tool, which is supposed to produce mainly the same (but not exactly) results, such that I need to compare those histograms. The only way which came to my mind to solve this problem is to loop over all bins and rewrite the information into a new TH3F, which is somehow a big overhead. Thus I would like to ask if there is a known bug with TH3F’s?
BTW, I already tried several root versions, several ways to access the content (TBrowser, CINT, macros), but nothing works so far.
Many thanks in advance fo any hint.
Do you have a small macro reproducing the problem ?
I do not see any reasons why the saved TH3F should be different when you read it back…
I have attached a small tar archive, which holds a small macro to Draw the TH3F and two root files (pdfs_tau.root - corrupt one; CorrectPDF - as it should look like). I also do not see why it should be different when reading back.
PDFs.tar.gz (140 KB)
I see that the histogram in pdfs_tau.root is wrong and that the one in CorrectPDF.root is fine.
TFile* f = TFile::Open("CorrectPDF.root");
TH3F* h = f->Get("1prong/both/hpdf_1prong_both_v22");
TFile *t = new TFile("t.root","NEW");
So now I have the histogram in t.root.
root  TFile f=("t.root");
root  f.ls()
KEY: TH3F hpdf_1prong_both_v22;1 calRadius
root  hpdf_1prong_both_v22->Draw()
And I get exactly the same plot as the one I got with CorrectPDF.root. So the histogram saving is not the faulty bit. I am afraid I cannot help you further as I do not know how you generated the faulty file.