FairRoot/PandaRoot
COSYBackgroundAnalysis2014.C
Go to the documentation of this file.
1 int COSYBackgroundAnalysis2014(TString Filename, Int_t StartEvent=0, Int_t NoOfEvents=0)
2 {
3  Int_t nEvents= NoOfEvents;//1000000;
4  Int_t iVerbose = 0;
5 
6  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
7  rootlogon();
8 
9  gSystem->Load("libHyp");
10  gSystem->Load("libHypGe");
11  gSystem->Load("libSpectrum");
12  // ----- Timer --------------------------------------------------------
13  TStopwatch timer;
14  timer.Start();
15 
16  //---------compose inFile----------------------------------------------------
17  if(Filename.EndsWith(".root",1))
18  {
19  Filename.ReplaceAll(".root","");
20  cout << "Filename ending chopped!" << endl;
21  }
22  TString Path = getenv("SIMDATADIR");
23  Path += "/COSY";
24  TString inFile = Path+"/"+Filename+".root";
25 
26  //---------compose parFile---------------------------------------------------
27  TString parFile = Path+"/"+Filename+"__Simparams.root";
28  //---------compose outFile---------------------------------------------------
29 
30  TString outFile= Path;
31  outFile += "/Ana/ToCombine/";
32  outFile += Filename;
33  outFile += "/Ana";
34  outFile += Filename;
35  outFile.ReplaceAll(".root","");
36  outFile += "_Start_";
37  outFile += StartEvent;
38  outFile += "_nEvents_";
39  outFile += NoOfEvents;
40  outFile += ".root";
41  //TString txtfileName = outFile;
42  //txtfileName += ".txt";
43  //cout <<endl << outFile << endl << endl;
44 
45  //--------- gamma ana run
46  FairRunAna *fRun= new FairRunAna();
47  fRun->SetInputFile(inFile.Data());
48  fRun->SetOutputFile(outFile.Data());
49 
50  // ----- Parameter database --------------------------------------------
51 
52  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
53  FairParRootFileIo* parInput1 = new FairParRootFileIo();
54  parInput1->open(parFile.Data());
55 
57  rtdb->setFirstInput(parInput1);
58 
59 
60 
61  //--------analysis task----------------------------------------------------
63  COSYAna->SetVerbose(iVerbose);
64  //fRun->AddTask(COSYAna);
65 
66 
67  fRun->Init();
68 
69  fRun->Run(StartEvent,nEvents); //Run(Int_t NStart ,Int_t NStop);
70 
71 
72 
73  // ----- Finish -------------------------------------------------------
74  timer.Stop();
75  Double_t rtime = timer.RealTime();
76  Double_t ctime = timer.CpuTime();
77  cout << endl << endl;
78  cout << "Macro finished succesfully." << endl;
79  cout << "Output file is " << outFile << endl;
80  //cout << "Text file is " << txtfileName << endl;
81  cout << "Parameter file is " << parFile << endl;
82  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
83  cout << endl;
84  return 0;
85 }
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
TString outFile
Definition: hit_dirc.C:17
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
int COSYBackgroundAnalysis2014(TString Filename, Int_t StartEvent=0, Int_t NoOfEvents=0)
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
Int_t iVerbose
Double_t rtime
Definition: hit_dirc.C:113