FairRoot/PandaRoot
runLumi4Fitter.C
Go to the documentation of this file.
1 int runLumi4Fitter(const int nEvents=100000, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0)
2 {
3  // ========================================================================
4  // Input file (MC events)
5  TString MCFile = storePath+"/Lumi_MC_";
6  MCFile += startEvent;
7  MCFile += ".root";
8  TString DigiFile = storePath+"/Lumi_digi_";
9  DigiFile += startEvent;
10  DigiFile += ".root";
11  // Digi file
12  TString RecoFile = storePath+"/Lumi_reco_";
13  RecoFile += startEvent;
14  RecoFile += ".root";
15  // TCand file
16  TString CandFile = storePath+"/Lumi_TCand_";
17  CandFile += startEvent;
18  CandFile += ".root";
19  // Parameter file
20  TString parFile = storePath+"/Lumi_Params_";
21  parFile += startEvent;
22  parFile += ".root";
23 
24  // ---- Load libraries -------------------------------------------------
25  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
26  gSystem->Load("libSds");
27  gSystem->Load("libSdsReco");
28  gSystem->Load("libLmd");
29  gSystem->Load("libLmdReco");
30  gSystem->Load("libLmdTrk");
31  // ------------------------------------------------------------------------
32  // Output file
33  TString outFile = storePath+"/Lumi_Track_";
34  outFile += startEvent;
35  outFile += ".root";
36 
37  std::cout << "MCFile : " << MCFile.Data()<< std::endl;
38  std::cout << "DigiFile: " << DigiFile.Data()<< std::endl;
39  std::cout << "RecoFile: " << RecoFile.Data()<< std::endl;
40  std::cout << "TCandFile: " << CandFile.Data()<< std::endl;
41  std::cout << "TrackFile: " << outFile.Data()<< std::endl;
42  // --- Now choose concrete engines for the different tasks -------------
43  // ------------------------------------------------------------------------
44 
45 
46  // In general, the following parts need not be touched
47  // ========================================================================
48 
49 
50 
51 
52  // ----- Timer --------------------------------------------------------
53  TStopwatch timer;
54  timer.Start();
55  // ------------------------------------------------------------------------
56 
57 
58  // ----- Reconstruction run -------------------------------------------
59  FairRunAna *fRun= new FairRunAna();
60  fRun->SetInputFile(MCFile);
61  fRun->AddFriend(DigiFile);
62  fRun->AddFriend(RecoFile);
63  fRun->AddFriend(CandFile);
64 
65  fRun->SetOutputFile(outFile);
66  // ------------------------------------------------------------------------
67 
68 
69  // ----- Parameter database --------------------------------------------
70  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
71  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
72  parInput1->open(parFile.Data(),"UPDATE");
73  rtdb->setFirstInput(parInput1);
74 
75 
76  // =========================================================================
77  // ====== Track Finder ======
78  // =========================================================================
79 
80  // ----- MVD hit producer --------------------------------------------
81 
82  PndLmdLinFitTask* lmdfit = new PndLmdLinFitTask("LMDTrackCand","LMDHitsStrip");
83  lmdfit->SetVerbose(verboseLevel);
84  fRun->AddTask(lmdfit);
85 
86  rtdb->setOutput(parInput1);
87  rtdb->print();
88  // ===== End of TrackFinding =====
89  // =========================================================================
90 
91 
92  // ----- Intialise and run --------------------------------------------
93  fRun->Init();
94 
95  fRun->Run(0,nEvents);
96  cout<<"fRun->Run(0, "<<nEvents<<") was done!"<<endl;
97  // ------------------------------------------------------------------------
98 
99  rtdb->saveOutput();
100  rtdb->print();
101  // ----- Finish -------------------------------------------------------
102  timer.Stop();
103  Double_t rtime = timer.RealTime();
104  Double_t ctime = timer.CpuTime();
105  cout << endl << endl;
106  cout << "Macro finished succesfully." << endl;
107  cout << "Output file is " << outFile << endl;
108  cout << "Parameter file is " << parFile << endl;
109  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
110  cout << endl;
111  // ------------------------------------------------------------------------
112 
113 
114  return 0;
115 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString RecoFile
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
FairRunAna * fRun
Definition: hit_dirc.C:58
TString DigiFile
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
int runLumi4Fitter(const int nEvents=100000, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0)
Definition: runLumi4Fitter.C:1
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
TString MCFile
PndLmdLinFitTask * lmdfit
Double_t rtime
Definition: hit_dirc.C:113
virtual InitStatus Init()