I have a script which draws contour to the TH2 histo. I need to eliminate the events outside the contour. Here is a piece of the script:
TGraph *down = new TGraph(n,m_min, y); // contour
TGraph *up = new TGraph(n,m_max, y); // contour
TCutG *mycutup = new TCutG("mycutup",n); // cut the events
TCutG *mycutdown = new TCutG("mycutdown",n); //cut the events
h2->Draw("colz, [mycutup, -mycutdown]"); // just draw the events inside the graphs.
cont_up->Draw("lsame");
cont_down->Draw("lsame");
The things is here, TCutG helps me not to draw the events outside the contour but it does not remove them indeed. I mean, the entry number same as the histogram which not applied TCutG. How to remove those events? Btw, TCutG may not be the most effective selection for removing events since the up and down Graphs are not actually closed contour itself. I also attached the output. Any help would be appreciated, thanks.
yes, but it looks like on the bottom plot that either the histogram you plot has very small bin or you are plotting a scatter plot from a ntuple or tree.
So, I do not understand what you call “baldness” … can you clarified ? … is it the line thickness ? … reduce the graph line width in that case.
I must be stupid … I do not understand what you are showing … the areas you are pointing have nothing special compared to the rest of the plot seems to me …
I see the bottom plot has a little gap between the two TCutG … otherwise there is nothing wrong … is its the little gap you are complaining about ?
I still do not understand what you mean by “baldness”…
Yes yes, I was just complaining about that Since there is a gap between two graphs, the contour is not being closed. And so, TCutG does not keep some of the events inside the contour.
Actually your answer and the job that I did the same with your reply, solved the issue of removing events outside the contour.