I have produced histograms with 5.14/00g (9 July 2007) and a colleague wants to read it with Version 4.00/08 1 December 2004. It is not possible:
bash-3.00$ root Rick_AllSB-lowMll_110.root
Attaching file Rick_AllSB-lowMll_110.root as _file0…
R__unzip: error in header
root  _file0->ls()
Error: illegal pointer to class object _file0 0x0 42 FILE:(tmpfile) LINE:1
*** Interpreter error recovered ***
The file is 1d histograms. Is there anyway to write them to ascii or some neutral format and convert them back to root so that they can be read in root v4. The weights are used and important.
just to put this into context: you are asking a Word 2007 file to be opened by Word 2003. That usually only works the other way around.
ROOT is promising backward compatibility for data (read old files with a new ROOT), and it does its best at keeping forward compatibility (i.e. allowing old ROOT installations to read new data). You seem to have found a case where this fails. The error message might also stem from the fact that the file that ROOT v4.00/08 is reading got corrupted.
So the solutions are: check that the file is correct (e.g. using md5sum) and / or install a new ROOT version. It’s free!
Hello fellow 4_00_08g user (That’s just a fancy name for somebody on CDF),
[quote=“stdenis”]Is there anyway to write them to ascii or some neutral format and convert them back to root so that they can be read in root v4. The weights are used and important.
You can write a dump function that dumps all necessary information to a text file (in Root 5) and another function that reads it back in (in root 4).
That being said, CDF now even has access to 5.22 where you can even use PyRoot.
Yes, I suspected that was the answer and Kevin Lannon sent me a script to do what was needed. I was fearful about the error handling working out since they were weighted histos, but since they were filled with the sumw2 they preserved the errors on the text transform.
I have been using root 5 for years. The problem I ran into was handing histograms to a student who was preparing for conference and no able to do a new validation of his code against a new version of root. Instead we made sure we got the same answer with the histograms with me running against root5 where I text transformed and then untransformed, he used text transformed and untransformed in 4.
The microsoft example is particularly amusing for me. I gave up fighting the various formats of address and calender and use a plain, flat text file.
… which was the solution here.
Note that for the text transform you can simply use:[code]myhist->SaveAs(“myscript.C”);[code]which give your directly the C++ needed to reconstruct the histogram.