Re: a huge time

From: Paul Russo <russo_at_fnal.gov>
Date: Mon, 23 Jul 2007 11:12:02 -0500


Amhis,

I think you want your NewTree->Fill() to be outside of the loop that is copying the array elements from OldVar to NewVar!

By the way, why copy array elements? Why not use the same array for both trees? Do a GetEntry() from the old tree into the array variable followed immediately by a NewTree->Fill(), using the same array variable for the branch in both trees.

Amhis Yasmine wrote:
> Hello,
> I want to write arrays in a new tree...
> Basically for each entry of the old and the new tree I have an array of
> 6016 entries
> ....
> Float_t OldVar[6016];
>
> .....
> Float_t NewVar[6016];
> TTree* NewTree = new ("NewTree","NexTree");
> NewTree->Branch("NewVar",NewVar, "NewVar[6016]/F")
> for(Int_t i = 0; i< OldTree->GetEntries(); i++){
> OldTree->GetEntry(i);
> for( Int_t p = 0; p<6016; p++){
> NewVar[p]= OldVar[p];
> NewTree->Fill();//
> }
> }
>
> This method seems to work, but I think I am obvisouly doing something
> wrong because it's taking a really huge time....
> AnyIdeas?
>
> Thanks,
> Yasmine
>
Received on Mon Jul 23 2007 - 18:12:18 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 23 2007 - 23:50:02 CEST