Re: [ROOT] Troubles with THbookFile and THbookTree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Oct 25 2002 - 11:38:03 MEST


Hi Luigi,

Thanks for giving me access to your files. I see the problem now.
The current implementation of THbookFile does not support the case
where two Hbook files are connected and both containing the same histogram
IDs. Closing the first file solves the problem.
Finding a solution may take some time. Converting to a Root file
is the best solution.

Rene Brun

On Thu, 24 Oct 2002, Bardelli Luigi wrote:

> Dear Rooters,
>      I'm experiencing troubles with  THbookFile and THbookTree: I have two
> files with the same structure and a ntuple inside, and I'd like to compare
> them. The files are different, as I checked out both with PAW and ROOT
> opening them separatly.
> 
> This is my script:
> 
> {
>   gSystem->Load("libHbook");
> 
>   THbookFile *file1=new THbookFile("lqtau_s0l_m600_11.ntp",8192);
>   file1->ls();
>   printf("Now Get #1: file1 is 0x%x\n",(int )file1);
>   THbookTree *tree1=(THbookTree*)file1->Get(1);
>   printf("Now Draw #1: tree1 is 0x%x\n", (int)tree1);
>   tree1->SetName("tree1");
>   tree1->Draw("Cal_pt");
>   // file1->Close(); // <<==
> 
>   THbookFile *file2=new THbookFile("cc_q210.ntp",8192);
>   file2->ls();
>   printf("Now Get #2: file2 is 0x%x\n",(int )file2);
>   THbookTree *tree2=(THbookTree*)file2->Get(1);
>   printf("Now Draw #2: tree2 is 0x%x\n", (int)tree2);
>   tree2->SetName("tree2");
>   tree2->SetLineColor(2);
>   tree2->Draw("Cal_pt","","same");
> }
> 
> Executing I get:
>  ===> Directory : //lun10
>           1 (N)   ORANGE  
>        1103 (2)   VCMONFIT CTD AX:Y=fit,X=M-F 
>        1104 (1)   VCMONFIT CTD AX: (M-F)  
>         331 (1)   VCMONFIT CTD AX(FADC): (M-F)
>         332 (1)   VCMONFIT CTD AX(ZBYT): (M-F)
>        1105 (2)   VCMONFIT CTD ZBYT:Y=fit,X=M-F   
>        1106 (1)   VCMONFIT CTD ZBYT:M-F   
>        1107 (2)   VCMONFIT CTD STER:Y=fit,X=M-F   
>        1108 (1)   VCMONFIT CTD STER: (M-F)
>         201 (1)   VCMONend CTD AX: (M-F)  
>         202 (1)   VCMONend CTD ZBYT:Y=M-F,X=fit   
>         203 (1)   VCMONend CTD ZBYT:M-F   
> Now Get #1: file1 is 0x8713db8
> Now Draw #1: tree1 is 0x8718050
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> 
> 
>  ===> Directory : //lun11
>           1 (N)   ORANGE  
>        1103 (2)   VCMONFIT CTD AX:Y=fit,X=M-F 
>        1104 (1)   VCMONFIT CTD AX: (M-F)  
>         331 (1)   VCMONFIT CTD AX(FADC): (M-F)
>         332 (1)   VCMONFIT CTD AX(ZBYT): (M-F)
>        1105 (2)   VCMONFIT CTD ZBYT:Y=fit,X=M-F   
>        1106 (1)   VCMONFIT CTD ZBYT:M-F   
>        1107 (2)   VCMONFIT CTD STER:Y=fit,X=M-F   
>        1108 (1)   VCMONFIT CTD STER: (M-F)
>         201 (1)   VCMONend CTD AX: (M-F)  
>         202 (1)   VCMONend CTD ZBYT:Y=M-F,X=fit   
>         203 (1)   VCMONend CTD ZBYT:M-F   
> Now Get #2: file2 is 0x8d288b8
> Now Draw #2: tree2 is 0x8d2ca48
> (Int_t)4983
> root [1] 
> 
> but i don't get two different superimposed histograms, but only one (as if
> the input files were the same).
> The "SetName" commands don't seem to alter this behaviour.
> If now I uncomment the 
> 
> file1->Close(); // <<==
> 
> and execute, I get:
> 
>  ===> Directory : //lun10
>           1 (N)   ORANGE  
>        1103 (2)   VCMONFIT CTD AX:Y=fit,X=M-F 
>        1104 (1)   VCMONFIT CTD AX: (M-F)  
>         331 (1)   VCMONFIT CTD AX(FADC): (M-F)
>         332 (1)   VCMONFIT CTD AX(ZBYT): (M-F)
>        1105 (2)   VCMONFIT CTD ZBYT:Y=fit,X=M-F   
>        1106 (1)   VCMONFIT CTD ZBYT:M-F   
>        1107 (2)   VCMONFIT CTD STER:Y=fit,X=M-F   
>        1108 (1)   VCMONFIT CTD STER: (M-F)
>         201 (1)   VCMONend CTD AX: (M-F)  
>         202 (1)   VCMONend CTD ZBYT:Y=M-F,X=fit   
>         203 (1)   VCMONend CTD ZBYT:M-F   
> Now Get #1: f1 is 0x8713dd8
> Now Draw #1: t1 is 0x8718070
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> 
> 
>  ===> Directory : //lun10
>           1 (N)   ORANGE  
>        1103 (2)   VCMONFIT CTD AX:Y=fit,X=M-F 
>        1104 (1)   VCMONFIT CTD AX: (M-F)  
>         331 (1)   VCMONFIT CTD AX(FADC): (M-F)
>         332 (1)   VCMONFIT CTD AX(ZBYT): (M-F)
>        1105 (2)   VCMONFIT CTD ZBYT:Y=fit,X=M-F   
>        1106 (1)   VCMONFIT CTD ZBYT:M-F   
>        1107 (2)   VCMONFIT CTD STER:Y=fit,X=M-F   
>        1108 (1)   VCMONFIT CTD STER: (M-F)
>         201 (1)   VCMONend CTD AX: (M-F)  
>         202 (1)   VCMONend CTD ZBYT:Y=M-F,X=fit   
>         203 (1)   VCMONend CTD ZBYT:M-F   
> Now Get #2: f2 is 0x87181d8
> 
>  *** Break *** segmentation violation
> Root > 
> 
> If I convert them all to .root with h2root, everything works fine.
> Can you help me?
> Thanks
> 	Luigi
> 
> PS: I'm using ROOT 3.03/06 compiled on a RedHat 7.2 box with gcc version
> 2.96.
> 
> 
> ,------------------------------------------------------------------,
> | Luigi Bardelli                                                   |
> |------------------------------------------------------------------|
> | INFN Sezione di Firenze                                          |
> | Tel: +39-055-457-2255                                            |
> | E-Mail: bardelli@fi.infn.it                                      |
> `------------------------------------------------------------------'
> ** Please avoid sending me Word or PowerPoint attachments.
> ** See http://www.fsf.org/philosophy/no-word-attachments.html 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:15 MET