FairRoot/PandaRoot
tutorials/analysis/ana_simple.C
Go to the documentation of this file.
1 // *******
2 // Macro for running analysis in a Task
3 // Take a look to tutorials/anatask/PndAnalysis.cxx
4 // Add the line add_subdirectory(tutorials/anatask)
5 // to pandaroot/CMakeLists.txt
6 // and do a 'make install' in build directory first
7 // *******
8 
9 
10 void ana_simple(TString infile, TString cfgfile="analysis.cfg",int nevts=0,TString outfile="")
11 {
12  TStopwatch timer;
13  timer.Start();
14  gDebug=0;
15 
16  // Load basic libraries
17  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");rootlogon();
18 
19 /* // Load this example libraries
20  gSystem->Load("libGeoBase");
21  gSystem->Load("libParBase");
22  gSystem->Load("libBase");
23  //gSystem->Load("libPndData");
24  //gSystem->Load("libGen");
25  gSystem->Load("libRho");
26  gSystem->Load("libfastsim");*/
27 
28  if (outfile=="") outfile=infile+"_ana.root";
29 
30  //analysis
31 
32  PndEventReader evr(infile);
33  if (nevts==0) nevts=evr.GetEntries();
34 
35  cout <<"\n####### Processing "<<nevts <<" events...\n"<<endl;
36 
37 
38  FairRunAna *fRunA= new FairRunAna();
39  fRunA->SetInputFile(infile);
40  fRunA->SetOutputFile(outfile);
41 
42  //append the analysis task
43  PndSimpleAnalysis *anaTask=new PndSimpleAnalysis(cfgfile.Data());
44  fRunA->AddTask(anaTask);
45 
46  fRunA->Init();
47  fRunA->Run(0,nevts);
48 
49 
50  timer.Stop();
51  Double_t rtime = timer.RealTime();
52  Double_t ctime = timer.CpuTime();
53  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
54 }
55 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Double_t
void ana_simple(TString infile, TString cfgfile="analysis.cfg", int nevts=0, TString outfile="")
TStopwatch timer
Definition: hit_dirc.C:51
gDebug
Definition: sim_emc_apd.C:6
Double_t ctime
Definition: hit_dirc.C:114
virtual InitStatus Init()
Double_t rtime
Definition: hit_dirc.C:113
TFile infile("dedx_out.root","READ")
TString outfile