Re: [ROOT] Problem encountered processing mouse event in win32

From: Valeri Fine (fine@bnl.gov)
Date: Fri Jan 04 2002 - 20:38:50 MET


 c1->AddExec("ex1",".x event.c")

 has not been implemented for WIN32 platform properly yet.

              Cheers, Valeri
-----
Dr.Valeri Fine
STAR/US Atlas                                    E-mail: fine@bnl.gov
Brookhaven National Lab                    Phone: +1 631 344 7806
Upton, NY 11973-5000                       FAX:     +1 631 344 4206
USA



----- Original Message ----- 
From: "Ed Oltman" <eoltman@imago.com>
To: <roottalk@pcroot.cern.ch>
Sent: Thursday, January 03, 2002 11:27 AM
Subject: [ROOT] Problem encountered processing mouse event in win32


> Hello,
> 
> Are there documented limitations on the types of things that can be done in
> event handlers in root?  I have a handler that allows interactive selection
> of a region of interest of a histogram using the mouse: One performs the
> same mouse operations that are used for zoom along the x-axis.  It works
> fine, until I add the fitting call - it performs the fit but never returns.
> (comment out the fit and it works fine)  I use hsimple.root in the
> tutorials - any TH1F will work
> 
> Here is my root session:
> 
> root [0] TFile f("hsimple.root")
> root [1] hpx->Draw()
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> root [2] c1->AddExec("ex1",".x event.c")
> root [3]  ROI limits: -1.280000 1.280000
>  FCN=21723.2 FROM MIGRAD    STATUS=CONVERGED      73 CALLS          74 TOTAL
>                      EDM=7.24727e-008    STRATEGY= 1  ERROR MATRIX
> UNCERTAINTY   1.4 per cent
>   EXT PARAMETER                                   STEP         FIRST
>   NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE
>    1  Constant    7.95014e+002  2.94883e-001  5.95042e-005  3.14561e-004
>    2  Mean        9.96928e-003  4.72499e-004 -1.30032e-006  1.79069e-001
>    3  Sigma       1.00597e+000  7.17379e-004 -5.21731e-006  1.88585e+000
> 
>  CTRL-C hit !!! ROOT is terminated !
> 
> [Note: I had to control-C out - no cpu was being used, root simply hung]
> 
> and here is my event handler - event.c
> 
> {
> //
> // This allows selection of an ROI:
> //
> Float_t roiLo,roiHi;
> int ix,ixl,ixh;
> int event = gPad->GetEvent();
> 
> // only care about Button1Down (1) and Button1Up(11) events
> if ((event!=1) && (event!=11) ) return;
> TObject *select = gPad->GetSelected();
> 
> // only care if selected item is x-axis
> if (strcmp(select->GetName(),"xaxis")!=0) return;
> ix = gPad->GetEventX();
> TAxis *h = (TAxis*)select;
> if (event==1) // button down
> {
> // compute lower limit of ROI
> roiLo = gPad->AbsPixeltoX(ix);
> ixl = h->FindBin(roiLo);
> roiLo = h->GetBinLowEdge(ixl);
> 
> }
> else // button up
> {
> // disable event
> gPad->DeleteExec("ex1");
> 
> // compute upper limit of ROI
> roiHi = gPad->AbsPixeltoX(ix);
> ixh = h->FindBin(roiHi);
> roiHi = h->GetBinLowEdge(ixh)+h->GetBinWidth(ixh);
> printf(" ROI limits: %f %f\n",roiLo,roiHi);
> TH1F *parent = (TH1F *)h->GetParent();
> parent->Fit("gaus","w","",roiLo,roiHi);
> }
> }
> 
> 
>  I am running version 3.02/06 of root on Win2000. I am using VC++ v6 w/sp5.
> Thanks..
> 
> 
> 
> Ed Oltman
> 
> 
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:37 MET