Re: [ROOT] TClonesArray of Event objects

From: Susan Kasahara (schubert@physics.umn.edu)
Date: Sun Jul 06 2003 - 23:58:41 MEST


Hi Tommaso,
A problem similar to this one was discussed on the roottalk thread:
  http://root.cern.ch/root/roottalk/roottalk03/0069.html
in which the questioner wanted to know how to maintain multiple
instances of Event in memory.   I suggested in response to his e-mail
that one approach to this problem is to make use of a singleton to
manage a pool of TClonesArrays.  The TClonesArrays in the pool
can be used/reused by clients throughout the length of a job - essentially
offering the efficiency of the static TClonesArray in the Event example,
but without the restriction of allowing only one Event object in memory
at a time.  You can find a link to the singleton TClonesArray code I use in
the thread above.
Good luck,
-Sue

Tommaso Chiarusi wrote:

> Well, i think I solved the "singleton"-like problem by removing the
> static  declarations in Event.h:
>
> private:
>
>  [...]
>
>      static TClonesArray *fgTracks;
>      ^^^^^^
>      static TH1F         *fgHist;
>      ^^^^^^
>
> and by accordingly modifying the Event.cxx
> (in particular I commented the lines right after ClassImp
>
>  //TClonesArray *Event::fgTracks = 0;
>   //TH1F *Event::fgHist = 0;
>
> and  the Reset() member function.)
>
> Now it seems to work good.... (well.. at the moment it wroks, then who
> knows?)
>
> Thank you.
> Tommaso
>
> --
> -----------------------
>
> Dr. Tommaso Chiarusi
>
> Dipartimento di Fisica
> Universita' di Bologna
> INFN. Sez. Bologna
>
> Tel +39.051.209.5234
> Fax +39.051.209.5269
>
> -----------------------



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