FairRoot/PandaRoot
Functions
Resolution_and_acceptance.cxx File Reference
#include <iostream>
#include <sstream>
#include <TApplication.h>
#include <TCanvas.h>
#include <TROOT.h>
#include <TString.h>
#include <TChain.h>
#include <TFile.h>
#include <TClonesArray.h>
#include <TSystem.h>
#include <TH1.h>
#include <TH2.h>
#include <TRotation.h>
#include <TVector3.h>
#include <TMath.h>
#include <TGaxis.h>
#include <TStopwatch.h>
#include <PndMCTrack.h>
#include <PndSdsMCPoint.h>
#include <FairRunAna.h>
#include <FairRootManager.h>
#include <FairGeane.h>
#include <FairRtdbRun.h>
#include <FairRuntimeDb.h>
#include <FairParRootFileIo.h>
#include <PndLmdPerformanceTask.h>
#include <FairLogger.h>
#include <string>

Go to the source code of this file.

Functions

int main (int nargs, char **args)
 

Function Documentation

int main ( int  nargs,
char **  args 
)

Definition at line 44 of file Resolution_and_acceptance.cxx.

References ctime, DigiFile, Double_t, fRun, Geane, MCFile, outFile, parFile, parInput1, RecoFile, rtdb, rtime, PndLmdPerformanceTask::SetHistFilename(), startEvent, storePath, timer, and TString.

44  {
45  //TApplication myapp("myapp",0,0);
46  TString storePath = "./tmpOutput";
47  // set the storepath to somewhere else, if provided
48  if (nargs == 2) {
49  storePath = args[1];
50  } else {
51  if (nargs == 1)
52  cout << " Hint: you may change the standard path from "
53  << storePath.Data()
54  << " to any other folder by providing the path as an argument! "
55  << endl;
56  if (nargs > 2)
57  cout << " Error: too many arguments! " << endl;
58  }
59  TString startEvent = "0";
60  // ========================================================================
61  // Input file (MC events)
62  TString MCFile = storePath + "/Lumi_MC_";
63  MCFile += startEvent;
64  MCFile += ".root";
65  TString DigiFile = storePath + "/Lumi_digi_";
66  DigiFile += startEvent;
67  DigiFile += ".root";
68  // Digi file
69  TString RecoFile = storePath + "/Lumi_reco_";
70  RecoFile += startEvent;
71  RecoFile += ".root";
72  // TCand file
73  TString CandFile = storePath + "/Lumi_TCand_";
74  CandFile += startEvent;
75  CandFile += ".root";
76  // Parameter file << this one
77  TString parFile = storePath + "/Lumi_Params_";
78  parFile += startEvent;
79  parFile += ".root";
80  // Track file
81  TString TrkFile = storePath + "/Lumi_Track_";
82  TrkFile += startEvent;
83  TrkFile += ".root";
84 
85  // ---- Load libraries -------------------------------------------------
86  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
87  gSystem->Load("libSds");
88  gSystem->Load("libSdsReco");
89  gSystem->Load("libLmd");
90  gSystem->Load("libLmdReco");
91  gSystem->Load("libLmdTrk");
92  // ------------------------------------------------------------------------
93  // Output file
94  TString outFile = storePath + "/Lumi_Testing_";
95  outFile += startEvent;
96  outFile += ".root";
97 
98  // Output histogram file
99  TString outFilehist = storePath + "/Lumi_performance_histograms_";
100  outFilehist += startEvent;
101  outFilehist += ".root";
102 
103  std::cout << "MCFile : " << MCFile.Data() << std::endl;
104  std::cout << "DigiFile: " << DigiFile.Data() << std::endl;
105  std::cout << "RecoFile: " << RecoFile.Data() << std::endl;
106  std::cout << "TCandFile: " << CandFile.Data() << std::endl;
107  std::cout << "TrackFile: " << TrkFile.Data() << std::endl;
108  std::cout << "TestingFile: " << outFile.Data() << std::endl;
109  // --- Now choose concrete engines for the different tasks -------------
110  // ------------------------------------------------------------------------
111 
112 
113  // In general, the following parts need not be touched
114  // ========================================================================
115 
116 
117  // ----- Timer --------------------------------------------------------
118  TStopwatch timer;
119  timer.Start();
120  // ------------------------------------------------------------------------
121 
122 
123  // ----- Reconstruction run -------------------------------------------
124  FairRunAna *fRun = new FairRunAna();
125  fRun->SetInputFile(MCFile);
126  //fRun->AddFriend(DigiFile);
127  //fRun->AddFriend(RecoFile);
128  //fRun->AddFriend(CandFile);
129  //fRun->AddFriend(TrkFile);
130  fRun->SetOutputFile(outFile);
131  // ------------------------------------------------------------------------
132 
133  FairGeane *Geane = new FairGeane();
134  fRun->AddTask(Geane);
135 
136  // ----- Parameter database --------------------------------------------
137  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
138  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
139  parInput1->open(parFile.Data());
140  rtdb->setFirstInput(parInput1);
141 
142  // =========================================================================
143  // ====== Geane Back-Propagating ======
144  // =========================================================================
145 
146  // ----- SDS hit producer --------------------------------------------
147 
148  // PndEmcMapper *emcMap = PndEmcMapper::Instance(6);
149  Double_t fpBeam = 1.5;
150  TVector3 IP(0, 0, 0);
151  PndLmdPerformanceTask* lmdperformance = new PndLmdPerformanceTask(fpBeam,
152  IP);
153  lmdperformance->SetVerbose(0);
154  fRun->AddTask(lmdperformance);
155  rtdb->setOutput(parInput1);
156  lmdperformance->SetHistFilename(outFilehist);
157  rtdb->print();
158  // ===== End of Geane =====
159  // =========================================================================
160 
161  // ----- Intialise and run --------------------------------------------
162  fRun->Init();
163  // // PndEmcMapper *emcMap = PndEmcMapper::Instance(6);
164  // PndEmcMapper *emcMap = PndEmcMapper::Instance();
165  // //Geane->SetField(fRun->GetField());
166  FairRootManager* ioman = FairRootManager::Instance();
167  if (!ioman) {
168  std::cout << "Error: "
169  << "RootManager not instantiated!" << std::endl;
170  return 1;
171  }
172  fRun->Run(0, ioman->CheckMaxEventNo()); // hmm does not work yet, seems to return 0 but then is runs over all what was intended.
173  // ------------------------------------------------------------------------
174  rtdb->saveOutput();
175  rtdb->print();
176  // ----- Finish -------------------------------------------------------
177  timer.Stop();
178  Double_t rtime = timer.RealTime();
179  Double_t ctime = timer.CpuTime();
180  cout << endl << endl;
181  cout << "Macro finished succesfully." << endl;
182  cout << "Output file is " << outFile << endl;
183  cout << "Parameter file is " << parFile << endl;
184  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
185  cout << endl;
186  // ------------------------------------------------------------------------
187 
188  //myapp.Run();
189  return 0;
190 }
TString RecoFile
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
TString DigiFile
Double_t
TString parFile
Definition: hit_dirc.C:14
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetHistFilename(TString filename)
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
TString MCFile
Double_t rtime
Definition: hit_dirc.C:113