FairRoot/PandaRoot
runLumiPixel2bHitMerge.C
Go to the documentation of this file.
1 int runLumiPixel2bHitMerge(const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, bool misalign=false)
2 {
3  // ========================================================================
4  // Input file (Reco events)
5  TString RecoFile = storePath+"/Lumi_reco_";
6  RecoFile += startEvent;
7  RecoFile += ".root";
8  // Parameter file
9  TString parFile = storePath+"/Lumi_Params_";
10  parFile += startEvent;
11  parFile += ".root";
12 
13  // // ---- Load libraries -------------------------------------------------
14  // gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
15  // gSystem->Load("libSds");
16  // gSystem->Load("libSdsReco");
17  // gSystem->Load("libLmd");
18  // gSystem->Load("libLmdReco");
19  // gSystem->Load("libLmdTrk");
20  // // ------------------------------------------------------------------------
21  // Output file
22  TString outFile = storePath+"/Lumi_recoMerged_";
23  outFile += startEvent;
24  outFile += ".root";
25 
26  std::cout << "RecoFile : " << RecoFile.Data()<< std::endl;
27  std::cout << "RecoMergedFile: " << outFile.Data()<< std::endl;
28  // --- Now choose concrete engines for the different tasks -------------
29  // ------------------------------------------------------------------------
30 
31 
32  // In general, the following parts need not be touched
33  // ========================================================================
34 
35 
36 
37 
38  // ----- Timer --------------------------------------------------------
39  TStopwatch timer;
40  timer.Start();
41  // ------------------------------------------------------------------------
42 
43 
44 
45  // ----- Reconstruction run -------------------------------------------
46  FairRunAna *fRun= new FairRunAna();
47 
48  FairFileSource input_source(RecoFile);
49  fRun->SetSource(&input_source);
50  fRun->SetOutputFile(outFile);
51 
52  // ------------------------------------------------------------------------
53 
54 
55 
56  // ----- Parameter database --------------------------------------------
57  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
58  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
59  parInput1->open(parFile.Data(),"UPDATE");
60 // FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo();
61 // parInput1->open(parFile.Data(),"in");
62  rtdb->setFirstInput(parInput1);
63  /*Bool_t kParameterMerged=kTRUE;
64  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
65  output->open(parOutFile);
66  rtdb->setOutput(output);
67 */
68 // fRun->LoadGeometry();
69  // ------------------------------------------------------------------------
70 
71 
72 
73  // =========================================================================
74  // ====== Hit Producers ======
75  // =========================================================================
76 
77  // ----- MVD hit producer --------------------------------------------
78 
79  PndLmdHitMergeTask* lmdmccls = new PndLmdHitMergeTask();
80  lmdmccls->SetVerbose(verboseLevel);
81  fRun->AddTask(lmdmccls);
82 
83  // PndMvdPixelClusterTask* mvdClusterizer = new PndMvdPixelClusterTask(chargecut, MCFile);//, slx, sly, sthreshold, snoise);
84  // mvdClusterizer->SetVerbose(verboseLevel);
85  // fRun->AddTask(mvdClusterizer);
86 
87 // FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
88 // output->open(parOutFile.Data());
89 // rtdb->setOutput(output);
90  rtdb->setOutput(parInput1);
91  rtdb->print();
92  // ===== End of HitProducers =====
93  // =========================================================================
94 // PndMvdGeoPar* geoPar = (PndMvdGeoPar*)(rtdb->getContainer("PndMvdGeoPar"));
95 
96  // ----- Intialise and run --------------------------------------------
97  fRun->Init();
98 
99  fRun->Run(0,nEvents);
100  // ------------------------------------------------------------------------
101 
102  rtdb->saveOutput();
103  rtdb->print();
104  // ----- Finish -------------------------------------------------------
105  timer.Stop();
106  Double_t rtime = timer.RealTime();
107  Double_t ctime = timer.CpuTime();
108  cout << endl << endl;
109  cout << "Macro finished succesfully." << endl;
110  cout << "Output file is " << outFile << endl;
111  cout << "Parameter file is " << parFile << endl;
112  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
113  cout << endl;
114  // ------------------------------------------------------------------------
115 
116  // temporary fix to avoid double frees at the destruction of te program for pandaroot/fairroot with root6
117  gGeoManager->GetListOfVolumes()->Delete();
118  gGeoManager->GetListOfShapes()->Delete();
119  delete gGeoManager;
120 
121  return 0;
122 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
TString RecoFile
TString outFile
Definition: hit_dirc.C:17
Int_t startEvent
TString storePath
int runLumiPixel2bHitMerge(const int nEvents=10, const int startEvent=0, TString storePath="tmpOutput", const int verboseLevel=0, bool misalign=false)
TGeoManager * gGeoManager
virtual InitStatus Init()
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
Double_t rtime
Definition: hit_dirc.C:113