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