Re: size of a variable

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Fri, 26 Feb 2010 12:16:20 +0100


"@myvariable.size()"

fantastic !

thank you Rene



Rene Brun a écrit :
> Hi Marc,
>
> see the doc of TTree::Draw, in particular this section:
>
> //
> // Accessing collection objects
> // ============================
> //
> // TTree::Draw default's handling of collections is to assume that any
> // request on a collection pertain to it content. For example, if
> fTracks
> // is a collection of Track objects, the following:
> // tree->Draw("event.fTracks.fPx");
> // will plot the value of fPx for each Track objects inside the
> collection.
> // Also
> // tree->Draw("event.fTracks.size()");
> // would plot the result of the member function Track::size() for each
> // Track object inside the collection.
> // To access information about the collection itself, TTree::Draw
> support
> // the '@' notation. If a variable which points to a collection is
> prefixed
> // or postfixed with '@', the next part of the expression will
> pertain to
> // the collection object. For example:
> // tree->Draw("event._at_fTracks.size()");
> // will plot the size of the collection refered to by fTracks (i.e
> the number
> // of Track objects).
>
>
> Rene
>
> Marc Escalier wrote:
>> Hello,
>>
>> would somebody know how to the following functionnality :
>> let's assume a TTree has a variable myvar with myvar[0], myvar[1],
>> ..., myvar[N]
>> with N varying from event to events
>>
>> Is there a way to draw the histogram of the size of the myvar
>> *without* doing the stuff of SetBranchAddress, etc... to get the
>> variable then doing myvar->size()
>> and so on
>>
>> ==>I mean, is that possible to do that in a very short way like :
>> mytree->Draw("myvariable.TheMethodToGetTheSize()")
>> or
>> mytree->Project("myhisto","myvariable.TheMethodToGetTheSize()")
>>
>> thank you
>>
>
Received on Fri Feb 26 2010 - 12:20:30 CET

This archive was generated by hypermail 2.2.0 : Fri Feb 26 2010 - 17:50:01 CET