Logo coherent WaveBurst  
Config Reference Guide
Logo
makeimage.C
Go to the documentation of this file.
1 /// Generates the ImageName output of the macro MacroName
2 
3 #include <stdio.h>
4 
5 void makeimage(const char *MacroName, const char *ImageName, const char *OutDir, bool cp, bool py)
6 {
7  if (!py) gROOT->ProcessLine(Form(".x %s",MacroName));
8  else gROOT->ProcessLine(Form("TPython::ExecScript(\"%s\");",MacroName));
9  if (cp) {
10  TString MN = MacroName;
11  Int_t i = MN.Index("(");
12  Int_t l = MN.Length();
13  if (i>0) MN.Remove(i, l);
14  gSystem->Exec(TString::Format("cp %s %s/macros", MN.Data(), OutDir));
15  }
16 
17  TIter iCanvas(gROOT->GetListOfCanvases());
18  TVirtualPad* pad = 0;
19  int ImageNum = 0;
20  while ((pad = (TVirtualPad*) iCanvas())) {
21  ImageNum++;
22  pad->SaveAs(TString::Format("%s/html/pict%d_%s",OutDir,ImageNum,ImageName));
23  }
24 
25  FILE *f = fopen("NumberOfImages.dat", "w");
26  fprintf(f,"%d\n",ImageNum);
27  fclose(f);
28 }
shift breaksw case l
void makeimage(const char *MacroName, const char *ImageName, const char *OutDir, bool cp, bool py)
Generates the ImageName output of the macro MacroName.
Definition: makeimage.C:5