How to drawing a TCutG?

Hello
I need your help to understand how drawing a TCutG in a stand-alone program

usually, by using a canvas in intepreted root it is possible to draw open the toolbar and, after selecting the TGutG button, to draw the cut directly on the 2D-histogram

It is possible to make that of similar in a stand-alone program?

I understood that is possible to use this constructor
TCutG = cutg new TCutG("cutg¨,n,x,y);
where x,y are coordinates array (n long).
but I didn’t untestand how get the coordinates from Histogram.
can you help me?

It exist another method?

tnks

Matteo Sassi

see example below

Rene

[code]void cutg3()
{
const Int_t n = 6;
Float_t x[n] = {0.092,0.83,0.94,0.81,0.12,0.1};
Float_t y[n] = {0.71,9.4,9,8,0.3,0.71};
TCutG *cut = new TCutG(“cut”,n,x,y);
TGraph g = new TGraph();
Float_t u,v;
Int_t np = 0;
for (Int_t i=0;i<100000;i++) {
u = gRandom->Rndm();
v = 10
gRandom->Rndm();
if (!cut->IsInside(u,v)) {
g->SetPoint(np,u,v);
np++;
}
}
TCanvas *c1 = new TCanvas(“c1”);
g->Draw(“ap”);
cut->Draw(“l”);
}

[/code]

yes,
I’ve seen this code before send my question but this allow to make a cut starting from 2 arrays.

I will a method to create the arrays just by clicking on the histogram as described in page 13 of user guide 4.04.

tnks

Matteo

Have a look to $ROOTSYS/exec3.C . This macro gets the x and y positions for all all events. Just modify it to get the x and y when you left click (see the value of “event” when executing the macro) and convert the x y postion in pixel into user coordinates using:
gPad->AbsPixeltoX(x);
gPad->AbsPixeltoY(y);
I hope it helps.

tnks I try this solution in next days

if someone has other ideas help me