Write histogram into ps file


I have a problem concerning the writing of histograms into a ps file.
Here a piece of code:

TCanvas* canvas0 = new TCanvas(“canvas0”,“canvas0”,1200,900);

I loop over s=2 input data files and fill the corresponding histograms
for the invariant Mass.
The problem: I open and close the ps file for each loop. Therefore only the last histogram is writen into the ps file. But I need all histograms because I want to lap them. Do you have any idea?

Thanks & Cheers,

You should use ( or [ once before the loop and ) or ] once after the loop. Thats way all your histograms will be in a single PS file (one per page) if you do not use the option SAME. If you plot your histograms using SAME they will all be on the same page. In that case you only need to print a single page at the end of the loop using canvas0->Print(“Histos.ps”);

Hi couet,

thanks for answer! It works now.