RE: [ROOT] RE: write selected events in tree...

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Feb 21 2003 - 20:54:59 MET


Hi Yu,

There seems to be some problem using the 'fake class' in your situation (we will investigate).

You can read you file either by loading the shared library defining TMBEmcl and other classes 
or by typing:
 	 typedef TObject TPhysObj;
before doing anything with the file (or even before loading the file).  This work-around works because TPhysObj happens to be a class inheriting from TObject and adding NO new data members.

Cheers,
Philippe.

-----Original Message-----
From: Vu Anh Tuan [mailto:vuanh@lal.in2p3.fr]
Sent: Friday, February 21, 2003 12:54 PM
To: Philippe Canal
Cc: Daniela Kaefer; Rene Brun; roottalk@pcroot.cern.ch
Subject: Re: [ROOT] RE: write selected events in tree...


Hi all,

I guess Daniela is doing more or less the same thing I've currently been
being stucked also. I can read a tree and write a new one which
appearently still bears the old tree structure. The point is that I'm
unable to read this tree. In the attachment you can see the error
message I've copied and pasted.

I'm using root v3_05_00 with KCC_4_0.

Philippe, if you have an access to d0mino, here is my root tree

/tmp_root/802/lal/vuanh/tmp/wz-tree.root

If you can't, I can put on my web home page. Sorry it's funny, but
that's the only way I know.

Best,

Tuan

On Fri, 21 Feb 2003, Philippe Canal wrote:

> Hi Daniela,
> 
> Before calling GetTree on a chain, you need to make sure that the tree is loaded.
> So adding at least
> 	fChain->LoadTree(0);
> before calling fChain->GetTree()
> 
> Cheers,
> Philippe
> 
> -----Original Message-----
> From: owner-about-root@listserv.fnal.gov
> [mailto:owner-about-root@listserv.fnal.gov]On Behalf Of Daniela Kaefer
> Sent: Friday, February 21, 2003 4:23 AM
> To: Rene Brun
> Cc: about-root@fnal.gov; roottalk@pcroot.cern.ch
> Subject: Re: write selected events in tree...
> 
> 
> Hi Rene,
> 
> well, I did it exactly as you wrote in your email, but... it didn't work.
> It compiles, but then it crashes with:
> 
>   [...]
>   Initializing wtreeTopData...
>   Program running on host aragorn-clued0
>   booking stuff
>   ...wtreeTopData initialized successfully
>   Starting event loop...
> 
>     *** Break *** segmentation violation
>   Abort
> 
> 
> before it even reaches the first event. I started it in gdb and got the
> following "error"-message:
> 
> 
> [kaefer@aragorn-clued0] ~/analysis/p13.06.01/diem/wtree > gdb runTopData
> GNU gdb 5.0 [...]
> (gdb) run /work/aragorn-clued0/kaefer/top_analyze/diemroot/
> Starting program: /home/kaefer/analysis/p13.06.01/diem/wtree/runTopData
> /work/aragorn-clued0/kaefer/top_analyze/diemroot/
> [New Thread 1024 (LWP 21346)]
> Reading file names from directory
> /work/aragorn-clued0/kaefer/top_analyze/diemroot/
> Adding files to TChain
> FILE: /work/aragorn-clued0/kaefer/top_analyze/diemroot//out_partab.root
> added to TChain
> FILE: /work/aragorn-clued0/kaefer/top_analyze/diemroot//out_partac.root
> added to TChain
> FILE: /work/aragorn-clued0/kaefer/top_analyze/diemroot//out_partad.root
> added to TChain
> FILE: /work/aragorn-clued0/kaefer/top_analyze/diemroot//out_partae.root
> added to TChain
> FILE: /work/aragorn-clued0/kaefer/top_analyze/diemroot//out_partaf.root
> added to TChain
> [...]
> Initializing wtreeTopData...
> Program running on host aragorn-clued0
> booking stuff
> ...wtreeTopData initialized successfully
> Starting event loop...
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1024 (LWP 21346)]
> 0x804f2c8 in wtreeTopData::Loop (this=0x8621e48) at wtreeTopData.C:111
> 111       TTree *newTree = (TTree*)fChain->GetTree()->CloneTree(0);
> (gdb)
> 
> It seems as if it cannot find the original tree in the fChain, but there
> is one, it's called TopTree and it looks like in the Header-file I send in
> the previous email... Please, if you have any idea on what could possibly
> be wrong, let me know. Thanks a lot for your help, at least it finally
> compiles!
> 
> Best,
>   Daniela
> 
>  +-----------------------------------------------------------+
>  | Daniela Kaefer     | email: kaefer@physik.rwth-aachen.de  |
>  | Fermilab, MS 357   |        kaefer@fnal.gov    \_L_/      |
>  | Batavia, IL 60510  |                           /* *\/     |
>  |                    |                           \_*_/\     |
>  | U.S.A.             | phone: +1-630-840-5439    / | \      |
>  +-----------------------------------------------------------+
> 
> 
> 
> ======================================================================
> On Fri, 21 Feb 2003, Rene Brun wrote:
> 
> > Hi Daniela,
> >
> > In your Loop function, you should not call BranchOld. CloneTree will
> > recreate an identical Tree header.
> > Below, you will find an example of Loop code to copy a subset of
> > a Tree (TChain) to a new Tree.
> >
> > Rene Brun
> >
> >
> >    TFile f("newTree.root","recreate");
> >    TTree *newTree = fChain->GetTree()->CloneTree(0);
> >
> >    Int_t nentries = Int_t(fChain->GetEntriesFast());
> >    for (Int_t jentry=0; jentry<nentries;jentry++) {
> >       Int_t ientry = LoadTree(jentry);
> >       if (ientry < 0) break;
> >       fChain->GetEntry(jentry);
> >       // if event is rejected continue
> >       newTree->Fill();
> >    }
> >    newTree->AutoSave();
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET