Problems with Th3F

Dear experts,

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.

Cheers,
Marcus

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…

Hi,

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.

Thanks,

Marcus
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.
I did:

void DrawTH3F(){
  TFile* f = TFile::Open("CorrectPDF.root");
  TH3F* h = f->Get("1prong/both/hpdf_1prong_both_v22");
   TFile *t = new TFile("t.root","NEW");
   h->Draw();
   h->Write();
}

So now I have the histogram in t.root.
I do:

root [0] TFile f=("t.root");
root [2] f.ls()
TFile**		t.root	
 TFile*		t.root	
  KEY: TH3F	hpdf_1prong_both_v22;1	calRadius
root [3] 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.