FairRoot/PandaRoot
macro/detectors/mvd/TestBeam/MSaveBigPng.C
Go to the documentation of this file.
1 /*
2  * MSaveBigPng.C
3  *
4  * Created on: 25.08.2015
5  * Author: Stockmanns
6  */
7 
8 int MSaveBigPNG(TString filename="", double scale=5) {
9  TCanvas* old_canv = gPad->GetCanvas();
10 
11  gROOT->SetBatch(kTRUE);
12  gROOT->ForceStyle(kTRUE);
13 
14  Int_t orig_msz = gStyle->GetMarkerSize();
15  Int_t orig_mst = gStyle->GetMarkerStyle();
16  Int_t orig_lt = gStyle->GetLineWidth();
17 
18  gStyle->SetMarkerSize(1.0+scale/5);
19  gStyle->SetMarkerStyle(20);
20  gStyle->SetLineWidth(orig_lt*scale);
21 
22  if(filename == "") {
23  filename = old_canv->GetName();
24  filename += ".png";
25  }
26 
27  Int_t old_width = old_canv->GetWindowWidth();
28  Int_t old_height = old_canv->GetWindowHeight();
29 
30  Int_t new_width = old_width * scale;
31  Int_t new_height= old_height* scale;
32 
33  TCanvas* temp_canvas = new TCanvas("temp", "", new_width, new_height);
34  old_canv->DrawClonePad();
35 
36  temp_canvas->Draw();
37  temp_canvas->SaveAs(filename);
38  temp_canvas->Close();
39 
40  gStyle->SetMarkerSize(orig_msz);
41  gStyle->SetMarkerStyle(orig_mst);
42  gStyle->SetLineWidth(orig_lt);
43 
44  gROOT->ForceStyle(kFALSE);
45  gROOT->SetBatch(kFALSE);
46 
47  return 0;
48 }
49 
void MSaveBigPNG(TString filename="", double scale=5)
const string filename