Re: [ROOT] problem with compression level

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu May 30 2002 - 17:44:42 MEST


Hi Miro,

The problem is due to the fact that you create the Tree and the branch
before opening the file. In this case, the compression level is taken
from the current file (if one exists) or set to -1 (no compression).
However, calling SetFile a posteriori causes a problem during filling.
I have now fixed this problem in the CVS version.
Thanks for reporting this special case.

Rene Brun

On Thu, 30 May 2002, Miroslav Helbich wrote:

> 
>  Hi rooters,
> 
>  I encounterd a following problem. When a file is opened after the
> tree definition, there seems to be a problem with the compression
> level for the tree. As you can see it is 499.94 for the tree while it
> is set to 1 for the file.
> 
> I had this programmed in the class, when the tree is opened anyway even if
> the file is not specified (then it is in the memory). 
> 
>  I am using Version   3.03/05  for suse linux.
> 
> 						Miro Helbich
> 
> a macro:
> 
>  
> {
> int fEventNr;
> 
> // OutputTree
> TTree* fTruthTree = new TTree("h1","MC Truth from LumiFast");
> fTruthTree->Branch("EventNr",&fEventNr,"EventNr/I");
> 
> TFile* fTruthFile = new TFile("test.root","RECREATE","LFast file",1);
> fTruthTree->SetDirectory(fTruthFile);
> 
> for (int i=0;i<50000;i++) {
>   fEventNr = i;
>   fTruthTree->Fill();
> }
> 
> fTruthTree->Print();
> cout << "Compression factor: "<<fTruthFile->GetCompressionFactor()<<endl;
> cout << "Compression level : "<<fTruthFile->GetCompressionLevel()<<endl;
> 
> }
> 
> 
> an output:
> root [0] .x bug.C
> R__zip: bad pack level
> R__zip: bad pack level
> R__zip: bad pack level
> R__zip: bad pack level
> R__zip: bad pack level
> R__zip: bad pack level
> ******************************************************************************
> *Tree    :h1        : MC Truth from LumiFast                                 *
> *Entries :    50000 : Total =          392424 bytes  File  Size =        384 *
> *        :          : Tree compression factor = 499.94                       *
> ******************************************************************************
> *Br    0 :EventNr   : EventNr/I                                              *
> *Entries :    50000 : Total  Size=     200448 bytes  File Size  =        384 *
> *Baskets :        6 : Basket Size=      32000 bytes  Compression= 499.94     *
> *............................................................................*
> Compression factor: 1
> Compression level : 1
> root [1]                      
> 



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