Re: Understanding the "Event" example

From: Alberto Pulvirenti <alberto.pulvirenti_at_ct.infn.it>
Date: Tue, 26 Feb 2008 13:38:34 +0100


Hi,

maybe I understood the point and that is something I would succeed to implement to remove time wasting new/delete operations. Now the problem: I tried to implement something similar to this example in order to store real events from a framework and save them in the form of my own defined track collections.
So I tried to write some code similar to what is written in the Event class, included the static data member and some ref arrays, to recovery separately positive and negative charged tracks.

When I try to read the output file where I saved a TTree with such Event-like objects, I find that the values saved in each track are completely different from the ones I wrote when storing it in the event, and event in the TTree. I don't understand what can be the reason of this result.

Do you have an idea if there is something trivial I could check? Or something I must take into account when saving events into a TTree? Unfortunately, I didn't see any code where this "Event" example class is used to store "Event" objects into a TTree...

Thanks, best regards,

        Alberto

Philippe Canal ha scritto:
> Hi,
>
> The point of the TClonesArray data member is to avoid to have to re-allocate
> the
> TClonesArray object for each Event object.
>
> You can use a simple non static datamember for the TClonesArray. In
> addition
> you can keep the performance (i.e avoid new/delete as much possible) by
> making
> sure that in your code you re-use the Event objects instead of re-creating
> them.
>
> Cheers,
> Philippe.
>
> -----Original Message-----
> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
> Behalf Of Alberto Pulvirenti
> Sent: Friday, February 22, 2008 12:26 PM
> To: Root
> Subject: [ROOT] Understanding the "Event" example
>
> Dear all,
>
> I have read an example named "Event.*" in the $ROOTSYS/test directory,
> when I was looking for a tutorial for the usage of TRefArray with
> TClonesArray as a data-member of an object to be stored in a TTree.
>
> In the definition of the "Event" class, I find that there are two
> TClonesArray data members, one is static and another is not.
> I didn't understand properly whay this is done that way and what problem
> could occur if one defines an "Event" object which has only the
> non-static data member.
>
> The idea is building something similar to create a TTree with many
> "Event" objects, and I would like to understand if the structure
> presented in that example is somehow necessary to avoid problems when
> building such a TTree.
>
> Thanks
>
> Best regards
>
> Alberto
>
>
Received on Tue Feb 26 2008 - 13:38:42 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 26 2008 - 17:50:01 CET