FairRoot/PandaRoot
Functions
macro/examples/fastsim/ana_simple.C File Reference

Go to the source code of this file.

Functions

int ana_simple (TString infile, TString cfgfile="analysis.cfg", int nevts=0, TString outfile="")
 

Function Documentation

int ana_simple ( TString  infile,
TString  cfgfile = "analysis.cfg",
int  nevts = 0,
TString  outfile = "" 
)

Definition at line 10 of file macro/examples/fastsim/ana_simple.C.

References basiclibs(), ctime, Double_t, f, gDebug, PndSimpleAnalysis::Init(), outfile, printf(), rtime, t, and timer.

11 {
12  TStopwatch timer;
13  timer.Start();
14  gDebug=0;
15 
16  // Load basic libraries
17  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
18  basiclibs();
19 
20  // Load this example libraries
21  gSystem->Load("libGeoBase");
22  gSystem->Load("libParBase");
23  gSystem->Load("libBase");
24  //gSystem->Load("libPndData");
25  //gSystem->Load("libGen");
26  gSystem->Load("libRho");
27  gSystem->Load("libfsim");
28 
29  if (outfile=="") outfile=infile+"_ana.root";
30 
31  //analysis
32 
33  TFile f(infile);
34  TTree *t=(TTree*)f->Get("pndsim");
35 
36  int ntree=t->GetEntries();
37  if (nevts==0 || nevts>ntree) nevts=ntree;
38  f.Close();
39 
40  cout <<"\n####### Processing "<<nevts <<" events...\n"<<endl;
41 
42 
43  FairRunAna *fRunA= new FairRunAna();
44  fRunA->SetInputFile(infile);
45  fRunA->SetOutputFile(outfile);
46 
47  //append the analysis task
48  PndSimpleAnalysis *anaTask=new PndSimpleAnalysis(cfgfile.Data());
49  fRunA->AddTask(anaTask);
50 
51  fRunA->Init();
52  fRunA->Run(0,nevts);
53 
54 
55  timer.Stop();
56  Double_t rtime = timer.RealTime();
57  Double_t ctime = timer.CpuTime();
58  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
59  return 0;
60 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
basiclibs()
Double_t
TStopwatch timer
Definition: hit_dirc.C:51
TFile * f
Definition: bump_analys.C:12
gDebug
Definition: sim_emc_apd.C:6
Double_t ctime
Definition: hit_dirc.C:114
TTree * t
Definition: bump_analys.C:13
virtual InitStatus Init()
Double_t rtime
Definition: hit_dirc.C:113
TFile infile("dedx_out.root","READ")
TString outfile