FairRoot/PandaRoot
runLumiPixel5bCleanSig.C
Go to the documentation of this file.
1 int runLumiPixel5bCleanSig(const int nEvents = 10, const int startEvent = 0,
2  TString storePath = "tmpOutput", const int verboseLevel = 0,
3  const double mom = 15, const double dX = 0, const double dY = 0) {
4  // ========================================================================
5  TString parFile = storePath + "/Lumi_Params_";
6  parFile += startEvent;
7  parFile += ".root";
8  // // Track file
9  TString TrkFile = storePath + "/Lumi_Track_";
10  TrkFile += startEvent;
11  TrkFile += ".root";
12  // Geane output file
13  TString GeaneFile = storePath + "/Lumi_Geane_";
14  GeaneFile += startEvent;
15  GeaneFile += ".root";
16 
17  //Output file
18  TString outFile = storePath + "/Lumi_GeaneFiltered_";
19  outFile += startEvent;
20  outFile += ".root";
21 
22  std::cout << "TrackFile: " << TrkFile.Data() << std::endl;
23  std::cout << "GeaneFile: " << GeaneFile.Data() << std::endl;
24  std::cout << "OutputFile: " << outFile.Data() << std::endl;
25 
26  // --- Now choose concrete engines for the different tasks -------------
27  // -----------------------------------------------------------------------------------
28 
29  // ----- Timer ------ --------------------------------------------------
30  TStopwatch timer;
31  timer.Start();
32  // ------------------------------------------------------------------------
33 
34  // ----- Reconstruction run -------------------------------------------
35  FairRunAna *fRun = new FairRunAna();
36  FairFileSource input_source(GeaneFile);
37  input_source.AddFriend(TrkFile);
38  fRun->SetSource(&input_source);
39  fRun->SetOutputFile(outFile);
40  // ------------------------------------------------------------------------
41 
42  // ----- Parameter database --------------------------------------------
43  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
44  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
45  parInput1->open(parFile.Data());
46  rtdb->setFirstInput(parInput1);
47 
48  // =========================================================================
49  // ====== Cleaning ======
50  // =========================================================================
51  Double_t fpBeam = mom;
52  TString dir = "TMVAweights/"; //trained on samples with elastic and inelastic events
53  PndLmdSigCleanTask* lmdclean = new PndLmdSigCleanTask(fpBeam, dir);
54  lmdclean->SetVerbose(verboseLevel);
55  lmdclean->SetDX(dX);
56  lmdclean->SetDY(dY);
57  fRun->AddTask(lmdclean);
58  rtdb->setOutput(parInput1);
59  rtdb->print();
60  // =========================================================================
61 
62  // ----- Intialise and run --------------------------------------------
63  fRun->Init();
64  fRun->Run(0, nEvents);
65  // ------------------------------------------------------------------------
66  rtdb->saveOutput();
67  rtdb->print();
68  // ----- Finish -------------------------------------------------------
69  timer.Stop();
70  Double_t rtime = timer.RealTime();
71  Double_t ctime = timer.CpuTime();
72  cout << endl << endl;
73  cout << "Macro finished succesfully." << endl;
74  cout << "Output file is " << outFile << endl;
75  cout << "Parameter file is " << parFile << endl;
76  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
77  cout << endl;
78  // ------------------------------------------------------------------------
79  // temporary fix to avoid double frees at the destruction of te program for pandaroot/fairroot with root6
80  gGeoManager->GetListOfVolumes()->Delete();
81  gGeoManager->GetListOfShapes()->Delete();
82  delete gGeoManager;
83 
84  return 0;
85 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
Double_t mom
Definition: plot_dirc.C:14
TGeoManager * gGeoManager
FairRunAna * fRun
Definition: hit_dirc.C:58
void SetDX(double dx)
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
void SetDY(double dy)
int runLumiPixel5bCleanSig(const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const double mom=15, const double dX=0, const double dY=0)
Double_t rtime
Definition: hit_dirc.C:113