FairRoot/PandaRoot
runLumi5RungeKutta.C
Go to the documentation of this file.
1 int runLumi5RungeKutta(const int nEvents=10, const double mom=15, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const bool mergedHits=false)
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
13  if(mergedHits)RecoFile+="/Lumi_recoMerged_";
14  else RecoFile+="/Lumi_reco_";
15  RecoFile += startEvent;
16  RecoFile += ".root";
17  // TCand file
18  TString CandFile = storePath+"/Lumi_TCand_";
19  CandFile += startEvent;
20  CandFile += ".root";
21  // Parameter file
22  TString parFile = storePath+"/Lumi_Params_";
23  parFile += startEvent;
24  parFile += ".root";
25  // Track file
26  TString TrkFile = storePath+"/Lumi_Track_";
27  TrkFile += startEvent;
28  TrkFile += ".root";
29 
30  // ---- Load libraries -------------------------------------------------
31  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
32  gSystem->Load("libSds");
33  gSystem->Load("libSdsReco");
34  gSystem->Load("libLmd");
35  gSystem->Load("libLmdReco");
36  gSystem->Load("libLmdTrk");
37  // ------------------------------------------------------------------------
38 
39 
40  // Output file
41  TString outFile = storePath+"/Lumi_Geane_";
42  outFile += startEvent;
43  outFile += ".root";
44 
45  std::cout << "MCFile : " << MCFile.Data()<< std::endl;
46  std::cout << "DigiFile: " << DigiFile.Data()<< std::endl;
47  std::cout << "RecoFile: " << RecoFile.Data()<< std::endl;
48  std::cout << "TCandFile: " << CandFile.Data()<< std::endl;
49  std::cout << "TrackFile: " << TrkFile.Data()<< std::endl;
50  std::cout << "GeaneFile: " << outFile.Data()<< std::endl;
51  // --- Now choose concrete engines for the different tasks -------------
52  // ------------------------------------------------------------------------
53 
54 
55  // In general, the following parts need not be touched
56  // ========================================================================
57 
58 
59 
60 
61  // ----- Timer ------ --------------------------------------------------
62  TStopwatch timer;
63  timer.Start();
64  // ------------------------------------------------------------------------
65 
66 
67  // ----- Reconstruction run -------------------------------------------
68  FairRunAna *fRun= new FairRunAna();
69  fRun->SetInputFile(MCFile);
70  fRun->AddFriend(DigiFile);
71  fRun->AddFriend(RecoFile);
72  fRun->AddFriend(CandFile);
73  fRun->AddFriend(TrkFile);
74  fRun->SetOutputFile(outFile);
75  // ------------------------------------------------------------------------
76 
77  // ----- Parameter database --------------------------------------------
78  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
79  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
80  parInput1->open(parFile.Data());
81  rtdb->setFirstInput(parInput1);
82 
83 
84  // ======================================================================
85  // ====== Back-Propagating with Runge-Kutta algorithm ======
86  // ======================================================================
87 
88  // ----- SDS hit producer --------------------------------------------
89 
90  // PndEmcMapper *emcMap = PndEmcMapper::Instance(6);
91  Double_t fpBeam = mom;
92  TVector3 IP(0,0,0);
93  // PndLmdGeaneTask* lmdgeane = new PndLmdGeaneTask(fpBeam, IP);
94  // lmdgeane->SetVerbose(verboseLevel);
95  PndLmdBPRungeKuttaTask* lmdbp = new PndLmdBPRungeKuttaTask(fpBeam, IP);
96  lmdbp->SetVerbose(verboseLevel);
97  fRun->AddTask(lmdbp);
98  rtdb->setOutput(parInput1);
99  rtdb->print();
100  // ===== End of Back-Propagating =====
101  // ======================================================================
102 
103  // ----- Intialise and run --------------------------------------------
104  fRun->Init();
105  // // PndEmcMapper *emcMap = PndEmcMapper::Instance(6);
106  // PndEmcMapper *emcMap = PndEmcMapper::Instance();
107  // //Geane->SetField(fRun->GetField());
108  fRun->Run(0,nEvents);
109  // ------------------------------------------------------------------------
110  rtdb->saveOutput();
111  rtdb->print();
112  // ----- Finish -------------------------------------------------------
113  timer.Stop();
114  Double_t rtime = timer.RealTime();
115  Double_t ctime = timer.CpuTime();
116  cout << endl << endl;
117  cout << "Macro finished succesfully." << endl;
118  cout << "Output file is " << outFile << endl;
119  cout << "Parameter file is " << parFile << endl;
120  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
121  cout << endl;
122  // ------------------------------------------------------------------------
123 
124 
125  return 0;
126 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString RecoFile
int runLumi5RungeKutta(const int nEvents=10, const double mom=15, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const bool mergedHits=false)
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
Double_t mom
Definition: plot_dirc.C:14
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
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
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