Re: variable length array leafs in TTree

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 19 Jan 2011 09:34:30 -0600


Hi,

Try this simplification:

mini->Project("hh","TrackAA[0]"," (NTracksB>0 && Charge[0]==-1) || (NTracks>=1 && Charge[0]==1 && Alt$(Charge[1],0)==-1)")

Cheers,
Philippe.

On 1/19/11 8:43 AM, gerontas wrote:
>
>
> Hello,
> sorry for the 3 mails. I hope you get this once.
> (well, not quite, sorry!)
>
> > you could use
> > Alt$(Array[0]==1 && Array[1]==-1, Array[0]==-1)
> > where the second parameter is used if the first doesn't exist. See the
> > documentation for TTree::Draw():
> > <http://root.cern.ch/root/html/TTree#TTree:Draw%2>
> I get an error:
> root [1] mini->Project("hh","TrackAA[0]","Alt$((NTracksB>0 &&Charge[0]==-1),NTracks>=1 && (Charge[0]==1 &&Charge[1]==-1))")
> Error in <TTreeFormula::DefinedVariable>: The 2nd arguments in
> Alt$((NTracksB>0&&Charge[0]==-1),NTracksB>=1&&(Charge[0]==1&&Charge[1]==-1)) can not be an array
> (NTracksB>=1&&(Charge[0]==1&&Charge[1]==-1),-1)!
> Error in <TTreeFormula::Compile>: Bad numerical expression :
> "Alt$((NTracksB>0&&Charge[0]==-1),NTracksB>=1&&(Charge[0]==1&&Charge[1]==-1))"
> I understand I may have not been clear enough on what I want to do; the problem arrays are in the condition, not to be
> plotted/selected.
> If the above is still unclear, I will try to provide a minimal example.
>
> Thanks a lot in advance!
> Panos
Received on Wed Jan 19 2011 - 16:34:48 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 19 2011 - 17:50:01 CET