# Read .rz file in ROOT 5 series

**URL:** <https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735>\
**Category:** Garfield++\
**Created:** [March 3, 2016, 4:09pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735 "2016-03-03T16:09:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 3, 2016, 4:09pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/1 "2016-03-03T16:09:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 3, 2016, 4:39pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/2 "2016-03-03T16:39:27Z")

</div>

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

```auto
$ h2root yourfile.hbook your file.root
```

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 9:09am UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/3 "2016-03-04T09:09:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 4, 2016, 9:12am UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/4 "2016-03-04T09:12:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 9:23am UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/5 "2016-03-04T09:23:07Z")

</div>

/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.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 4, 2016, 9:31am UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/6 "2016-03-04T09:31:51Z")

</div>

```auto
echo $ROOTSYS 
```

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 9:34am UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/7 "2016-03-04T09:34:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 9:54am UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/8 "2016-03-04T09:54:58Z")

</div>

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:

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

```

but h2root still returns

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

```

---

<div class="post-metadata">

**Author:** ![mato](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mato/32/12317_2.png) [@mato](https://root-forum.cern.ch/u/mato)\
**Post date:** [March 4, 2016, 1:02pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/9 "2016-03-04T13:02:28Z")

</div>

If you follow the instructions in [root.cern.ch/content/release-53434](https://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):

```auto
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
```

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 2:46pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/10 "2016-03-04T14:46:45Z")

</div>

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

```auto
$ 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:

```auto
 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
```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 4, 2016, 3:00pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/11 "2016-03-04T15:00:56Z")

</div>

> [@](#):
>
> The hbook file looks like this:

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 ?

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 3:08pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/12 "2016-03-04T15:08:03Z")

</div>

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](https://www.dropbox.com/s/8mcl1uuu43fdyzk/drift-16.hbook?dl=0)

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

- I also have a .rz file: [dropbox.com/s/4fn4o3vdjwtsa … 14.rz?dl=0](https://www.dropbox.com/s/4fn4o3vdjwtsam8/drift_time00-14.rz?dl=0)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 4, 2016, 3:16pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/13 "2016-03-04T15:16:55Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![rjseen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@rjseen](https://root-forum.cern.ch/u/rjseen)\
**Post date:** [March 4, 2016, 3:21pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/14 "2016-03-04T15:21:33Z")

</div>

I see… I feel silly now 😆

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 21, 2018, 2:41pm UTC](https://root-forum.cern.ch/t/read-rz-file-in-root-5-series/20735/15 "2018-06-21T14:41:04Z")

</div>

Closed on June 21, 2018, 2:41pm UTC

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