How to display histog. and then to write some shell commands

Hi

I am the fresh root-user , so please be tolerant ; )

So I will try to explain my problem:
I write a C program using root libraries. I want to display a histogram and then let user continue to use the program via shell command line.
After reading some parts of user guide, root.cern.ch and this forum I know only two ways to display the histogram (after drawing it): by functions Update and by function Run. But after using Run I can’t using shell command line any more and after using Update I can’t do anything with histogram (save it, close it etc.).

So what should I do?
Thank you in advance!

To do this, you must have a TApplication object in your program.
The TApplication makes sure to process the GUI events or commands in the event loop.
If you are new to the system, I STRONGLY suggest that you do not write your main program, but instead execute a ROOT script like

root -l myscript.C This will execute teh myscript.C and will give you the control at the ROOT prompt once the script is executed. All that is explained in the very first pages of teh Users Guide.

Rene

Hi, thank you for your reply

Of course I have TApplication object in my program as I’ve just written about one of my two approaches that I use Run function to this TApplication object.

But how to escape this event loop after using app.Run() and still have a possibility to use the command line?
(where app is TApplication object)

Did you try what I suggested to you?

Rene

Now, because this program is not for me and I have to do it in the way without first entering to the root

don’t know if there’s a better way but you I think you can achive what you want by using screen to detach the program from the console.

Just make a normal executable with the TApplication object and start it with:
screen -d -m executable
it will run and the terminal will still be free to use

you may need to make sure the root enviroment variables are set in the screen (ROOTSYS and LD_LIBRARY_PATH)

HI,

Instead of TApplication usint TRint

Cheers,
Philippe.

Thank you, but…

…but I’ll try to explain my problem in another way:
in my program I have a menu (1 --> make a plot 2–> see detail etc.) and after e.g. user chose 1 and made a plot I want to let him choose another number, e.g. 2.

After your pcanal solution user can operate console in root, but not in shell, so I still do not know how to cope with my problem…

So the question is:
->how to escape from event loop: how to let program execute commands after TApplication::Run() function

or

->how to display plot without using Run() and still have possibility to save or close the canvas (contrary to using only Update() function)

[quote]After your pcanal solution user can operate console in root, but not in shell, so I still do not know how to cope with my problem… [/quote]I am confused by your use of ‘shell’. What shell are you talking about? Is root supposed to be running in the background and/or in parallel to a shell script (shell is one of tcsh, bash, sh, zsh, etc.)?

[quote]->how to escape from event loop: how to let program execute commands after TApplication::Run() function [/quote]There are many different possibility depending on what user experience you want to give? When using TRint’s Run after the user type .q you would get the control back. You could write you own event loop (see implementation of TRint), you could used TTimer object to execute event on a regular basis, you could build a GUI (for example using the guibuilder) to let the user decide when to go to the next step (see example in test/RootShower), etc.

Cheers,
Philippe.