Get mouse position by clicking and continue the analysis

Hello ROOTers,
I’m trying to retreive 3 or more user mouse positions and use those them to make calculations and modify the histogram (for instance to zoom between two of the positions)
I read the examples (exec3.C, triangles.C etc) but they keep running forever, while me, I would like to retreive only N positions and continue the analysis.
I’m sure there must be an easy way of doing it, but I cannot find it… Any suggestion?

Thank you

Hi Paola,

What about using WaitPrimitive on a TCutG?
For example:[code]void Wait4CutG()
h1 = new TH1F(“h1”, “histo from a gaussian”, 100, -3, 3);
h1->FillRandom(“gaus”, 10000);
TCutG cutg = (TCutG)gPad->WaitPrimitive(“CUTG”, “CutG”);
if (cutg) {
// do whatever needed with the TCutG information…

  // then delete the cut
  delete cutg;
  // and update the canvas

Cheers, Bertrand.

Hi Bertrand,
thank you so much for your help!
I actually used a TMarker instead of a TCut, which is more suited for my following analysis, and it works very well. Thank you for the idea!

       TMarker *marker = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");