Issues with batch mode

From: Adam Roe <Adam.Roe_at_cern.ch>
Date: Thu, 7 Sep 2006 17:32:50 +0200


Hi Rooters,
I am using ROOT's batch mode to output various graphs as .gif files. The entire macro is in batch mode. For canvases with >1 graph on them, the output to the .gif is wrong when using batchmode. i.e., when i am not in batch mode, the proper graphs appear on the screen and in the .gif.

Drawing four simple graphs (1 TH1F, 3 TH2F's) on a single canvas, they appear on the screen properly in both batch mode and non-batch mode. In batch mode, however, the .gif file is wrong, and does not show all of the data points which are in the graph. the following is an excerpt of the code:

void pedRMSFlagGraph(TString fileName){
  gSystem->cd("images/Crosstalk");
  gSystem->cd(fileName);

                                                                                                                               TCanvas *flagRMSCanv = new TCanvas("flagRMSCanv", "flagRMSCanv", 200,10,800,800);
  flagRMSCanv->Divide(2,2);
                                                                                                                                                                                                                                                          

  flagRMSGraph_1D = new TH1F("flagRMSGraph_1D", "flagRMSGraph_1D", 5, 0, 5);

  flagRMSCanv->cd(1);
  Calibration->UseCurrentStyle();
  Calibration->Draw("flagRMS>>flagRMSGraph_1D");
                                                                                                                             

  flagRMSGraph_2D_Strip = new TH2F("flagRMSGraph_2D_Strip", "flagRMSGraph_2D_Strip", 80, 0, 80, 6, 0, 6);   flagRMSCanv->cd(2);
  gStyle->SetMarkerSize(0.1);
  gStyle->SetMarkerStyle(1);
  Calibration->UseCurrentStyle();
  Calibration->Draw("flagRMS:strip>>flagRMSGraph_2D_Strip");    

  flagRMSGraph_2D_Chamber = new TH2F("flagRMSGraph_2D_Chamber ", "flagRMSGraph_2D_Chamber", 9, 0, 9, 10, 0, 10);   flagRMSCanv->cd(3);
  gStyle->SetMarkerSize(1.7);
  gStyle->SetMarkerStyle(20);
  Calibration->UseCurrentStyle();
  Calibration->Draw("flagRMS:cham>>flagRMSGraph_2D_Chamber");    

  gStyle->SetMarkerSize(0.1);
  gStyle->SetMarkerStyle(1);
  Calibration->UseCurrentStyle();
  flagRMSGraph_2D_Layer = new TH2F("flagRMSGraph_2D_Layer", "flagRMSGraph_2D_Layer", 6, 0, 6, 6, 0, 6);   flagRMSCanv->cd(4);
  Calibration->Draw("flagRMS:layer>>flagRMSGraph_2D_Layer");    

flagRMSCanv->Update(); ##this does nothing... flagRMSCanv->Print("flagRMS.gif");
gSystem->cd("../../../");  

}
This code is called from the macro's main functioin, and it is in that function that i call: gROOT->SetBatch();

Drawing six graphs which have lines superimposed on them, onto a single canvas, there is a different problem. In non-batch mode the display is correct. in batch mode, the superimposed lines are there but the data is not. This code is quite complicated, so i won't bother you with it.

In the situation of a single graph with superimposed lines, on a single canvas, batch mode gives no problems.

Cheers,
Adam Received on Thu Sep 07 2006 - 17:33:00 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET