Using variable cut parameters with TTree::Draw()

Hi All!

I’m trying to write a function that repeatedly checks whether or not a histogram is empty based on a list of cuts. It boils down to something along the lines of:

int x;
x = tree->Draw("wire[20]","wire[20]>0 && wire[19]==12....","goff");

where wire[] is just an array of ints. My problem is that I would like to run this inside a loop where the indices are represented by variables i.e.

int x = tree->Draw("wire[i]","wire[i]>0 && wire[i-1]==12....","goff");

which results in “bad numerical expression” errors. I have tried using TTreeFormula and ProcessLine with no success. Is there a way around this problem?

I am using 4.00/04.

Help is greatly appreciated.

-ty

Use

int x = tree->Draw(Form("wire[%d]",i),Form("wire[%d]>0 && wire[%d]==12....",i,i-1,...),"goff"); Cheers,
Philippe.