FairRoot/PandaRoot
reco_complete_runs.C
Go to the documentation of this file.
1 //void reco_complete()
2 //{
3 void reco_complete_runs(Int_t nRun = 0)
4 {
5  //-----User Settings:-----------------------------------------------
6  TString RunsListFile = "runs.txt";
7  std::ifstream runsFileInput(RunsListFile.Data());
8  char str[1000];
9  bool runexists = false;
10  int nrun, nrunmax = -1;
11  int pid, mult;
12  Float_t pmin, pmax;
13  Float_t tmin, tmax;
14  Float_t fmin, fmax;
15  Int_t nEvents;
16  std::string strg;
17  runsFileInput >> strg;
18  while(!runsFileInput.eof()) {
19  if (strg[0]!='#') {
20  sscanf(strg.c_str(),"%d",&nrun);
21  if (nrun==nRun) {
22  runexists = true;
23  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&pid);
24  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&nEvents);
25  runsFileInput >> strg; sscanf(strg.c_str(),"%d",&mult);
26  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&pmin);
27  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&pmax);
28  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&tmin);
29  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&tmax);
30  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&fmin);
31  runsFileInput >> strg; sscanf(strg.c_str(),"%f",&fmax);
32  }
33  else {
34  for(size_t iw=0;iw<9;iw++) runsFileInput >> strg;
35  }
36  nrunmax = nrun>nrunmax ? nrun : nrunmax;
37  }
38  runsFileInput >> strg;
39  }
40  runsFileInput.close();
41 
42  if (!runexists) {
43  std::cout << "Run number " << nRun << " is not defined!" << std::endl;
44  exit(0);
45  }
46 
47  std::cout << "run = " << nRun << " " << pid << " " << nEvents << " " << mult << " " << pmin << " "
48  << pmax << " " << tmin << " " << tmax << " " << fmin << " " << fmax << std::endl;
49 
50  Double_t mom = pmax;
51 
52  // Macro created 20/09/2006 by S.Spataro
53  // It loads a digi file and performs tracking
54 
55  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
56  Int_t iVerbose = 0; // just forget about it, for the moment
57 
58  // Number of events to process
59  Int_t nEvents = 0; // if 0 all the vents will be processed
60 
61  // Parameter file
62  //TString parFile = "simparams.root"; // at the moment you do not need it
63  TString parFile = Form("simparams_v%d_r%d.root",0,nRun);
64 
65  // Digitisation file (ascii)
66  TString digiFile = "all.par";
67 
68  // Output file
69  //TString outFile = "reco_complete.root";
70  TString outFile = Form("reco_complete_v%d_r%d.root",0,nRun);
71  TString sim_File = Form("sim_complete_v%d_r%d.root",0,nRun);
72  TString digi_File = Form("digi_complete_v%d_r%d.root",0,nRun);
73 
74  // ----- Timer --------------------------------------------------------
75  TStopwatch timer;
76  // ------------------------------------------------------------------------
77 
78  // ----- Reconstruction run -------------------------------------------
79  FairRunAna *fRun= new FairRunAna();
80  //fRun->SetInputFile("sim_complete.root");
81  //fRun->AddFriend("digi_complete.root");
82  fRun->SetInputFile(sim_File);
83  fRun->AddFriend(digi_File);
84  fRun->SetOutputFile(outFile);
85  fRun->SetGenerateRunInfo(kFALSE);
86  fRun->SetUseFairLinks(kTRUE);
87  FairGeane *Geane = new FairGeane();
88  fRun->AddTask(Geane);
89 
90  // ----- Parameter database --------------------------------------------
91  TString emcDigiFile = gSystem->Getenv("VMCWORKDIR");
92  emcDigiFile += "/macro/params/";
93  emcDigiFile += digiFile;
94 
95  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
96  FairParRootFileIo* parInput1 = new FairParRootFileIo();
97  parInput1->open(parFile.Data());
98 
99  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
100  parIo1->open(emcDigiFile.Data(),"in");
101 
102  rtdb->setFirstInput(parInput1);
103  rtdb->setSecondInput(parIo1);
104 
105  // ------------------------------------------------------------------------
106  // use the constructor with input :
107  // printout flag (int) , plotting flag (bool), MC comparison flag (bool), SciTil.
108  PndTrkTracking2* tracking = new PndTrkTracking2(0,false,false,true);
109  tracking->SetInputBranchName("STTHit","MVDHitsPixel","MVDHitsStrip");
110  // tracking->SetInputBranchName("STTHitMix","MVDHitsPixelMix","MVDHitsStripMix");
111  // don't do the Pattern Recognition second part, starting from the Mvd;
112  tracking->NoMvdAloneTracking();
113  // do Cleanup only when there is Mixing;
114  // tracking->Cleanup();
115  tracking->SetPersistence(kFALSE);
116  fRun->AddTask(tracking);
117 
119  //SttMvdGemTracking->SetPdgFromMC();
120  SttMvdGemTracking->SetPersistence(kFALSE);
121  fRun->AddTask(SttMvdGemTracking);
122 
123  PndMCTrackAssociator* trackMC = new PndMCTrackAssociator();
124  trackMC->SetTrackInBranchName("SttMvdGemTrack");
125  trackMC->SetTrackOutBranchName("SttMvdGemTrackID");
126  trackMC->SetPersistence(kFALSE);
127  fRun->AddTask(trackMC);
128 
130  recoKalman->SetTrackInBranchName("SttMvdGemTrack");
131  recoKalman->SetTrackInIDBranchName("SttMvdGemTrackID");
132  recoKalman->SetTrackOutBranchName("SttMvdGemGenTrack");
133  recoKalman->SetBusyCut(50); // CHECK to be tuned
134  //recoKalman->SetIdealHyp(kTRUE);
135  //recoKalman->SetNumIterations(3);
136  recoKalman->SetTrackRep(0); // 0 Geane (default), 1 RK
137  //recoKalman->SetPropagateToIP(kFALSE);
138  fRun->AddTask(recoKalman);
139 
140  PndMCTrackAssociator* trackMC2 = new PndMCTrackAssociator();
141  trackMC2->SetTrackInBranchName("SttMvdGemGenTrack");
142  trackMC2->SetTrackOutBranchName("SttMvdGemGenTrackID");
143  fRun->AddTask(trackMC2);
144 
146  trackFts->SetRelativeMomentumSmearing(0.05);
147  trackFts->SetVertexSmearing(0.05, 0.05, 0.05);
148  trackFts->SetTrackingEfficiency(1.);
149  trackFts->SetTrackOutput("FtsIdealTrack");
150  trackFts->SetPersistence(kFALSE);
151  fRun->AddTask(trackFts);
152 
153  PndMCTrackAssociator* trackMCfwd = new PndMCTrackAssociator();
154  trackMCfwd->SetTrackInBranchName("FtsIdealTrack");
155  trackMCfwd->SetTrackOutBranchName("FtsIdealTrackID");
156  fRun->AddTask(trackMCfwd);
157 
159  recoKalmanFwd->SetTrackInBranchName("FtsIdealTrack");
160  //recoKalmanFwd->SetTrackInIDBranchName("FtsIdealTrackID");
161  recoKalmanFwd->SetTrackOutBranchName("FtsIdealGenTrack");
162  recoKalmanFwd->SetBusyCut(50); // CHECK to be tuned
163  //recoKalmanFwd->SetIdealHyp(kTRUE);
164  //recoKalmanFwd->SetNumIterations(3);
165  recoKalmanFwd->SetTrackRep(0); // 0 Geane (default), 1 RK
166  //recoKalmanFwd->SetPropagateToIP(kFALSE);
167  fRun->AddTask(recoKalmanFwd);
168 
169  PndMCTrackAssociator* trackMC3 = new PndMCTrackAssociator();
170  trackMC3->SetTrackInBranchName("FtsIdealGenTrack");
171  trackMC3->SetTrackOutBranchName("FtsIdealGenTrackID");
172  fRun->AddTask(trackMC3);
173 
174  // ----- Intialise and run --------------------------------------------
176  cout << "fRun->Init()" << endl;
177  fRun->Init();
178 
179  timer.Start();
180  fRun->Run(0,nEvents);
181  // ------------------------------------------------------------------------
182 
183 
184  // ----- Finish -------------------------------------------------------
185  timer.Stop();
186  Double_t rtime = timer.RealTime();
187  Double_t ctime = timer.CpuTime();
188  cout << endl << endl;
189  cout << "Macro finished successfully." << endl;
190  cout << "Output file is " << outFile << endl;
191  cout << "Parameter file is " << parFile << endl;
192  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
193  cout << endl;
194  // ------------------------------------------------------------------------
195  cout << " Test passed" << endl;
196  cout << " All ok " << endl;
197  exit(0);
198 }
exit(0)
TString outFile
Definition: hit_dirc.C:17
void SetTrackOutput(TString name="FTSTrkIdeal")
void SetTrackingEfficiency(Double_t eff=1.)
int pid()
TString digiFile
Definition: bump_emc.C:20
Double_t mom
Definition: plot_dirc.C:14
TString emcDigiFile
Definition: bump_emc.C:45
void SetTrackOutBranchName(const TString &name)
FairGeane * Geane
FairRunAna * fRun
Definition: hit_dirc.C:58
PndMCTrackAssociator * trackMC2
Double_t
TString parFile
Definition: hit_dirc.C:14
void SetVertexSmearing(Double_t sigmax=-1., Double_t sigmay=-1., Double_t sigmaz=-1.)
PndRecoKalmanTask * recoKalmanFwd
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
void SetPersistence(Bool_t persistence)
static void Init(Int_t MapVersion)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void SetPersistence(Bool_t persistence)
PndMCTrackAssociator * trackMC3
PndTrkTracking * tracking
PndFtsTrackerIdeal * trackFts
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
PndMCTrackAssociator * trackMC
Double_t ctime
Definition: hit_dirc.C:114
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
void SetInputBranchName(const char *string1, const char *string2, const char *string3)
void SetTrackRep(Short_t num)
void NoMvdAloneTracking()
void SetBusyCut(Int_t b)
void SetTrackInBranchName(const TString &name)
PndSttMvdGemTracking * SttMvdGemTracking
void reco_complete_runs(Int_t nRun=0)
Int_t iVerbose
PndRecoKalmanTask * recoKalman
Double_t rtime
Definition: hit_dirc.C:113
Double_t mult
void SetRelativeMomentumSmearing(Double_t dpop=-1.)