Re: creating trees

From: Alexander Bürger <buerger_at_iskp.uni-bonn.de>
Date: Mon, 06 Feb 2006 13:56:13 +0100


Hi Philippe,

> void SetOutputFile( const char* filename )
> {
> if( fFile ) {
> fFile->Write();
> delete fFile;
> fFile = 0;
> fTree = 0;

This does not crash, but I do not understand: there should not be a "delete fTree"? Is this special for trees? If I create histograms on the stack there is no problem/segfault when the destructor is called (like {TFile x(..); TH1I h(..); h->Fill(..); x.Write();}).

Should there be a "fFile = fTree->GetCurrentFile()"?

> for( int i=0; i<100000; ++i ) {
> SetOutputFile( "fileXY.root" );
>
> I suppose this is an artefact of your sample code (this seems
> to overwrite the same file 100000 times).

Yes, this is just for the example. I wanted to make clear that I want many trees. In the actual program there are at most 600.

> In the default contructor of TreeEvent did you make sure to
> initialize __every__ data member of TreeEvent to a valid value?

Yes.

Thanks for your help,

Alexander Received on Mon Feb 06 2006 - 13:56:18 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET