Splitting big root files to smaller ones

Hi experts,
I have a big root file containing a tree which has more than 5million
entries in it.
When I try to call tree->GetEntries(); since the number of entries
is so large it takes a long time and finally because it overloads the memory it aborts and simply goes out of ROOT.
Is there any way to split a big root file to smaller files.
Thanks,
Majid

he time to call tree->GetEntries must be independent of teh Tree size.
You must have another problem. My guess is that you have created
a memory resident tree.
Could you send the output of tree->Print() ?

Rene

Hi Rene,
I have copied the output of root tree show and print.
When I run it on a pc with 512MB RAM it works after a long time but
with lxplus it crashes.
Cheers,
Majid

[lxplus055] ~/scratch0/newtest/HTBDAQ_data/tools > root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   4.03/02  10 February 2005   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.159, Nov 14 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
 fdlopen 
root [0] TFile f("min15E.root");
root [1] t->Print();
[lxplus055] ~/scratch0/newtest/HTBDAQ_data/tools > root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   4.03/02  10 February 2005   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.159, Nov 14 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
dlopen 
root [0] TFile f("min15E.root");
root [1] t->Show(1);
[lxplus055] ~/scratch0/newtest/HTBDAQ_data/tools > ls -l min15E.root
-rw-r--r--    1 hashemim zh       75244574 Apr 21 17:02 min15E.root
[lxplus055] ~/scratch0/newtest/HTBDAQ_data/tools >

You forgot to include the result of tree->Print()

Rene

Hi Rene,
No it is correct.
I mean it takes a long time and then just simply the ROOT session
is killed and it goes to shell command prompt without any output.
Cheers,
Majid

OK, this confirms my initial guess. You have create a memory-resident
Tree on a machine with a lot of memory, saved it to a file.
Now you are trying to read it on a machine with less memory.

A memory-resident tree is typically generated by mistake with

TTree *T = new TTree(“T”,…)
TFile *f = new TFile(…);
instead of
TFile *f = new TFile(…)
TTree *T = new TTree(…

Rene

Dear Rene,

I have a big root file in my remote area and I want to copy it to my local system but problem is I am seeing disk quota exceed so Could you give any hints how to splits it into number of small root files sothat I can copy easily and later I can add it by TChain.

Thanks in advance,
Nibedita.