Restrictions on variables in histogram

Dear ROOT users,
I’m plotting a variable from a TTree and would like to use some sort of OR command in the restrictions, ie

TBranch->Draw(“speed>>h1”,“velocity==1 OR velocity== - 1”)

So far I’ve been making two histograms separately then adding them, but this is taking up too much time, thanks

Kim

Hi Kim,

Maybe something like this:

See documentation of TTree::Draw
And especially this part:[quote]The expressions can use all the operations and build-in functions supported by TFormula (See TFormula::Analyze)[/quote]
Cheers, Bertrand.

Dear Bellenot,
Thank you, it’s just what I was looking for!!

Kim

[quote=“bellenot”]Hi Kim,

Maybe something like this:

See documentation of TTree::Draw
And especially this part:[quote]The expressions can use all the operations and build-in functions supported by TFormula (See TFormula::Analyze)[/quote]
Cheers, Bertrand.[/quote]