Re: CutG and WaitPrimitive("mycut","CutG")

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Feb 19 2000 - 12:15:28 MET


Hi Faouzi,
If you read carefully the documentation of TPad::WaitPrimitive, it says
    Loop and sleep until a primitive with name=pname
    is found in the pad.
When you specify two arguments, the first argument is the name
of the primitive. In your case, the 2nd argument "CutG" means that
you set the editor ready to accept a graphical cut with the mouse.
Once you have closed the cut, you must set its name via the context
menu item "SetName" to "mycut". The function will only return once
a primitive of type "CutG" with name="mycut" is found.
If you were doing instead:
TCutG *cutg = (TCutG*)gPad->WaitPrimitive("CUTG","CutG");
the function will return immediatly once you have closed the cutg
because the default name for a graphical cut is "CUTG".
See the various examples in the doc.

Rene Brun



On Fri, 18 Feb 2000, Faouzi Attallah wrote:

> Hi Rene,
> 
> Thank you for your prompt answer.
> This morning, after plotting 1dim or 2dim hist, I tryed as a command-line
>     TCutG *cutg = (TCutG*)gPad->WaitPrimitive("mycut","CutG")  ;
>  So I could peacefully go back to the graphics, mark the contour-points and
> close ths contour by double-clicking the same mouse-button.  Despite the fact
> that  he contour is closed, as I can see on the graphics, I could not access to
> the command line anymore-> no return from the WaitPrimitive() function.
> 
> I failed also when using :
>  gROOT->SetEditorMode("CutG") ; gPad->WaitPrimitive() ; 	
> 
> Did I do anything wrong ?
> 
> Cheers ,
> Faouzi
> 
> On Thu, 17 Feb 2000, you wrote:
> > Faouzi,
> > Yes, this is possible if you use 2.23/12.
> > We introduced a new function TPad::WaitPrimitive
> > do do this job. See function description and its
> > extensive help.
> > At the command line or inside a macro, you do:
> >  TCutG *cutg = (TCutG*)gPad->WaitPrimitive("mycut","CutG")
> > This statement will block the execution until you click
> > with the mouse in the pad the contour of the cut and close
> > the cut by clicking twice on the same point.
> > 
> > Rene Brun
> >
>  F. Attallah 
> GSI mbH 
> Planckstr 1
> D-64291 Darmstadt 
>   Tel: +49 (0)6159 71 2743
>   Fax: +49 (0)6159 71 2901
> Email: F.Attallah@gsi.de
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET