How to use the array element as TCut?

Dear ROOT experts,

I just have the same question as this:
http://root.cern.ch/root/roottalk/roottalk00/2227.html

and I found the answer here:
http://root.cern.ch/root/roottalk/roottalk00/2229.html

But the code like the following doesn’t work:

TObjString *cut[2]={"cut1", "cut2"}; tree->Draw("var1 >> h10", *cut[0] );
Where “cut1”, “cut2” is just the Bool (Int_t) type variable in the tree. Did I misunderstand something, what’s the standard way to do this job in ROOT now?

If it is possible, please also teach me how to put the Double_t variable in the array. It would be something like?

TObjString *cut[3]={"cut1", "cut2", "cut3>0"};

Thanks a lot.

Cheers, Jibo

You need a TCutG for that. See:
root.cern.ch/root/html/TCutG.html

And in particular these constructors:

 TCutG(const char* name, Int_t n, const Float_t* x, const Float_t* y) 
 TCutG(const char* name, Int_t n, const Double_t* x, const Double_t* y) 

[quote=“couet”][quote]
How to use the array element as TCut?
[/quote]
You need a TCutG for that. See:
root.cern.ch/root/html/TCutG.html
[/quote]

Thanks a lot for your reply. But is there any easier way? Or I still misunderstood something? You know, usually we do something like:

tree->Draw("var0 >> h0", "cut1"); tree->Draw("var1 >> h1", "cut2" ); ... tree->Draw("varn >> hn", "cutn" );

But now I want to put all the cuts into an array, so that I can draw/fill all the histograms (with different cuts) in a loop:

TObjString *cut[n]={"cut1", "cut2"..., "cutn"}; for(i=0; i<n; i++){ ... tree->Draw("var>>**", *cut[i] ) }

oh … sorry … you want an array of cut … not a cut define by arrays… forget my reply that is not the one you need…

Anyway, thanks a lot for your reply. I tested a little bit just now. Something like this seems to work:

string cut[n]={"cut1", "cut2"..., "cutn"}; for(i=0; i<n; i++){ TString mycut = cut[i]; tree->Draw("var>>**", mycut ) }