Converting more than 1000 .hbk files to .root files

HI i have some 1000 .hbk files containing root histograms . I want to convert these to .root files then combine them together to view and access the data stored in those histograms

Hi,

have you tried h2root?
root.cern.ch/how/how-convert-hb … root-files

Cheers,
Danilo

Hi,

Now i have figured out how to convert .hbk files to .root files using h2root but i am getting another problem. When i convert .hbk files to .root files using h2root i am getting number of entries as zero. The .hbk file size is say 623K, then the .root file size is 13K. I have root version 6.06/02 and using ubuntu 14.04LTS. please help .

Can you provide one of the faulty book file ?
(please avoid multiple posting).

sorry for the multiple posting .i am new to the forum. when i am trying to attach the .hbk file using attachments its showing invalid file extension

-aman

You can change the extension to something it will accept (txt I think is fine) or put the file in some public place like Dropbox…

Hi please find the file attached
B02gg-evtgen-uds-55-0-9.txt (628 KB)

Yes h2root gives me empty histograms too. Are you sure they are not already empty in the hbook file ?
I have tried the following:

root [0] THbookFile*h = new THbookFile("B02gg-evtgen-uds-55-0-9.hbook")
root [1] h->ls()
 ===> Directory : //lun10
          1 (N)   B0->gammagamma  
        100 (1)   Total Number of events  
        101 (1)   Total no of gamma in each event 
        102 (1)   No of gamma in each event after preselection
        103 (1)   No of B0 candidates in each event after combination for gamma gamma 
        104 (1)   No. of B0 candidates in each event after pre-selection cuts for gamma gamma 
        105 (1)   No of charged tracks in each event  
        106 (1)   hepid of all gammas 
        107 (1)   energy of all gammas@lab
        108 (1)   enegry of all gammas@CM 
        109 (1)   energy of selected gammas at cm 
        110 (1)   hepid of selected gammas
        111 (1)   charge of selected particles from mdst_gamma

root [4] TH1F *h100 = (TH1F*)h->Get(100);
root [5] h100->Draw()
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [6] 

It gives me an empty plot too…

Yes i am sure they are not already empty in hbook file as the remote host from which i copied the files. if i give the same command there then it has filled histograms. Also if we look at the file size of .root file then it is just 13K as compared to the hbook file size of 623K. is there some problem with copying from remote host. Probably if u can suggest something. I used scp to copy…

-aman

What to you mean ? how do you examine the file on the remote machine ?

I am working with kek-belle collaborators so they have access to kek cc in which root is installed and hence they can convert .hbk file to .root file there also. Hope it is making sense

–aman

That was not my question…

You said:

I guess “there” is the KEK machine ? … What is the “same command” you “give there” to see that the histogram are filled ?

In principle, “.hbook” files are binary files.
You attached it here as a text (".txt") file which may mean that its contents was quietly modified (e.g. in order to convert between unix/dos/mac text formats).
Can it be that you transferred the file from your “remote machine” using scp in “Text/ASCII Transfer Mode”?
Try to run “md5sum -b YourHbookFile.hbook” on your “remote machine” and then on your “local machine” (if you get exactly the same string then your file was not modified).
I get:
5daad6488bff160ed82c99ca5cc637af *B02gg-evtgen-uds-55-0-9.txt

thank u all my problem is solved. what is did is copied the files again from remote host using scp command and re installed latest version of root on my system. so all my hbook files are now working fine except a few which are originally empty (i.e. in the remote host as well) including the one which i have sent you…