FairRoot/PandaRoot
runLumiPixel4aFilter.C
Go to the documentation of this file.
1 int runLumiPixel4aFilter(const int nEvents = 100000, const int startEvent = 0,
2  TString storePath = "tmpOutput", const int verboseLevel = 0,
3  const bool mergedHits = true, const bool SkipFilt = false,
4  const bool XthFilt = true, const bool YphFilt = true, const bool BoxFilt =
5  false, const double dX = 0, const double dY = 0) {
6  // ========================================================================
7  // TCand file
8  TString CandFile = storePath + "/Lumi_TCand_";
9  CandFile += startEvent;
10  CandFile += ".root";
11  // Track file
12  TString TrkFile = storePath + "/Lumi_Track_";
13  TrkFile += startEvent;
14  TrkFile += ".root";
15 
16  // Parameter file
17  TString parFile = storePath + "/Lumi_Params_";
18  parFile += startEvent;
19  parFile += ".root";
20 
21  // Output file
22  TString outFile = storePath + "/Lumi_TrackFiltered_";
23  outFile += startEvent;
24  outFile += ".root";
25 
26  std::cout << "TCandFile: " << CandFile.Data() << std::endl;
27  std::cout << "TrackInFile: " << TrkFile.Data() << std::endl;
28  std::cout << "TrackOutFile: " << outFile.Data() << std::endl;
29 
30  // ----- Timer --------------------------------------------------------
31  TStopwatch timer;
32  timer.Start();
33  // ------------------------------------------------------------------------
34 
35  // ----- Reconstruction run -------------------------------------------
36  FairRunAna *fRun = new FairRunAna();
37  FairFileSource input_source(TrkFile);
38  input_source.AddFriend(CandFile);
39  fRun->SetSource(&input_source);
40  fRun->SetOutputFile(outFile);
41 
42  // ------------------------------------------------------------------------
43 
44  // ----- Parameter database --------------------------------------------
45  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
46  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
47  parInput1->open(parFile.Data(), "UPDATE");
48  rtdb->setFirstInput(parInput1);
49 
50  // ======================================
51  // ====== Track Filter ======
52  // ======================================
53 
54  // ----- LMD collections names & importain parameters --------------------------------------------
55  TString inHits = "LMDHitsPixel";
56  if (mergedHits) {
57  inHits = "LMDHitsMerged";
58  }
60 
61  if (SkipFilt) {
62  cout << "Skip Kinematic Cuts!" << endl;
63  lmdfilt->SetSkipKinFilt(true);
64  }
65  if (BoxFilt) {
66  cout << "Set BOX Cuts!" << endl;
67  lmdfilt->SetBOXFilt(true);
68  }
69  if (XthFilt) {
70  cout << "Set X Cuts!" << endl;
71  lmdfilt->SetXThFilt(true);
72  lmdfilt->SetDX(dX);
73  }
74  if (YphFilt) {
75  cout << "Set Y Cuts!" << endl;
76  lmdfilt->SetYPhFilt(true);
77  lmdfilt->SetDY(dY);
78  }
79  lmdfilt->SetVerbose(verboseLevel);
80  fRun->AddTask(lmdfilt);
81 
82  rtdb->setOutput(parInput1);
83  rtdb->print();
84  // ===== End of Track Filter =====
85  // ======================================
86 
87  // ----- Intialise and run --------------------------------------------
88  fRun->Init();
89 
90  fRun->Run(0, nEvents);
91  cout << "fRun->Run(0, " << nEvents << ") was done!" << endl;
92  // ------------------------------------------------------------------------
93 
94  rtdb->saveOutput();
95  rtdb->print();
96  // ----- Finish -------------------------------------------------------
97  timer.Stop();
98  Double_t rtime = timer.RealTime();
99  Double_t ctime = timer.CpuTime();
100  cout << endl << endl;
101  cout << "Macro finished succesfully." << endl;
102  cout << "Output file is " << outFile << endl;
103  cout << "Parameter file is " << parFile << endl;
104  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
105  cout << endl;
106  // ------------------------------------------------------------------------
107 
108  // temporary fix to avoid double frees at the destruction of te program for pandaroot/fairroot with root6
109  gGeoManager->GetListOfVolumes()->Delete();
110  gGeoManager->GetListOfShapes()->Delete();
111  delete gGeoManager;
112 
113  return 0;
114 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
TGeoManager * gGeoManager
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
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
int runLumiPixel4aFilter(const int nEvents=100000, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, const bool mergedHits=true, const bool SkipFilt=false, const bool XthFilt=true, const bool YphFilt=true, const bool BoxFilt=false, const double dX=0, const double dY=0)
Double_t rtime
Definition: hit_dirc.C:113
virtual InitStatus Init()