Hi Robert,
Don't worry. The small branches are written out.
When you call TTree::Print, branches for which the buffer in memory
has not yet been written are shown as 0 bytes.
I know that this is somehow misleading and I will improve this in a next
version.
At the time of TTree::Print, I do not know yet the exact size on the
file
in case the file is compressed. However, I could print the current
number
of bytes really used in the buffer.
Rene Brun
Robert Feuerbach wrote:
>
> Hi,
>
> I'm having a problem with "small" branches not being written out, until
> it contains enough data. The problem appears to be related to the
> buffer size, though I haven't been able to figure out what exactly is
> going wrong. The version of ROOT I'm using is 2.23/12, running on a linux
> box (RedHat 5.2) with egcs-1.1.2. The test case I'm using is:
>
> //************ testclass.h **************//
> #include <iostream>
>
> #include <TObject.h>
>
> extern "C" {
> #include "ROOTtypes.h"
> }
>
> class AClass : public TObject {
> public:
> AClass(Int_t a1=0,Int_t a2=3);
> virtual ~AClass();
> void SetVal(Int_t aa, Int_t ab) { a1=aa, a2=ab; }
>
> private:
> Int_t a1, a2;
>
> public:
> ClassDef(AClass,1)
> };
> //*********** testclass.cc ************//
> #include "testclass.h"
>
> ClassImp(AClass)
> AClass::AClass(Int_t aa, Int_t ab) : a1(aa), a2(ab) {
> cerr << "AClass "<<a1<<" "<<a2<<" being created.\n";
> }
> AClass::~AClass() {
> cerr << "\tAClass "<<a1<<" "<<a2<<" being destroyed.\n";
> }
> //************ main routine ***********//
> #include <iostream>
> #include <stdlib.h>
> #include "testclass.h"
> #include "TROOT.h"
> #include "TFile.h"
>
> int main(int argc, char * argv[]) {
>
> static TROOT Root("Root","Test");
> static TTree *tree;
> static AClass *A = 0;
> static TBranch *Abr;
> TFile fRootfile("test.out","RECREATE","Test file");
> tree = new TTree("T","test tree");
>
> int i, j;
>
> Int_t max = 10;
> Int_t bufsize=16000;
> Int_t split = 1;
> Int_t compress = 2;
> Int_t autosave = 1000000;
>
> cout << "Max = "<<max<<".\n";
> cout << "Compression = "<<compress<<".\n";
> cout << "Split = "<<split<<".\n";
> cout << "Bufsize = "<<bufsize<<".\n";
> cout << "AutoSave = "<<autosave<<".\n";
>
> fRootfile.SetCompressionLevel(compress);
> tree->SetAutoSave(autosave);
>
> for (i=0; i<max; i++) {
> for (j=20; j<max+20; j++) {
> if (!A) {
> A = new AClass(i,j);
>
> Abr = tree->Branch("a","AClass",&A,bufsize,split);
> tree->SetBranchStatus("a",1);
> }
>
> if (A) {
> A->SetVal(i,j);
> }
>
> tree->Fill();
> }
> }
>
> fRootfile.Write();
> tree->Print();
>
> return 0;
> }
>
> With a buffersize = 16000 (the default), until max > 60 the tree->Print()
> called at the end shows that the # of entries is correct, but 0 bytes for
> each branch are being written out. When I look at the file in ROOT, I get
> the same thing. Am I doing something wrong?
>
> Thanks for the help,
> Rob Feuerbach
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET