Running script blocking UI

Hi!

I use a manager to transfer data from PVSS into ROOT. The manager is communicating with ROOT using objects defined in a DLL. A simple file is piped to ROOT when ROOT is started and this file contains CINT commands that do all the work

DllClassA.OpenCanvas(); while(...){ DllClassB.GetData(); DllClassC.DrawPlot(); } ...

The problem now is, that it is on the one hand possible to plot real time data that way, but on the other hand it is no longer possible to access the canvas menu without crashing ROOT.

I thought, it would be a problem of my application/manager/DLL and therefore I eased the problem a bit.

I wrote a very simple file “DataXY”:

1 3 2 6 3 9

and an also very simple file “Start”:

c = new TCanvas("c","test",10,10,700,700); Graph = new TGraph("DataXY"); Graph.Draw("LA"); c.Update();

If one starts ROOT now using:

one will see a VERY simple Graph. It is possible to zoom and one can use the whole possibilities, the canvas menu is offering.

Now, I inserted an endless loop into my start file:

[code]c = new TCanvas(“c”,“test”,10,10,700,700);
Graph = new TGraph(“DataXY”);
Graph.Draw(“LA”);
c.Update();

while(true){
//do nothing
}

[/code]

The situation is now very similar to the one I have, using my manager. because of the data arriving in real time, I have to have the manager running all the time (as the endless loop).
If one now tries to do something in the canvas, that will crash ROOT.

Is there a workaround? If not, I think, it would be possible to pause the script for a user interaction. The problem is, that my user probably won’t wait for that. So at least the canvas should be disabled in this case.

Maybe someone had similar problems or a good idea?

Thanks in advance!

Tobias

Hi,

there are basically two solutions.

  • in the script call in your endless loop regularly
    gSystem->ProcessEvents();
    this will cause the graphics events to be processed. However
    if you don’t do this regularly the GUI will be slugish

  • you could write your data to a named-pipo (fifo) and let ROOT
    monitor the pipe via a TFileHander object, which will only read
    from the pipe if there is any data to read

Cheers, Fons.