FairRoot/PandaRoot
Functions
extract_histos.C File Reference
#include "TFile.h"
#include "TH1D.h"
#include "TCanvas.h"
#include "TStopwatch.h"
#include "TROOT.h"
#include "TSystem.h"
#include "TTree.h"
#include "TString.h"

Go to the source code of this file.

Functions

int extractHisto (TString &histoname, TFile &storagefile, TCanvas *mycanvas, TString &myprefix)
 
int extract_histos (TString infilename, TString prefix="psi3770plot_")
 

Function Documentation

int extract_histos ( TString  infilename,
TString  prefix = "psi3770plot_" 
)

Definition at line 22 of file extract_histos.C.

References extractHisto().

23 {
24 
25 //TStopwatch timer;
26 //timer.Start();
27 
28 //gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");rootlogon();
29 
30 TFile inputfile(infilename, "READ");
31 
32 TCanvas* outputcanvas = new TCanvas();
33 
34 extractHisto("hniceevents", inputfile, outputcanvas, prefix);
35 extractHisto("hdpvertexxfit", inputfile, outputcanvas, prefix);
36 extractHisto("hdpvertexyfit", inputfile, outputcanvas, prefix);
37 extractHisto("hdpvertexzfit", inputfile, outputcanvas, prefix);
38 extractHisto("hdmvertexxfit", inputfile, outputcanvas, prefix);
39 extractHisto("hdmvertexyfit", inputfile, outputcanvas, prefix);
40 extractHisto("hdmvertexzfit", inputfile, outputcanvas, prefix);
41 extractHisto("hdpvertexxreco", inputfile, outputcanvas, prefix);
42 extractHisto("hdpvertexyreco", inputfile, outputcanvas, prefix);
43 extractHisto("hdpvertexzreco", inputfile, outputcanvas, prefix);
44 extractHisto("hdmvertexxreco", inputfile, outputcanvas, prefix);
45 extractHisto("hdmvertexyreco", inputfile, outputcanvas, prefix);
46 extractHisto("hdmvertexzreco", inputfile, outputcanvas, prefix);
47 extractHisto("hdpvertexxmc", inputfile, outputcanvas, prefix);
48 extractHisto("hdpvertexymc", inputfile, outputcanvas, prefix);
49 extractHisto("hdpvertexzmc", inputfile, outputcanvas, prefix);
50 extractHisto("hdmvertexxmc", inputfile, outputcanvas, prefix);
51 extractHisto("hdmvertexymc", inputfile, outputcanvas, prefix);
52 extractHisto("hdmvertexzmc", inputfile, outputcanvas, prefix);
53 extractHisto("hfinalpsimass", inputfile, outputcanvas, prefix);
54 
55 //extractHisto("", inputfile, outputcanvas, prefix);
56 
57 return 0;
58 
59 //timer.Stop();
60 //Double_t rtime = timer.RealTime();
61 //Double_t ctime = timer.CpuTime();
62 
63 //printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
64 
65 } // end macro
int extractHisto(TString &histoname, TFile &storagefile, TCanvas *mycanvas, TString &myprefix)
int extractHisto ( TString histoname,
TFile &  storagefile,
TCanvas *  mycanvas,
TString myprefix 
)

Definition at line 10 of file extract_histos.C.

References TString.

Referenced by extract_histos().

11 {
12  if (storagefile.Get(histoname.Data()) != 0) {
13  TH1D* myhisto = (TH1D*)storagefile.Get(histoname.Data());
14  TString outfilename = myprefix + histoname + ".pdf";
15  mycanvas->cd();
16  myhisto->Draw();
17  mycanvas->SaveAs(outfilename.Data());
18  }
19  return 0;
20 }