Problems with displaying TGraphs in different TPads

Hi there,

again I have some problem with my macro.
I posted regarding the same macro a memory leack problem some months ago. Now, I have another problem:

Saving my canvas afterwards as a .ps, I always see ontop of my TCanvas in which the different TGraphs should have been drawn in the respective TPad a TGraph drawn. While running the macro this does not occure, as if before saving and afterwards closing the TCanvas the last pointer to a TGRaph is also “saved” by simply drawing it ontop of my TCanvas. Attached you can find two data files and a minimal example of the macro as well as the resulting .ps File.

Many thanks
mirror+0+2.root (1.01 MB)
AnalysePSFReflector.C (9.43 KB) (79.6 KB)
mirror+0+1.root (1.01 MB)

I’ll check.
FYI, your macro has a syntax error:

Processing AnalysePSFReflector.C...
Error: Too many '}' AnalysePSFReflector.C:223:

an extar “{” at the end… I am looking at your question.

I see that the PS and PDF files do not like what is on the screen. I guess that is what you are complaining about…

investigating …

I thought I could have been because of the Pad-> Divide(0. so i tried to simulate with the following macro:

   TCanvas *c1 = new TCanvas("c1", "c1",15,48,700,530);

   TPad *c1_1 = new TPad("c1_1", "newpad",0.07,0.1,0.7,0.9);                    

   c1_2 = new TPad("c1_2", "newpad",0.7,0.1,0.8,0.9);                        

But the PS file is fine … (13.6 KB)

Your macro is tricky. I am trying to dismantle it to find the faulty bit.
I found that:


is part of the problem. Using Draw() instead of DrawClone() makes it behaving better. But then you get 2 plots instead of one … Why DrawClone() and not simply Draw() ?

Ok, that’s the trick you should use Draw and not DrawClone.
I did :


and it gives me:

Processing AnalysePSFReflector.C…

so it means that two plot should be produced not one.

Beacuse simply using Draw() erases the TGraph from the respective TPad once the secon iteration of the loop is started. So I have to draw a clone that stays in the pad

Yes but with DrawClone I see only one Graph instead of two … is one graph fine ? … seems to me 2 should be displayed …

One Graph in each pad is hwat I need! But how do I avoid two graphs to be plot without erasing each plot during the next iteration from the previous pad?

What should I do to simulate this " mutli-pass" matter ?

later this day I will attach once more my macro of course this time without too many brackets.

if it is the same as before have it …

See how I modified your macro and see what i get. (86.9 KB)
AnalysePSFReflector.C (9.44 KB)

Thanks! I had doubts running out of memory doing it this way, but since I get no error this is seems to be the easiest solution.