Re: MakeClass()

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Mon, 05 Feb 2007 06:53:00 +0100


Hi Monika,

You should use a TChain to process a collection of files

  TChain chain("VW");
  chain.Add("filename_*.root");
  chain.MakeClass("something");  

Rene Brun

Monika Sharma wrote:
>
> Hi Rooters,
>
> I am trying to use MakeClass function to read a .root file.
> Following is a typical example of what I am doing :
>
> ========================================
> void analysis()
> {
>
> TFile *f = new TFile("Event_transport.root");
> TTree *v = (TTree*)f->Get("VW");
> f->ls();
>
> v->MakeClass("something");
> }
> =========================================
>
> This generates a .C and a .h file, which works fine for me.
> But now my aim is to increase statistics. Therefore I have two rootfiles
> each of ~2 GB size, as a result I cannot merge them any further.
>
> I wanted to ask is there anyway that I can still use MakeClass function
> to read these rootfiles together which would generate one .C and .h file
> so that I have double the statistics.
>
> I tried doing
> =============================================
> void analysis()
> {
>
> for(Int_t nFiles=0; nFiles<2; nFiles++)
> {
> char fname[150];
> sprintf(fname,"filename_%d.root",nFiles);
> cout<<endl;
> printf(fname,"filename_%d.root",nFiles);
> TFile *file = new TFile(fname,"r");
> TTree *P = (TTree*)file->Get("VW");
> file->ls();
> }
> P->MakeClass("something");
> }
> =====================================================
>
> But the above method generates .C and .h files taking the last
> rootfile as
> the input.
>
> Thanks in advance.
> Monika
Received on Mon Feb 05 2007 - 06:53:09 CET

This archive was generated by hypermail 2.2.0 : Mon Feb 05 2007 - 11:50:01 CET