Re: Apply in an cut string in a selector

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 5 May 2011 08:44:53 -0500


Hi Arthur,

You have a few options.

You could create a TEntryList (and/or TEventList) early on (either in SlaveBegin or outside the selector) and use in Process with something like:

     if ( ! fEntryList->Contains(entry) ) { return 0; }

You could also do 'limited' tree->Draw from within Process (but this would be a bit slow due to the reparsing of the string for each entry:

    if ( fChain->GetTree()->Draw("1","cuts","goff",1,entry) == 0) { return 0; }

Alternatively, but more complicated you could use a TTreeFormula object directly. You would need to create it in SlaveBegin, use it in Process and call UpdateFormulaLeaves on it in Notify.

Cheers,
Philippe.

On 5/2/11 6:31 PM, Arthur E. Snyder wrote:
>
> I'm trying to apply cuts I'm given as a string (e.g., TString cuts) in a selector w/o having to re-code them by hand.
>
> That is I have string |cuts| with cuts specified in it. With |Draw| I would do something like:
>
> tup->Draw("var",cuts) (1)
>
> I could also make a list of "events" with
>
> tup->Draw(">>cutList",cuts); (2)
>
> Is there some way I can apply this string of cuts inside a selector.
>
> If I do (2) at begining can create |cutList|, but how to access it, so I can skip directly to the disired events in |Proccess|? Or
> is there some way I can apply cuts directly to the entry and do the selection in |Proccess|, i.e, just check if a given entry
> passes the cuts?
>
> -Arthur S.
>
> I think I could make a |TEventList| externally and pass it into my selector via a static |TEventList*|, but it seems awkward ...
> I'd like to just specify the string and let the program to the rest ..
>
>
>
> A.E. Snyder, Group ? \!c*p?/
> SLAC Mail Stop #95 ((. .))
> Box 4349 |
> Stanford, Ca, USA, 94309 '\|/`
> e-mail:snyder_at_slac.stanford.edu o
> phone:650-926-2701 _
> http://www.slac.stanford.edu/~snyder BaBar
> FAX:707-313-0250 Collaboration
> &
> Fermi/GLAST
>
>
>
Received on Thu May 05 2011 - 15:44:59 CEST

This archive was generated by hypermail 2.2.0 : Thu May 05 2011 - 23:50:01 CEST