11 |
TrkProcess::TrkProcess(){ |
TrkProcess::TrkProcess(){ |
12 |
|
|
13 |
idrun = 0; |
idrun = 0; |
14 |
dbg_mode.SetNone(); |
// dbg_mode.SetNone(); |
15 |
get1 = 0; |
get1 = 0; |
16 |
geth = 0; |
full1 = 0; |
17 |
get2 = 1; |
geth = 0; |
18 |
|
get2 = 1; |
19 |
standalone = false; |
standalone = false; |
20 |
frame2 = "root"; |
frame2 = "root"; |
21 |
frame1 = "root"; |
frame1 = "root"; |
35 |
file2 = ""; |
file2 = ""; |
36 |
|
|
37 |
ostatus = 0; |
ostatus = 0; |
38 |
|
|
39 |
|
npar=0; |
40 |
|
|
41 |
|
// TrkParams::SetTrackingMode(); |
42 |
|
// TrkParams::SetPrecisionFactor(); |
43 |
|
// TrkParams::SetStepMin(); |
44 |
|
TrkParams::SetMiniDefault(); |
45 |
|
TrkParams::SetPFA(); |
46 |
}; |
}; |
47 |
|
|
48 |
/** |
/** |
55 |
idrun = run; |
idrun = run; |
56 |
// DEBUG = false; |
// DEBUG = false; |
57 |
// VERBOSE = false; |
// VERBOSE = false; |
58 |
dbg_mode.SetWarning(); |
// dbg_mode.SetWarning(); |
59 |
get1 = 0; |
get1 = 0; |
60 |
|
full1 = 0; |
61 |
get2 = 1; |
get2 = 1; |
62 |
geth = 0; |
geth = 0; |
63 |
standalone = false; |
standalone = false; |
87 |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
88 |
|
|
89 |
ostatus = 0; |
ostatus = 0; |
90 |
|
|
91 |
|
npar=0; |
92 |
|
|
93 |
|
// TrkParams::SetTrackingMode(); |
94 |
|
// TrkParams::SetPrecisionFactor(); |
95 |
|
// TrkParams::SetStepMin(); |
96 |
|
TrkParams::SetMiniDefault(); |
97 |
|
TrkParams::SetPFA(); |
98 |
|
|
99 |
}; |
}; |
100 |
/** |
/** |
101 |
* Set processing variables according to input custom parameters |
* Set processing variables according to input custom parameters |
102 |
*/ |
*/ |
103 |
void TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){ |
int TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){ |
104 |
|
|
105 |
for (int i=0; i< ncustom; i++){ |
for (int i=0; i< ncustom; i++){ |
106 |
|
|
112 |
} |
} |
113 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
114 |
if (!strcmp(vcustom[i], "--get1") || !strcmp(vcustom[i], "--get-level1") ){ |
if (!strcmp(vcustom[i], "--get1") || !strcmp(vcustom[i], "--get-level1") ){ |
115 |
get1 = 1; |
get1 = 1; |
116 |
|
full1 = 0; |
117 |
|
continue; |
118 |
|
} |
119 |
|
// -----------------------------------------------------// |
120 |
|
if (!strcmp(vcustom[i], "--get1-full") || !strcmp(vcustom[i], "--get-level1-full") ){ |
121 |
|
get1 = 1; |
122 |
|
full1 = 1; |
123 |
continue; |
continue; |
124 |
} |
} |
125 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
159 |
continue; |
continue; |
160 |
} |
} |
161 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
162 |
|
if (!strcmp(vcustom[i], "-pfa")){ |
163 |
|
if (++i >= ncustom)throw -3; |
164 |
|
TrkParams::SetPFA(atoi(vcustom[i])); |
165 |
|
continue; |
166 |
|
} |
167 |
|
// -----------------------------------------------------// |
168 |
|
if ( atoi(vcustom[i]) < 0){ |
169 |
|
if (++i >= ncustom)throw -3; |
170 |
|
partype[npar]=-1*atoi(vcustom[i-1]); |
171 |
|
parpath[npar]=vcustom[i]; |
172 |
|
npar++; |
173 |
|
continue; |
174 |
|
} |
175 |
|
// -----------------------------------------------------// |
176 |
if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){ |
if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){ |
177 |
// VERBOSE = true; |
TrkParams::SetVerboseMode(); |
178 |
this->SetVerboseMode(); |
continue; |
179 |
|
} |
180 |
|
// -----------------------------------------------------// |
181 |
|
if (!strcmp(vcustom[i], "--warning") || !strcmp(vcustom[i], "-w")){ |
182 |
|
TrkParams::SetWarningMode(); |
183 |
continue; |
continue; |
184 |
} |
} |
185 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
186 |
|
if (!strcmp(vcustom[i], "--help") || !strcmp(vcustom[i], "-h")){ |
187 |
|
PrintHelp(); |
188 |
|
return 1; |
189 |
|
} |
190 |
|
// -----------------------------------------------------// |
191 |
else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){ |
else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){ |
192 |
// DEBUG = true; |
TrkParams::SetDebugMode(); |
|
this->SetDebugMode(); |
|
193 |
continue; |
continue; |
194 |
}; |
}; |
195 |
} |
} |
206 |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
207 |
else throw -201; |
else throw -201; |
208 |
|
|
209 |
|
if(get1 && !get2)full1=true; |
210 |
|
|
211 |
ostatus = 0; |
ostatus = 0; |
212 |
|
|
213 |
|
return 0; |
214 |
|
|
215 |
}; |
}; |
216 |
/** |
/** |
217 |
* \brief Process Level0 event |
* \brief Process Level0 event |
222 |
void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){ |
void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){ |
223 |
|
|
224 |
// fill Level0 common from Level0 object |
// fill Level0 common from Level0 object |
225 |
l0_event->GetCommonVar(&level0event_); |
l0_event->GetLevel0Struct(); |
|
|
|
226 |
// process the event Level0->Level1->Level2 |
// process the event Level0->Level1->Level2 |
227 |
int F77err = 0; |
int F77err = 0; |
228 |
// |
// |
229 |
reductionflight_(&F77err); |
reductionflight_(&F77err); |
230 |
if(F77err < 0)throw F77err; |
if(F77err < 0)throw F77err; |
|
// else if(F77err > 0 && WarningMode())cout<<" WARNING ("<<F77err<<") - TrkCore - Level1 reduction (CN computation failure, ...)"<<endl; |
|
231 |
// |
// |
232 |
if(get2) analysisflight_(); |
if(get2) analysisflight_(); |
|
// if(F77err < 0)throw F77err; |
|
|
// else if(F77err > 0 && WarningMode())cout<<" WARNING ("<<F77err<<") - TrkCore - @ Level2 reduction "<<endl; |
|
233 |
// |
// |
234 |
ostatus = F77err; |
ostatus = F77err; |
235 |
|
|
236 |
}; |
}; |
237 |
|
|
238 |
void TrkProcess::Dump(){ |
void TrkProcess::Dump(){ |
239 |
|
cout << endl; |
240 |
|
cout << " |-------------------------------------| "<<endl; |
241 |
|
cout << " tracker-processing input-parameters "<< endl; |
242 |
|
cout << " |-------------------------------------| "<<endl; |
243 |
|
cout << " idRun " << idrun << endl; |
244 |
|
cout << " get level1 " << get1 << endl; |
245 |
|
cout << " full level1 " << full1 << endl; |
246 |
|
cout << " get level2 " << get2 << endl; |
247 |
|
cout << " get hough " << geth << endl; |
248 |
|
// cout << " frame1 " << frame1 << endl; |
249 |
|
// cout << " frame2 " << frame2 << endl; |
250 |
|
// cout << " frameh " << frame2 << endl; |
251 |
|
// cout << " file1 " << file1 << endl; |
252 |
|
cout << " output file " << file2 << endl; |
253 |
|
// cout << " outdir " << outdir << endl; |
254 |
|
// cout << " process folder " << pfolder << endl; |
255 |
|
// cout << " standalone mode " << standalone << endl; |
256 |
|
for(int i=0; i<npar; i++) |
257 |
|
cout << " force loading parameters of type "<<partype[i]<<" from <--- "<<parpath[i]<<endl; |
258 |
|
cout<<endl; |
259 |
|
|
260 |
|
// cout << " debug mode warning " << dbg_mode.warning << endl; |
261 |
|
// cout << " debug mode verbose " << dbg_mode.verbose << endl; |
262 |
|
// cout << " debug mode debug " << dbg_mode.debug << endl << endl; |
263 |
|
|
264 |
|
} |
265 |
|
|
266 |
|
void TrkProcess::PrintHelp(){ |
267 |
|
|
268 |
cout <<endl<< "Tracker process parameters: "<< endl; |
printf( "\n\n +TRK [ options ] \n \n"); |
269 |
cout << " idRun " << idrun << endl; |
// printf( "\n --version : Print tracker software version and exit "); |
270 |
cout << " get level1 " << get1 << endl; |
printf( "Options:"); |
271 |
cout << " get level2 " << get2 << endl; |
printf( "\n --help, -h : Print this help and exit "); |
272 |
cout << " get hough " << geth << endl; |
// printf( "\n -idRun RUN : ID number of the run to be processed (for reprocessing RUN=0) \n"); |
273 |
cout << " frame1 " << frame1 << endl; |
// printf( "\n -outDir OUTDIR : Path where to put the LEVEL2 output [default ./ ] "); |
274 |
cout << " frame2 " << frame2 << endl; |
// printf( "\n -processFolder DIR : Directory (relative to OUTDIR) for other output files [default TrackerFolder/ ] "); |
275 |
cout << " frameh " << frame2 << endl; |
// printf( "\n -processFile FILE : Name of the LEVEL2 output file [default RUN.Level2.root]"); |
276 |
cout << " file1 " << file1 << endl; |
// printf( "\n -processFile1 FILE : Name of the LEVEL1 output file [default RUN.Level1.rz]"); |
277 |
cout << " file2 " << file2 << endl; |
// printf( "\n -frame1 FRAME : type of output for LEVEL1, root/hbook [default hbook ] "); |
278 |
cout << " outdir " << outdir << endl; |
// printf( "\n -frame2 FRAME : type of output for LEVEL2, root/hbook [default root ] "); |
279 |
cout << " process folder " << pfolder << endl; |
printf( "\n --get1, --get-level1 : get LEVEL1 output (store only cluster associated to tracks) [default (no LEVEL1 output) ] "); |
280 |
cout << " standalone mode " << standalone << endl; |
printf( "\n --get1-full, --get-level1-full : get LEVEL1 output (store all clusters) [default (no LEVEL1 output) ] "); |
281 |
cout << " debug mode warning " << dbg_mode.warning << endl; |
printf( "\n --dontget2, --dontget-level2 : do not get LEVEL2 output [default (get LEVEL2 output)]"); |
282 |
cout << " debug mode verbose " << dbg_mode.verbose << endl; |
printf( "\n --geth,, --get-hough : get Hough-transform output [default (no Hough-t. output) ] "); |
283 |
cout << " debug mode debug " << dbg_mode.debug << endl << endl; |
printf( "\n -pfa PFAID : type of output for LEVEL2, root/hbook [default 14 (COG4) ] "); |
284 |
|
printf( "\n -N PATH : load parameter of type N=1,2... from PATH [default (from DB) ] "); |
285 |
|
printf( "\n --verbose, -v : verbose mode "); |
286 |
|
printf( "\n --debug, -d : debug mode "); |
287 |
|
printf( "\n --warning, -w : warning mode "); |
288 |
|
// printf( "\n --standalone, -s : standalone mode (without RunInfo) ... but it might not work \n"); |
289 |
|
// printf( "\n -host HOST : Name for the host [default mysql://localhost/pamelaprod ]"); |
290 |
|
// printf( "\n -user USER : Username for the DB [default anonymous] "); |
291 |
|
// printf( "\n -psw PSW : Password for the DB [default (none)]\n \n \n"); |
292 |
|
|
293 |
|
|
294 |
} |
} |