Read .rz file in ROOT 5 series

Hi,

I have a .rz file containing a histogram from Garfield that I want to import to ROOT 5.34.

How would I go about this? Is it at all possible? I can’t seem to find anything on the subject.

Any help appreciated.

Best regards
Richard

The best way is to translate your hbook file to ROOT format using h2root.

$ h2root yourfile.hbook your file.root

Thank you for your answer.

I am running root 5.34.32 on lxplus but I could not run that command.

I also tried creating a soft-link from

/afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.32/x86_64-slc6-gcc49-opt/root/bin/h2root

and did

./h2root drift15.hbook drift15.root

but then it returned

./h2root: error while loading shared libraries: libquadmath.so.0: cannot open shared object file: No such file or directory

What am I overlooking?

In principle h2root should be installed with root.
When you type “which root” what do you get ?
Is $ROOTSYS defined for you ?

/usr/bin/root

How would I go about checking if $ROOTSYS is defined? I have encountered people referring to it in older posts, but I couldn’t make sense of it.

echo $ROOTSYS 

Returns nothing so I assume it’s not set. Where do I set it?

If I

source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.32/x86_64-slc6-gcc49-opt/root/bin/thisroot.sh

the output of echo $ROOTSYS

becomes:

/afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.32/x86_64-slc6-gcc49-opt/root

but h2root still returns

./h2root: error while loading shared libraries: libquadmath.so.0: cannot open shared object file: No such file or directory

If you follow the instructions in root.cern.ch/content/release-53434
This is what you need to do (the compiler setup is needed because is the native compiler in slc6):

source /afs/cern.ch/sw/lcg/external/gcc/4.9/x86_64-slc6-gcc49-opt/setup.sh
source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.34/x86_64-slc6-gcc49-opt/root/bin/thisroot.sh

Having done as you suggested running h2root generates a segmentation fault. What can this be caused by?

$ h2root drift-16.hbook htest.root


 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f41159b265e in waitpid () from /lib64/libc.so.6
#1  0x00007f4115944609 in do_system () from /lib64/libc.so.6
#2  0x00007f411a29707a in TUnixSystem::StackTrace() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.34/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#3  0x00007f411a29904c in TUnixSystem::DispatchSignals(ESignals) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.34/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#4  <signal handler called>
#5  0x0000000000427ac7 in rzopen_ ()
#6  0x00000000004125b4 in hropen_ ()
#7  0x0000000000407128 in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x0000000000427ac7 in rzopen_ ()
#6  0x00000000004125b4 in hropen_ ()
#7  0x0000000000407128 in main ()
===========================================================


Segmentation fault

The hbook file looks like this:

 1 *----.----1----.----2----.----3----.----4----.----5----.----6----.----7----.----8----.----9----.---10----.---11----.---12----.---13--
  2 % Created 04/03/16 At 15.35.19 HT1      HIST     "none                         "
  3  HISTOGRAM INFORMATION:
  4  Minimum:    0.00000000E+00
  5  Maximum:    0.30000001E+00
  6  Bins:             499
  7  Range set: T
  8  Integer:   F
  9  Sums:       0.10000000E+05 0.17639770E+04 0.31678157E+03
 10  Entries:        10000
 11  CONTENTS
 12          0 0.00000000E+00
 13          1 0.00000000E+00
 14          2 0.00000000E+00
 15          3 0.00000000E+00
 .
 .
 .
507	     495 0.00000000E+00
508        496 0.00000000E+00
509        497 0.00000000E+00
510        498 0.00000000E+00
511        499 0.00000000E+00
512        500 0.00000000E+00

What do you mean ? it is really an ascii file like that ? … that’s not an book file in that case…
Can you post it here to see what it is really ?

I tried but the forum returns “Error: Invalid file extension: drift-16.hbook” .

Instead I will link it from my dropbox: https://www.dropbox.com/s/8mcl1uuu43fdyzk/drift-16.hbook?dl=0

Also note I am using Garfield, not Garfield ++, if that matters.

Yes … I see… that’s not an book file … it is an Assci file containing values which you can read using standard C++ i/o. It seems you have data for one histogram there… Just read them and fill a ROOT TH1D with it.
You cannot use h2root on that …

I see… I feel silly now :laughing:

Thanks for your time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.