Nothing drawn on canvas when running stand-alone exe

Hello,

My problem is I have an executable that links in the root-libraries, creates a canvas and draws a histogram on it, but the histogram doesn’t show up. The canvas stays empty.

I can also compile the application from the root prompt (using ACLiC and gSystem->SetIncludePath). If I do it that way, it works, so I think there must be some special trick to get this to work in a stand-alone program.

I attached the relevant code - the drawing is supposed to happen from draw_multifiles_NToC.

Thanks,

Paul
test_x.cpp (2.35 KB)

I forgot to mention the versions I’m using.
I have root 3_05_04b on Red Hat Linux 7.3 (and I’m compiling with GCC 3.1).

Paul

Paul,

You must create a TApplication in your program

Rene

Thanks for your reply.
But I do create a TApplication (see the attachment in my original post). I think also otherwise the canvas wouldn’t have shown up because I wouldn’t have had any link to the X-server.
I create the TApllication object like this:

void main(...) {
  TApplication theApp("Analysis", &argc, argv);
  [do stuff: Create canvas, draw histogram]
  theApp.Run(kTRUE);
  return;
}

Can you see anything wrong with that?

Paul

I do not see anything wrong in your program, except that you have a loop with n=4 and you should see only the last histogram with your logic!
I assume that you have already checked that you are not in a case where your error messages are reported.
If you do not find the error, please send a small tar file with all
the necessary and minimum set of files to reproduce the problem.

REne

](*,) … I can’t reproduce the problem anymore.

I made a stripped version of the program which turned out not to have the problem. Then I went back to the original problem to switch on the drawing again… and it worked. Sigh. Sorry.

I did notice btw the last histogram on a canvas with many histograms not being drawn, unless I added a nother TCanvas::cd(…) after having drawn it.

Paul

But it turns out I’m not completely out of the woods yet.

When I compile my code from within root (using ACLiC), and I save my plots from the canvas menu to a postscript file, I can view the file using ghostview.
When I compile my code into a standalone binary, and I save my plots from the canvas menu to ps file, I see a blank page in ghostview. That is, the plots are drawn, but directly after that the page is cleared. I traced the difference in the postscript to one of the last lines in the ps file:
When I save the ps file from the exe, I have this line:

t 0 r 0 0 m /Helvetica-Bold findfont 64 sf 0 0 m ((B\040) show gr 1 1 1 c
2383 2268 0 0 bf gr

And when I save them from within root, it looks like this:

t 0 r 0 0 m /Helvetica-Bold findfont 64 sf 0 0 m ((B\040) show gr gr

Editing the file from the exe in emacs solves the problem.

I’m attaching two tar files: One with the two different files (lxy.ps is saved from within root, lxy_exe.ps is saved from the stand-alone exe). The other tar file has the code.

To run the code from within root, unpack the tar file, cd into the dir rootproblem, and type

root compile.C
[root] char** cp
[root] main_a(0, cp)

To run the code standalone, unpack the tar file, cd into the dir “rootproblem”. Undefine “INTERACTIVE” in src/RatioNeutralsToCharged_x.cpp, gmake and run the binary in the bin directory.

Paul
rootproblem.tar (110 KB)
plots.tar (70 KB)

Hello,

I just ran into this problem anew… I still have the problem that when I have a stand-alone exe, I save my plots from the canvas menu (file -> save as canvas.eps), I can’t see them in ghostview (I see my plots but the page gets cleared when gv finishes drawing).

Did anyone find out what the problem was?

Last time I was able to make the plots from the command line also, and then I found the problem in the ps file to have something to do with a command like this:
t 0 r 0 0 m /Helvetica-Bold findfont 64 sf 0 0 m ((B\040) show gr 1 1 1 c
2383 2268 0 0 bf gr
In my current plots it doesn’t look to be so easy, there is no command like this near the end of the file… (I’m attaching the plot just for the heck of it)

Thanks,

Paul

PS Still using root v3_05_04b-GCC_3_1–exception–opt–thread on Red Hat 7.3

I tried to attach my plots but apparently failed, trying again…

I was trying to add an eps file as attachment but this appears not to be an allowed format?
2dfit_initialvalues.ps (30.5 KB)

Paul,

Please attach your program source and data file(s) such that we can investigate the problem

Rene

Thank you for your response.
I did that for my original program (see a few posts back in this thread). That program was also easily converted into something you can run interactively. Interactively the problem I described does not appear.

Anyway, I have attached a tar file with the program I’m having trouble with currently. Just unzip & untar the attachement, cd into ps_problem_2 and type gmake. Then run bin/InitVals_x and save the plots from the canvas menu using file->Save as canvas.eps . The resulting file dbg.eps is not viewable with ghostview, on my machine anyway…

Thanks!

Paul
postscript_problem.tar.gz (67.3 KB)

Paul,

I have no problems with the generated eps file. See attachement dbg.eps.gz
and tell me if you can view it

Rene
dbg.eps.gz (3.73 KB)

I can view it, so the difference must be in my set-up and I think I found it.
In my .rootrc I have the line

Canvas.HighLightColor: 0

If I remove that line or change the number to 1, things are ok…

Thanks!

Paul