FairRoot/PandaRoot
Tobias/runMvdReco.C
Go to the documentation of this file.
1 {
2  // ========================================================================
3  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
4  Int_t iVerbose = 0;
5  // Input file (MC events)
6  TString MCFile = "MvdTpc_Pions.root";
7  // Parameter file
8  TString parFile = "MvdParams.root";
9  // Parameter output file
10  // TString parOutFile = "MvdParams.root";
11  // Number of events to process
12  Int_t nEvents = 10;
13  // ---- Load libraries -------------------------------------------------
14  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
15  // ------------------------------------------------------------------------
16  // Output file
17  PndFileNameCreator creator(MCFile.Data());
18  TString DigiFile = creator.GetDigiFileName(false).c_str();
19  TString outFile = creator.GetRecoFileName(false).c_str();
20 
21  std::cout << "MCFile : " << MCFile.Data()<< std::endl;
22  std::cout << "DigiFile: " << DigiFile.Data()<< std::endl;
23  std::cout << "RecoFile: " << outFile.Data()<< std::endl;
24  // --- Now choose concrete engines for the different tasks -------------
25  // ------------------------------------------------------------------------
26 
27 
28  // In general, the following parts need not be touched
29  // ========================================================================
30 
31 
32 
33 
34  // ----- Timer --------------------------------------------------------
35  TStopwatch timer;
36  timer.Start();
37  // ------------------------------------------------------------------------
38 
39 
40 
41  // ----- Reconstruction run -------------------------------------------
42  FairRunAna *fRun= new FairRunAna();
43  fRun->SetInputFile(DigiFile);
44  fRun->AddFriend(MCFile);
45  fRun->SetOutputFile(outFile);
46  // ------------------------------------------------------------------------
47 
48 
49 
50  // ----- Parameter database --------------------------------------------
51  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
52  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
53  parInput1->open(parFile.Data(),"UPDATE");
54 // FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo();
55 // parInput1->open(parFile.Data(),"in");
56  rtdb->setFirstInput(parInput1);
57  /*Bool_t kParameterMerged=kTRUE;
58  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
59  output->open(parOutFile);
60  rtdb->setOutput(output);
61 */
62 // fRun->LoadGeometry();
63  // ------------------------------------------------------------------------
64 
65 
66 
67  // =========================================================================
68  // ====== Hit Producers ======
69  // =========================================================================
70 
71  // ----- MVD hit producer --------------------------------------------
72 
75  mvdmccls->SetVerbose(iVerbose);
76  fRun->AddTask(mvdmccls);
77 
79  mvdClusterizer->SetVerbose(iVerbose);
80  fRun->AddTask(mvdClusterizer);
81 
82  // ----- STT hit producer --------------------------------------------
83  // trackfinding ....
84  /* PndSttTrackFinderIdeal* sttTrackFinder = new PndSttTrackFinderIdeal(iVerbose);
85  PndSttFindTracks* sttFindTracks = new PndSttFindTracks("Track Finder", "FairTask", sttTrackFinder, iVerbose);
86  sttFindTracks->AddHitCollectionName("STTHit", "STTPoint");
87  fRun->AddTask(sttFindTracks);
88 
89  // trackmatching ....
90  PndSttMatchTracks* sttTrackMatcher = new PndSttMatchTracks("Match tracks", "STT", iVerbose);
91  sttTrackMatcher->AddHitCollectionName("STTHit", "STTPoint");
92  fRun->AddTask(sttTrackMatcher);
93 
94  // trackfitting ....
95  PndSttTrackFitter* sttTrackFitter = new PndSttHelixTrackFitter(0);
96  PndSttFitTracks* sttFitTracks = new PndSttFitTracks("STT Track Fitter", "FairTask", sttTrackFitter);
97  sttFitTracks->AddHitCollectionName("STTHit");
98  fRun->AddTask(sttFitTracks);
99 
100  // helix hit production ....
101  PndSttHelixHitProducer* sttHHProducer = new PndSttHelixHitProducer();
102  fRun->AddTask(sttHHProducer);
103  */
104  // ----- TPC hit producer --------------------------------------------
105 
106  PndTpcClusterFinderTask* tpcCF = new PndTpcClusterFinderTask();
107  tpcCF->SetPersistence();
108  tpcCF->timeslice(20); // = 4 sample times = 100ns @ 40MHz
109  fRun->AddTask(tpcCF);
110 
111 // FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
112 // output->open(parOutFile.Data());
113 // rtdb->setOutput(output);
114  rtdb->setOutput(parInput1);
115  rtdb->print();
116  // ===== End of HitProducers =====
117  // =========================================================================
118 // PndMvdGeoPar* geoPar = (PndMvdGeoPar*)(rtdb->getContainer("PndMvdGeoPar"));
119 
120  // ----- Intialise and run --------------------------------------------
121  fRun->Init();
122 
123  fRun->Run(0,nEvents);
124  // ------------------------------------------------------------------------
125 
126  rtdb->saveOutput();
127  rtdb->print();
128  // ----- Finish -------------------------------------------------------
129  timer.Stop();
130  Double_t rtime = timer.RealTime();
131  Double_t ctime = timer.CpuTime();
132  cout << endl << endl;
133  cout << "Macro finished succesfully." << endl;
134  cout << "Output file is " << outFile << endl;
135  cout << "Parameter file is " << parFile << endl;
136  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
137  cout << endl;
138  // ------------------------------------------------------------------------
139 
140 
141 }
PndMvdPixelClusterTask * mvdClusterizer
Definition: runclust.C:50
TString outFile
Definition: hit_dirc.C:17
Double_t chargecut
Definition: runclust.C:44
PndMvdStripClusterTask * mvdmccls
Definition: runclust.C:45
FairRunAna * fRun
Definition: hit_dirc.C:58
TString DigiFile
A simple class which adds the corresponding file extensions to a given base class.
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
PndMvdCreateDefaultApvMap * creator
Int_t iVerbose
TString MCFile
PndTpcClusterFinderTask * tpcCF
Double_t rtime
Definition: hit_dirc.C:113