FairRoot/PandaRoot
rho/tut_ana_task.C
Go to the documentation of this file.
1 void tut_ana_task(int nevts = 0, TString prefix = "signal")
2 {
3  TString OutFile=prefix+"_ana_task.root";
4 
5  // *** the files coming from the simulation
6  TString inPidFile = prefix+"_pid.root"; // this file contains the PndPidCandidates and McTruth
7  TString inParFile = prefix+"_par.root";
8 
9  // *** PID table with selection thresholds; can be modified by the user
10  TString pidParFile = TString(gSystem->Getenv("VMCWORKDIR"))+"/macro/params/all.par";
11 
12  // *** initialization
13  FairLogger::GetLogger()->SetLogToFile(kFALSE);
14  FairRunAna* fRun = new FairRunAna();
15  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
16  fRun->SetSource(new FairFileSource(inPidFile));
17 
18  // *** setup parameter database
19  FairParRootFileIo* parIO = new FairParRootFileIo();
20  parIO->open(inParFile);
21  FairParAsciiFileIo* parIOPid = new FairParAsciiFileIo();
22  parIOPid->open(pidParFile.Data(),"in");
23 
24  rtdb->setFirstInput(parIO);
25  rtdb->setSecondInput(parIOPid);
26  rtdb->setOutput(parIO);
27 
28  fRun->SetOutputFile(OutFile);
29 
30  // *** HERE OUR TASK GOES!
31  PndTutAnaTask *anaTask = new PndTutAnaTask();
32  fRun->AddTask(anaTask);
33 
34  // *** and run analysis
35  fRun->Init();
36  fRun->Run(0,nevts);
37 }
void tut_ana_task(TString pref="pid_complete.root", int min=-1, int max=1, int nevts=0)
FairRunAna * fRun
Definition: hit_dirc.C:58
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66