Re: static TClonesArrays

From: Sue Kasahara <schubert_at_hep.umn.edu>
Date: Sun, 13 Feb 2005 12:38:47 -0600


Hi Alessandro,
We've handled this problem using a singleton TClonesArray manager. You can find more information on the thread:
http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk03/0081.html -Sue

Rene BRUN wrote:

> Alessandro,
>
> The fact that the TClonesArray pointer is declared static or not has
> no impact on the speed. What is important is to create your
> TClonesArray(s)
> only once. In the test/Event example, we have used a static pointer
> to show that the array should be created only once.
> It would have been better to create a Run class owning this array and
> filled in the Event class.
>
> Rene Brun
>
>
>
> Alessandro Thea wrote:
>
>> Hi rooters,
>> up to now I've worked with an event bases on the Event example
>> available with root, in particular it uses a static TClonesArray as
>> suggested in many other posts.
>> Now I would like, or let's say that I need the capability to have
>> multiple copies of my event and to to that I'm thinking to remove the
>> static attribute of the TClonesArray.
>> The problem is that I do not understand where and how much my code
>> would be slowed down.
>> The basic structure I use is the following:
>>
>> {
>> Event* ev = 0;
>> TTree *t= new TTree("...");
>> t->Branch("Event",&ev);
>> for(Int_t i(0); i<nMaxEv; i+) {
>> /*
>> Fill Event... and the TClonesArray
>> */
>> t->Fill();
>> ev->Clear() // calls TClonesArray::Clear(), not Delete
>> }
>> // writing tree, closing file and so on
>> }
>>
>> Thanks in advance for any suggestion,
>> Alessandro
>>
>
Received on Sun Feb 13 2005 - 19:39:32 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET