FairRoot/PandaRoot
reco_template.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 
6  // Input file
7  TString inDigiFile = "dpm_digi_tpc.root";
8  TString inSimFile = "dpm_points_tpc.root";
9 
10  // Parameter file
11  TString parFile = "dpm_params_tpc.root";
12 
13  // Output file
14  TString outFile = "dpm_reco_tpc.root";
15 
16  // Number of events to process
17  Int_t nEvents = 0;
18 
19  // ---- Load libraries -------------------------------------------------
20  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
21  rootlogon();
22  TString sysFile = gSystem->Getenv("VMCWORKDIR");
23  // ------------------------------------------------------------------------
24  // In general, the following parts need not be touched
25  // ========================================================================
26 
27  // ----- Timer --------------------------------------------------------
28  TStopwatch timer;
29  timer.Start();
30  // ------------------------------------------------------------------------
31 
32  // ----- Digitization run -------------------------------------------
33  FairRunAna *fRun= new FairRunAna();
34  fRun->SetInputFile(inDigiFile);
35  fRun->AddFriend(inSimFile);
36  fRun->SetOutputFile(outFile);
37 
38  // ------------------------------------------------------------------------
39 
40  // ----- Parameter database --------------------------------------------
41  TString allDigiFile = sysFile+"/macro/params/all.par";
42 
43  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
44  FairParRootFileIo* parInput1 = new FairParRootFileIo();
45  parInput1->open(parFile.Data());
46 
47  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
48  parIo1->open(allDigiFile.Data(),"in");
49 
50  rtdb->setFirstInput(parInput1);
51  rtdb->setSecondInput(parIo1);
53 
54  bool SimpleClustering=true;
55 
56  // TString geoFile = sysFile;
57  // geoFile+="/tpc/TPC_V1.1.root";
58  // fRun->SetGeomFile(geoFile);
59 
60  FairGeane *Geane = new FairGeane();
61  fRun->AddTask(Geane);
62 
63  // ------- RECO procedure ------------------------------------------------
64 
65  //correct for unfortunate shift in TPC digi
66  //PndTpcRoughAlignmentTask* align = new PndTpcRoughAlignmentTask();
67  //align->SetShift(TVector3(0.,0.,-3.71357e-01)); //old PSA
68  //align->SetShift(TVector3(0.,0.,5.6E-2)); //new PSA
69  //fRun->AddTask(align);
70 
71 
72  //find PndTpcRiemannTracks in the TPC alone
73  PndTpcRiemannTrackingTask* tpcSPR = new PndTpcRiemannTrackingTask();
74  //tpcSPR->SetPersistence();
75  //tpcSPR->SetVerbose(1);
76  fRun->AddTask(tpcSPR);
77 
78  //build GFTracks from PndTpcRiemannTracks
79  PndTpcTrackInitTask* trackInit=new PndTpcTrackInitTask();
80  trackInit->SetPersistence();
81  //trackInit->SetVerbose(1);
82  trackInit->SetMCPid(); // use ideal particle identification
83  //trackInit->SetPDG(211);
84  //trackInit->useGeane(); // uses RKTrackrep and GeaneTrackrep
85  trackInit->SetSmoothing(true);
86  fRun->AddTask(trackInit);
87 
88  KalmanTask* kalman =new KalmanTask();
89  kalman->SetPersistence();
90  kalman->SetNumIterations(3); // number of fitting iterations (back and forth)
91  fRun->AddTask(kalman); // creates TrackPostFit branch
92 
93  //correlate fitted track with MVD pixels and strips
94  PndTpcMVDCorrelatorTask* corr = new PndTpcMVDCorrelatorTask();
95  corr->SetMatchDistance(0.18); //cm
96  corr->SetMinMVDHits(3);
97  corr->SetOutTrackBranchName("TrackPreFitMVD");
98  corr->SetPersistence(true);
99  fRun->AddTask(corr);
100 
101 
102  //fit after MVD corr
103  KalmanTask* kalman2 =new KalmanTask();
104  kalman2->SetPersistence();
105  kalman2->SetNumIterations(3); // number of fitting iterations (back and forth)
106  kalman2->SetTrackBranchName("TrackPreFitMVD");
107  kalman2->SetOutBranchName("TrackPostFitMVD");
108  fRun->AddTask(kalman2);
109 
110  PndTpcGEMCorrelatorTask* corrG = new PndTpcGEMCorrelatorTask();
111  corrG->SetMatchDistance(0.5); //cm
112  corrG->SetMinGEMHits(2);
113  corrG->SetTrackBranchName("TrackPostFitMVD");
114  corrG->SetOutTrackBranchName("TrackPreFitGEM");
115  corrG->SetPersistence(true);
116  fRun->AddTask(corrG);
117 
118  //final fit
119  KalmanTask* kalman3 =new KalmanTask();
120  kalman3->SetPersistence();
121  kalman3->SetNumIterations(3); // number of fitting iterations (back and forth)
122  kalman3->SetTrackBranchName("TrackPreFitGEM");
123  kalman3->SetOutBranchName("TrackPostFitComplete");
124  fRun->AddTask(kalman3);
125 
126 
127 
128  // ----- Intialise and run --------------------------------------------
130  fRun->Init();
131  fRun->Run(0, nEvents);
132 
133  rtdb->saveOutput();
134  rtdb->print();
135 
136  corr->WriteHistograms("MVDRes.root");
137  corrG->WriteHistograms("GEMRes.root");
138 
139  // ------------------------------------------------------------------------
140 
141  // ----- Finish -------------------------------------------------------
142 
143  timer.Stop();
144  Double_t rtime = timer.RealTime();
145  Double_t ctime = timer.CpuTime();
146  cout << endl << endl;
147  cout << "Macro finished succesfully." << endl;
148  cout << "Output file is " << outFile << endl;
149  cout << "Parameter file is " << parFile << endl;
150  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
151  cout << endl;
152  // ------------------------------------------------------------------------
153 
154 
155 }
PndPidCorrelator * corr
TString outFile
Definition: hit_dirc.C:17
bool SimpleClustering
Definition: reco_template.C:54
KalmanTask * kalman
KalmanTask * kalman2
TString allDigiFile
Definition: hit_muo.C:36
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
Class to access the naming information of the MVD.
PndTpcTrackInitTask * trackInit
PndTpcGEMCorrelatorTask * corrG
TString sysFile
TString inSimFile
Double_t
TString parFile
Definition: hit_dirc.C:14
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
static void Init(Int_t MapVersion)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
PndTpcRiemannTrackingTask * tpcSPR
static PndGeoHandling * Instance()
TString inDigiFile
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
KalmanTask * kalman3
PndGeoHandling * geoH
Int_t iVerbose
Double_t rtime
Definition: hit_dirc.C:113