Re: [ROOT] Problem to sum 3 large TTree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jun 08 2000 - 09:59:57 MEST


Hi Andrei,
I do not understand how you have been able to create the original 3 files.
With 991936 entries, each file should be around 16.2 GBytes (uncompressed).
Probably, you had a huge compression factor such that each file was just below
the 2 GByte size.
Could you send me the result of FCube.Print() for each original file ?

Rene Brun

Andrei Daniel wrote:
> 
> Hi Rooters!
> 
> After 3 ours of work program gave me the next message.
> I used Alpha working under Digital Unix and
> ROOT version 2.23/12.
> 
>       Fatal in <CustomReAlloc2>: storage exhausted
> aborting
> 
> I have 3 TFiles. Each file includes the same TTree created
> from the different data. Now I want to sum these data and
> write result in the new TFile. What may be wrong or can be
> changed in the next part of code? Let me note that each TFile
> can be read separately without errors.
> 
> Thanks in advance.
> 
> Andrei
> 
> const int nx = 1408;
> const int n  = nx * (nx + 1) / 2;
> const int nz = 8192;
> 
>    TROOT sumofcubes ("sumofcubes","Sum Data of 3 Cubes");
> 
>    struct
>    {
>       unsigned short sbuf[nz];
>    } buf1,buf2,buf3;
>    struct
>    {
>       float fbuf[nz];
>    } buf4;
> 
>    int i, n1, n2, ix, iy, iz;
> 
>    TFile *F1 = new TFile("a1.root", "read");
>    TTree *Cube1 = (TTree*) F1->Get("Cube");
>    Cube1->SetBranchAddress("Spectrum", buf1.sbuf);
> 
>    TFile *F2 = new TFile("a2.root", "read");
>    TTree *Cube2 = (TTree*) F2->Get("Cube");
>    Cube2->SetBranchAddress("Spectrum", buf2.sbuf);
> 
>    TFile *F3 = new TFile("a3.root", "read");
>    TTree *Cube3 = (TTree*) F3->Get("Cube");
>    Cube3->SetBranchAddress("Spectrum", buf3.sbuf);
> 
> 
>    TFile *FOUT = new TFile("as.root","recreate");
>    TTree *FCube = new TTree("FCube","SUM OF 3 Weeks");
>    TBranch *Spectrum = FCube->Branch("Spectrum",buf4.fbuf,"fbuf[8192]/F");
> 
>    for(i = 0; i < n; ++i)
>    {
>       Cube1->GetEntry(i);
>       Cube2->GetEntry(i);
>       Cube3->GetEntry(i);
> 
>       for(iz = 0; iz < nz; ++iz)
>       {
>          buf4.fbuf[iz] = (float) buf1.sbuf[iz]
>                        + (float) buf2.sbuf[iz]
>                        + (float) buf3.sbuf[iz];
>       }
> 
>       FCube->Fill();
>    }
> 
>    FCube->Write();
> 
>    F1->Close();
>    F2->Close();
>    F3->Close();
> 
>    FOUT->Close();
> }
> 
> ----------------------------------------
> Andrei Daniel
> FLNR, JINR, Dubna 141980, Russia
> Tel: (7-09621)64568  Fax: (7-09621)65083
> daniel@cv.jinr.ru



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET