FairRoot/PandaRoot
runLumiPixel5BackProp.C
Go to the documentation of this file.
1 int runLumiPixel5BackProp(const int nEvents = 10, const int startEvent = 0,
2  TString storePath = "tmpOutput", const int verboseLevel = 0,
3  const TString Method = "Geane", const bool mergedHits = true,
4  const double mom = 15, double ipc_x = 0.0, double ipc_y = 0.0,
5  double ipc_z = 0.0, bool is_prefiltered = true) {
6  // ========================================================================
7  // Parameter file
8  TString parFile = storePath + "/Lumi_Params_";
9  parFile += startEvent;
10  parFile += ".root";
11  // Track file
12  TString TrkFile = storePath + "/Lumi_Track_";
13  TrkFile += startEvent;
14  TrkFile += ".root";
15 
16  // Output file
17  TString outFile = storePath + "/Lumi_Geane_";
18  outFile += startEvent;
19  outFile += ".root";
20 
21  std::cout << "TrackFile: " << TrkFile.Data() << std::endl;
22  std::cout << "GeaneFile: " << outFile.Data() << std::endl;
23 
24  // ----- Timer ------ --------------------------------------------------
25  TStopwatch timer;
26  timer.Start();
27  // ------------------------------------------------------------------------
28 
29  // ----- Reconstruction run -------------------------------------------
30  FairRunAna *fRun = new FairRunAna();
31  FairFileSource input_source(TrkFile);
32  fRun->SetSource(&input_source);
33  fRun->SetOutputFile(outFile);
34  // ------------------------------------------------------------------------
35 
36  // ----- Parameter database --------------------------------------------
37  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
38  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
39  parInput1->open(parFile.Data());
40  rtdb->setFirstInput(parInput1);
41 
42  // =========================================================================
43  // ====== Back-Propagating ======
44  // =========================================================================
45 
46  Double_t fpBeam = mom;
47  TVector3 IP(ipc_x, ipc_y, ipc_z);
48  if (Method == "Geane") {
49  FairGeane *Geane = new FairGeane();
50  fRun->AddTask(Geane);
51  PndLmdGeaneTask* lmdgeane = new PndLmdGeaneTask(fpBeam, IP, is_prefiltered);
52  lmdgeane->SetVerbose(verboseLevel);
53  fRun->AddTask(lmdgeane);
54  } else {
55  if (Method == "RK") {
56  //PndLmdBPRungeKuttaTask have dependences from genfit -> switched off until movement to gentfit2
57  cout
58  << "I'm very sorry, but BPRungeKuttaTask option for LMD is currently switched off :("
59  << endl;
60  // PndLmdBPRungeKuttaTask* lmdbp = new PndLmdBPRungeKuttaTask(fpBeam, IP);
61  // lmdbp->SetVerbose(verboseLevel);
62  // fRun->AddTask(lmdbp);
63  } else {
64  cout << "Method " << Method.Data() << " doesn't exist!" << endl;
65  }
66  }
67  rtdb->setOutput(parInput1);
68  rtdb->print();
69  // ===== End of Geane =====
70  // =========================================================================
71 
72  // ----- Intialise and run --------------------------------------------
73  fRun->Init();
74  // // PndEmcMapper *emcMap = PndEmcMapper::Instance(6);
75  // PndEmcMapper *emcMap = PndEmcMapper::Instance();
76  // //Geane->SetField(fRun->GetField());
77  fRun->Run(0, nEvents);
78  // ------------------------------------------------------------------------
79  rtdb->saveOutput();
80  rtdb->print();
81  // ----- Finish -------------------------------------------------------
82  timer.Stop();
83  Double_t rtime = timer.RealTime();
84  Double_t ctime = timer.CpuTime();
85  cout << endl << endl;
86  cout << "Macro finished succesfully." << endl;
87  cout << "Output file is " << outFile << endl;
88  cout << "Parameter file is " << parFile << endl;
89  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
90  cout << endl;
91  // ------------------------------------------------------------------------
92 
93  // temporary fix to avoid double frees at the destruction of te program for pandaroot/fairroot with root6
94  gGeoManager->GetListOfVolumes()->Delete();
95  gGeoManager->GetListOfShapes()->Delete();
96  delete gGeoManager;
97 
98  return 0;
99 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
virtual InitStatus Init()
Int_t startEvent
TString storePath
Double_t mom
Definition: plot_dirc.C:14
TGeoManager * gGeoManager
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
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 runLumiPixel5BackProp(const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const TString Method="Geane", const bool mergedHits=true, const double mom=15, double ipc_x=0.0, double ipc_y=0.0, double ipc_z=0.0, bool is_prefiltered=true)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
Double_t rtime
Definition: hit_dirc.C:113