FairRoot/PandaRoot
outdated/tracking/sttmvdtracking/runreco.C
Go to the documentation of this file.
1 // Macro to reconstruct the MVD data and STT data; also the Mvd+Stt Pattern
2 // Recognition by Gianluigi is performed.
3 //
4 // Updated 6.12.2010
5 // Gianluigi Boca
6 {
7  // ========================================================================
8  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
9  Int_t iVerbose = 0;
10  TString MCFile = "MvdStt_Test.root";
11  TString parFile = "MvdStt_Params.root";
12  Int_t nEvents = 0;
13  // ---- Load libraries -------------------------------------------------
14  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
15  rootlogon();
16  gSystem->Load("libSttMvdTracking");
17 
18  // ------------------------------------------------------------------------
19  // Output file
20  PndFileNameCreator creator(MCFile.Data());
21  TString DigiFile = creator.GetDigiFileName(false).c_str();
22  TString outFile = creator.GetRecoFileName(false).c_str();
23 
24  std::cout << "MCFile : " << MCFile.Data()<< std::endl;
25  std::cout << "DigiFile: " << DigiFile.Data()<< std::endl;
26  std::cout << "RecoFile: " << outFile.Data()<< std::endl;
27 
28  // ----- Timer --------------------------------------------------------
29  TStopwatch timer;
30  timer.Start();
31  // ------------------------------------------------------------------------
32 
33  // ----- Reconstruction run -------------------------------------------
34  FairRunAna *fRun= new FairRunAna();
35  fRun->SetInputFile(MCFile);
36  fRun->AddFriend(DigiFile);
37  fRun->SetOutputFile(outFile);
38  // ------------------------------------------------------------------------
39 
40 
41 
42  // ----- Parameter database --------------------------------------------
43  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
44  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
45  parInput1->open(parFile.Data(),"UPDATE");
46  rtdb->setFirstInput(parInput1);
47 
49 
50  // ----- Default MVD hit producer --------------------------------------------
51 
53  mvdmccls->SetVerbose(iVerbose);
54  fRun->AddTask(mvdmccls);
55 
56  // =========================================================================
57 
58 
59 
60 
61  // =========================================================================
62  // ====== Riemann finder MVD ======
63  // =========================================================================
64 
65  // ----- MVD hit producer --------------------------------------------
66 
68  mvdTrackFinder->SetVerbose(iVerbose);
69  mvdTrackFinder->SetMaxDist(0.05);
70  fRun->AddTask(mvdTrackFinder);
71  // rtdb->setOutput(parInput1);
72  // rtdb->print();
73 
74  // ----- end MVD Rieman finder --------------------------------------------
75  // TRACK FINDING =============================================================================
76  // OUTPUT: PndTrackCand -> STTTrackCand
77  // PndSttTrackFinderIdeal* sttTrackFinder = new PndSttTrackFinderIdeal(iVerbose);
79  PndSttFindTracks* sttFindTracks = new PndSttFindTracks("Track Finder", "FairTask", sttTrackFinder, iVerbose);
80  sttFindTracks->AddHitCollectionName("STTHit", "STTPoint");
81  fRun->AddTask(sttFindTracks);
82 
83 
84  // =========================================================================
85  //-------------------------- stt-mvd task ----------------------------------
86  PndSttMvdTracking * SttMvdTracking = new PndSttMvdTracking(0);
87  fRun->AddTask(SttMvdTracking);
88  // =========================================================================
89 
90  // =========================================================================
91  // TRACK FITTING
92  //
93  // ---- Geane --------------------------------------------------------------
94  FairGeane *Geane = new FairGeane();
95  fRun->AddTask(Geane);
96  //
97  // ----- Kalman task -------------------------------------------------------
99  recoKalman->SetTrackInBranchName("SttMvdTrack");
100  recoKalman->SetTrackOutBranchName("SttMvdKalmanTrack");
101  //recoKalman->SetNumIterations(3);
102  fRun->AddTask(recoKalman);
103  // =========================================================================
104 
105 
106  rtdb->setOutput(parInput1);
107  // rtdb->print();
108 
109  // ----- Intialise and run --------------------------------------------
110  fRun->Init();
111 
112  fRun->Run(0,nEvents);
113  // ------------------------------------------------------------------------
114 
115  SttMvdTracking->WriteHistograms();
116 
117  rtdb->saveOutput();
118  rtdb->print();
119  // ----- Finish -------------------------------------------------------
120  timer.Stop();
121  Double_t rtime = timer.RealTime();
122  Double_t ctime = timer.CpuTime();
123  cout << endl << endl;
124  cout << "Macro finished successfully." << endl;
125  cout << "Output file is " << outFile << endl;
126  cout << "Parameter file is " << parFile << endl;
127  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
128  cout << endl;
129  // ------------------------------------------------------------------------
130 
131 
132 }
PndMvdRiemannTrackFinderTask * mvdTrackFinder
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
TString outFile
Definition: hit_dirc.C:17
PndMvdStripClusterTask * mvdmccls
Definition: runclust.C:45
PndSttTrackFinderReal * sttTrackFinder
void SetTrackOutBranchName(const TString &name)
FairGeane * Geane
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
PndSttMvdTracking * SttMvdTracking
PndSttFindTracks * sttFindTracks
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetVerbose(Int_t iVerbose)
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
PndMvdCreateDefaultApvMap * creator
void SetTrackInBranchName(const TString &name)
Int_t iVerbose
TString MCFile
PndRecoKalmanTask * recoKalman
Double_t rtime
Definition: hit_dirc.C:113
void AddHitCollectionName(char *hitCollectionName, char *pointCollectionName)