Interacting with a compiled ROOT program running

I am trying to give an input to a process from keyboard.

I create histogram 1, want to draw it on canvas 1. Depending on what I see, I want to give input to the process through lines

cout << "Enter factor: ";
cin >> factor;

and then fill and draw histogram 2 on canvas 2.

However, when the execution reaches the cout/cin lines, the canvas 1 is drawn empty in spite of having given the draw command earlier with

c1->cd(); hi1->Draw();

So I cannot see the histogram 1 to enter meaningful factor for further work.

Please help: how can I see a full histogram in a graphical window before the end of program is reached? Is there an example I can look at?

Thank you.
FJ
Makefile.txt (1.7 KB)
dialog.C (2.31 KB)

c1->cd(); hi1->Draw();You will also need c1->Modified(); c1->Update();(The Draw is only a registration of intention to be display on the canvas, the actual Display/Paint is doing by Update.

Cheers,
Philippe.

Have done that; doesn’t help:

c1->cd(); hi1->Draw();
c1->Modified(); c1->Update();

[quote=“FJ”]. . . However, when the execution reaches the cout/cin lines, the canvas 1 is drawn empty in spite of having given the draw command earlier with c1->cd(); hi1->Draw();So I cannot see the histogram 1 to enter meaningful factor for further work. . . . [/quote] It is a correct :bulb: behavior. You can not see anything unless your application enters the ROOT event loop.
The best way to solve your issue is to start the normal ROOT and create 3 C++ functions. Please, download the dialog.C attached and try:

root.exe dialog.C+ root[0] Fill(getfactor()) Please try that. It does what you want EXACTLY.
dialog.C (2.51 KB)