Area inside TCUTG

Dear ROOT USER,
I was trying to calculate the area under a graphical cut (TCUTG) in a 2D histtogram. Graphical cut has been saved as cut and the histogram as htemp, then i used
Double_t x = cut.IntegralHist(htemp,"");
but it didn’t work
TCUTG.pdf (873 KB)

Your pdf file is unreadable. Could you post a short script reproducing your problem?

REne

Actually i did it in interactive mode using treeviewer. i just draw a 2D histogram, then from menu—Tools, i draw a graphical cut on the histogram, now i want to know the total count within my cut. please see the attached figure.

Do the following

TCutG *cut = (TCutG*)gPad->GetPrimitive("CUTG"); //or the name that you gave to your cut double integral = cut->IntegralHist(myhist); //where myhist points to your TH2
Rene

This didn’t work, i got error like this

Error: illegal pointer to class object cut 0x0 1296 (tmpfile):1:
*** Interpreter error recovered ***

Kaushik

[quote]Error: illegal pointer to class object cut 0x0 1296 (tmpfile):1:
*** Interpreter error recovered ***[/quote]To avoid the ‘crash’, check the return value / pointer value before using it.

[quote]This didn’t work, i got error like this[/quote]Then either you did not draw a TCutG (“from menu—Tools, i draw a graphical cut”: I do not see which menu item you are refering to), or gPad is not pointing to the pad where the TCutG was drawn.

Cheers,
Philippe.