| 11 |
TrkProcess::TrkProcess(){ |
TrkProcess::TrkProcess(){ |
| 12 |
|
|
| 13 |
idrun = 0; |
idrun = 0; |
| 14 |
dbg_mode.SetNone(); |
// dbg_mode.SetNone(); |
| 15 |
get1 = 0; |
get1 = 0; |
| 16 |
full1 = 0; |
full1 = 0; |
| 17 |
geth = 0; |
geth = 0; |
| 18 |
get2 = 1; |
get2 = 1; |
| 19 |
|
gete = 1; |
| 20 |
|
gete_ncheck = 10; |
| 21 |
|
getn = 1; |
| 22 |
|
extAlgID = 202; |
| 23 |
standalone = false; |
standalone = false; |
| 24 |
frame2 = "root"; |
frame2 = "root"; |
| 25 |
frame1 = "root"; |
frame1 = "root"; |
| 26 |
frameh = "root"; |
frameh = "root"; |
| 27 |
|
framee = "root"; |
| 28 |
outdir = gSystem->WorkingDirectory(); |
outdir = gSystem->WorkingDirectory(); |
| 29 |
pfolder = "/TrackerFolder"; |
pfolder = "/TrackerFolder"; |
| 30 |
if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; |
if (!frame2.CompareTo("root", TString::kIgnoreCase)) ifroot2 = true; |
| 40 |
file2 = ""; |
file2 = ""; |
| 41 |
|
|
| 42 |
ostatus = 0; |
ostatus = 0; |
| 43 |
|
|
| 44 |
|
npar = 0; |
| 45 |
|
|
| 46 |
|
nskip = 0; |
| 47 |
|
|
| 48 |
|
watch = false; |
| 49 |
|
|
| 50 |
|
// TrkParams::SetTrackingMode(); |
| 51 |
|
// TrkParams::SetPrecisionFactor(); |
| 52 |
|
// TrkParams::SetStepMin(); |
| 53 |
|
TrkParams::SetMiniDefault(); |
| 54 |
|
TrkParams::SetPFA(); |
| 55 |
}; |
}; |
| 56 |
|
|
| 57 |
/** |
/** |
| 64 |
idrun = run; |
idrun = run; |
| 65 |
// DEBUG = false; |
// DEBUG = false; |
| 66 |
// VERBOSE = false; |
// VERBOSE = false; |
| 67 |
dbg_mode.SetWarning(); |
// dbg_mode.SetWarning(); |
| 68 |
get1 = 0; |
get1 = 0; |
| 69 |
full1 = 0; |
full1 = 0; |
| 70 |
get2 = 1; |
get2 = 1; |
| 71 |
geth = 0; |
geth = 0; |
| 72 |
|
gete = 1; |
| 73 |
|
gete_ncheck = 10; |
| 74 |
|
getn = 1; |
| 75 |
|
extAlgID = 202; |
| 76 |
standalone = false; |
standalone = false; |
| 77 |
frame2 = "root"; |
frame2 = "root"; |
| 78 |
frame1 = "root"; |
frame1 = "root"; |
| 79 |
frameh = "root"; |
frameh = "root"; |
| 80 |
|
framee = "root"; |
| 81 |
pfolder = "/TrackerFolder"; |
pfolder = "/TrackerFolder"; |
| 82 |
file1 = ""; |
file1 = ""; |
| 83 |
if(f2->IsOpen()){ |
if(f2->IsOpen()){ |
| 101 |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
| 102 |
|
|
| 103 |
ostatus = 0; |
ostatus = 0; |
| 104 |
|
|
| 105 |
|
npar=0; |
| 106 |
|
|
| 107 |
|
nskip = 0; |
| 108 |
|
|
| 109 |
|
watch = false; |
| 110 |
|
|
| 111 |
|
// TrkParams::SetTrackingMode(); |
| 112 |
|
// TrkParams::SetPrecisionFactor(); |
| 113 |
|
// TrkParams::SetStepMin(); |
| 114 |
|
TrkParams::SetMiniDefault(); |
| 115 |
|
TrkParams::SetPFA(); |
| 116 |
|
|
| 117 |
}; |
}; |
| 118 |
/** |
/** |
| 119 |
* Set processing variables according to input custom parameters |
* Set processing variables according to input custom parameters |
| 120 |
*/ |
*/ |
| 121 |
void TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){ |
int TrkProcess::HandleCustomPar(int ncustom, char *vcustom[]){ |
| 122 |
|
|
| 123 |
for (int i=0; i< ncustom; i++){ |
for (int i=0; i< ncustom; i++){ |
| 124 |
|
|
| 125 |
|
cout << "Handling Parameter " << i+1 << " of " << ncustom << ": " << vcustom[i] << endl; |
| 126 |
|
|
| 127 |
|
// -----------------------------------------------------// |
| 128 |
|
if (!strcmp(vcustom[i], "--simu")){ |
| 129 |
|
cout << "Setting DarthVader to use Simulated Data\n"; |
| 130 |
|
TrkParams::SetSimuFlag(kTRUE); |
| 131 |
|
continue; |
| 132 |
|
} |
| 133 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 134 |
if (!strcmp(vcustom[i], "-processFolder")){ |
if (!strcmp(vcustom[i], "-processFolder")){ |
| 135 |
if (++i >= ncustom) throw -3; |
if (++i >= ncustom) throw -3; |
| 154 |
continue; |
continue; |
| 155 |
} |
} |
| 156 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 157 |
if (!strcmp(vcustom[i], "--dontget2") ||!strcmp(vcustom[i], "--dontget-level2") ){ |
// if (!strcmp(vcustom[i], "--dontget2") ||!strcmp(vcustom[i], "--dontget-level2") ){ |
| 158 |
get2 = 0; |
// get2 = 0; |
| 159 |
|
// gete = 0; |
| 160 |
|
// getn = 0; |
| 161 |
|
// continue; |
| 162 |
|
// } |
| 163 |
|
// -----------------------------------------------------// |
| 164 |
|
if (!strcmp(vcustom[i], "--dontgete") ||!strcmp(vcustom[i], "--dontget-exttrack") ){ |
| 165 |
|
gete = 0; |
| 166 |
|
continue; |
| 167 |
|
} |
| 168 |
|
// -----------------------------------------------------// |
| 169 |
|
if (!strcmp(vcustom[i], "-extalg")){ |
| 170 |
|
if (++i >= ncustom) throw -3; |
| 171 |
|
gete = 1; |
| 172 |
|
get2 = 1; |
| 173 |
|
extAlgID = atoi(vcustom[i]); |
| 174 |
|
continue; |
| 175 |
|
} |
| 176 |
|
// -----------------------------------------------------// |
| 177 |
|
if (!strcmp(vcustom[i], "-extalg-check")){ |
| 178 |
|
if (++i >= ncustom) throw -3; |
| 179 |
|
gete_ncheck = atoi(vcustom[i]); |
| 180 |
|
continue; |
| 181 |
|
} |
| 182 |
|
// -----------------------------------------------------// |
| 183 |
|
if (!strcmp(vcustom[i], "--dontgetn") ||!strcmp(vcustom[i], "--dontget-nuclei") ){ |
| 184 |
|
getn = 0; |
| 185 |
continue; |
continue; |
| 186 |
} |
} |
| 187 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 196 |
file1 = vcustom[i]; |
file1 = vcustom[i]; |
| 197 |
continue; |
continue; |
| 198 |
} |
} |
| 199 |
|
// // -----------------------------------------------------// |
| 200 |
|
// if (!strcmp(vcustom[i], "-frame1")){ |
| 201 |
|
// if (++i >= ncustom)throw -3; |
| 202 |
|
// get1 = 1; |
| 203 |
|
// frame1 = vcustom[i]; |
| 204 |
|
// continue; |
| 205 |
|
// } |
| 206 |
|
// // -----------------------------------------------------// |
| 207 |
|
// if (!strcmp(vcustom[i], "-frame2")){ |
| 208 |
|
// if (++i >= ncustom)throw -3; |
| 209 |
|
// get2 = 1; |
| 210 |
|
// frame2 = vcustom[i]; |
| 211 |
|
// continue; |
| 212 |
|
// } |
| 213 |
|
// // -----------------------------------------------------// |
| 214 |
|
// if (!strcmp(vcustom[i], "-framee")){ |
| 215 |
|
// if (++i >= ncustom)throw -3; |
| 216 |
|
// gete = 1; |
| 217 |
|
// framee = vcustom[i]; |
| 218 |
|
// continue; |
| 219 |
|
// } |
| 220 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 221 |
if (!strcmp(vcustom[i], "-frame1")){ |
if (!strcmp(vcustom[i], "-pfa")){ |
| 222 |
if (++i >= ncustom)throw -3; |
if (++i >= ncustom)throw -3; |
| 223 |
get1 = 1; |
TrkParams::SetPFA(atoi(vcustom[i])); |
| 224 |
frame1 = vcustom[i]; |
continue; |
| 225 |
|
} |
| 226 |
|
// -----------------------------------------------------// |
| 227 |
|
if (!strcmp(vcustom[i], "-skip")){ |
| 228 |
|
if (++i >= ncustom)throw -3; |
| 229 |
|
nskip = atoi(vcustom[i]); |
| 230 |
continue; |
continue; |
| 231 |
} |
} |
| 232 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 233 |
if (!strcmp(vcustom[i], "-frame2")){ |
if ( atoi(vcustom[i]) < 0){ |
| 234 |
if (++i >= ncustom)throw -3; |
if (++i >= ncustom)throw -3; |
| 235 |
get2 = 1; |
partype[npar]=-1*atoi(vcustom[i-1]); |
| 236 |
frame2 = vcustom[i]; |
parpath[npar]=vcustom[i]; |
| 237 |
|
npar++; |
| 238 |
continue; |
continue; |
| 239 |
} |
} |
| 240 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 241 |
if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){ |
if (!strcmp(vcustom[i], "--verbose") || !strcmp(vcustom[i], "-v")){ |
| 242 |
// VERBOSE = true; |
TrkParams::SetVerboseMode(); |
| 243 |
this->SetVerboseMode(); |
continue; |
| 244 |
|
} |
| 245 |
|
// -----------------------------------------------------// |
| 246 |
|
if (!strcmp(vcustom[i], "--warning") || !strcmp(vcustom[i], "-w")){ |
| 247 |
|
TrkParams::SetWarningMode(); |
| 248 |
|
continue; |
| 249 |
|
} |
| 250 |
|
// -----------------------------------------------------// |
| 251 |
|
if (!strcmp(vcustom[i], "--help") || !strcmp(vcustom[i], "-h")){ |
| 252 |
|
PrintHelp(); |
| 253 |
|
return 1; |
| 254 |
|
} |
| 255 |
|
// -----------------------------------------------------// |
| 256 |
|
if (!strcmp(vcustom[i], "--watch") ){ |
| 257 |
|
watch = true; |
| 258 |
continue; |
continue; |
| 259 |
} |
} |
| 260 |
// -----------------------------------------------------// |
// -----------------------------------------------------// |
| 261 |
else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){ |
else if (!strcmp(vcustom[i], "--debug") || !strcmp(vcustom[i], "-d")){ |
| 262 |
// DEBUG = true; |
TrkParams::SetDebugMode(); |
|
this->SetDebugMode(); |
|
| 263 |
continue; |
continue; |
| 264 |
}; |
}; |
| 265 |
} |
} |
| 276 |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
else if (!frameh.CompareTo("hbook", TString::kIgnoreCase)) ifrooth =false; |
| 277 |
else throw -201; |
else throw -201; |
| 278 |
|
|
| 279 |
|
if (!framee.CompareTo("root", TString::kIgnoreCase)) ifroote = true; |
| 280 |
|
else if (!framee.CompareTo("hbook", TString::kIgnoreCase)) ifroote =false; |
| 281 |
|
else throw -201; |
| 282 |
|
|
| 283 |
if(get1 && !get2)full1=true; |
if(get1 && !get2)full1=true; |
| 284 |
|
|
| 285 |
ostatus = 0; |
ostatus = 0; |
| 286 |
|
|
| 287 |
|
return 0; |
| 288 |
|
|
| 289 |
}; |
}; |
| 290 |
/** |
/** |
| 291 |
* \brief Process Level0 event |
* \brief Process Level0 event |
| 296 |
void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){ |
void TrkProcess::ProcessEvent(TrkLevel0 *l0_event){ |
| 297 |
|
|
| 298 |
// fill Level0 common from Level0 object |
// fill Level0 common from Level0 object |
| 299 |
l0_event->GetCommonVar(&level0event_); |
l0_event->GetLevel0Struct(); |
|
|
|
| 300 |
// process the event Level0->Level1->Level2 |
// process the event Level0->Level1->Level2 |
| 301 |
int F77err = 0; |
int F77err = 0; |
| 302 |
// |
// |
| 303 |
reductionflight_(&F77err); |
reductionflight_(&F77err); |
| 304 |
if(F77err < 0)throw F77err; |
if(F77err < 0)throw F77err; |
| 305 |
// |
// |
| 306 |
if(get2) analysisflight_(); |
if(get2) analysisflight_(); |
| 307 |
// |
// |
| 308 |
|
|
| 309 |
ostatus = F77err; |
ostatus = F77err; |
| 310 |
|
|
| 311 |
}; |
}; |
| 312 |
|
|
| 313 |
void TrkProcess::Dump(){ |
void TrkProcess::Dump(){ |
| 314 |
|
cout << endl; |
| 315 |
|
cout << " |-------------------------------------| "<<endl; |
| 316 |
|
cout << " tracker-processing input-parameters "<< endl; |
| 317 |
|
cout << " |-------------------------------------| "<<endl; |
| 318 |
|
cout << " idRun " << idrun << endl; |
| 319 |
|
cout << " (skip " << nskip <<" events)"<< endl; |
| 320 |
|
cout << " get level1 " << get1 << endl; |
| 321 |
|
cout << " full level1 " << full1 << endl; |
| 322 |
|
cout << " get level2 " << get2 << endl; |
| 323 |
|
cout << " get hough " << geth << endl; |
| 324 |
|
cout << " get ext.tracking " << gete << endl; |
| 325 |
|
if(gete) |
| 326 |
|
cout << " ext.tracking alg " << extAlgID << endl; |
| 327 |
|
cout << " get nuclei " << getn << endl; |
| 328 |
|
// cout << " frame1 " << frame1 << endl; |
| 329 |
|
// cout << " frame2 " << frame2 << endl; |
| 330 |
|
// cout << " frameh " << frame2 << endl; |
| 331 |
|
// cout << " file1 " << file1 << endl; |
| 332 |
|
cout << " output file " << file2 << endl; |
| 333 |
|
// cout << " outdir " << outdir << endl; |
| 334 |
|
// cout << " process folder " << pfolder << endl; |
| 335 |
|
// cout << " standalone mode " << standalone << endl; |
| 336 |
|
for(int i=0; i<npar; i++) |
| 337 |
|
cout << " force loading parameters of type "<<partype[i]<<" from <--- "<<parpath[i]<<endl; |
| 338 |
|
cout<<endl; |
| 339 |
|
|
| 340 |
|
// cout << " debug mode warning " << dbg_mode.warning << endl; |
| 341 |
|
// cout << " debug mode verbose " << dbg_mode.verbose << endl; |
| 342 |
|
// cout << " debug mode debug " << dbg_mode.debug << endl << endl; |
| 343 |
|
|
| 344 |
|
} |
| 345 |
|
|
| 346 |
cout <<endl<< "Tracker process parameters: "<< endl; |
void TrkProcess::PrintHelp(){ |
| 347 |
cout << " idRun " << idrun << endl; |
|
| 348 |
cout << " get level1 " << get1 << endl; |
printf( "\n\n +TRK [ options ] \n \n"); |
| 349 |
cout << " full level1 " << full1 << endl; |
// printf( "\n --version : Print tracker software version and exit "); |
| 350 |
cout << " get level2 " << get2 << endl; |
printf( "Options:"); |
| 351 |
cout << " get hough " << geth << endl; |
printf( "\n --help, -h : Print this help and exit "); |
| 352 |
cout << " frame1 " << frame1 << endl; |
// printf( "\n -idRun RUN : ID number of the run to be processed (for reprocessing RUN=0) \n"); |
| 353 |
cout << " frame2 " << frame2 << endl; |
// printf( "\n -outDir OUTDIR : Path where to put the LEVEL2 output [default ./ ] "); |
| 354 |
cout << " frameh " << frame2 << endl; |
// printf( "\n -processFolder DIR : Directory (relative to OUTDIR) for other output files [default TrackerFolder/ ] "); |
| 355 |
cout << " file1 " << file1 << endl; |
// printf( "\n -processFile FILE : Name of the LEVEL2 output file [default RUN.Level2.root]"); |
| 356 |
cout << " file2 " << file2 << endl; |
// printf( "\n -processFile1 FILE : Name of the LEVEL1 output file [default RUN.Level1.rz]"); |
| 357 |
cout << " outdir " << outdir << endl; |
// printf( "\n -frame1 FRAME : type of output for LEVEL1, root/hbook [default hbook ] "); |
| 358 |
cout << " process folder " << pfolder << endl; |
// printf( "\n -frame2 FRAME : type of output for LEVEL2, root/hbook [default root ] "); |
| 359 |
cout << " standalone mode " << standalone << endl; |
printf( "\n --get1, --get-level1 : get LEVEL1 output (store only cluster associated to tracks) [default (no LEVEL1 output) ] "); |
| 360 |
cout << " debug mode warning " << dbg_mode.warning << endl; |
printf( "\n --get1-full, --get-level1-full : get LEVEL1 output (store all clusters) [default (no LEVEL1 output) ] "); |
| 361 |
cout << " debug mode verbose " << dbg_mode.verbose << endl; |
printf( "\n --dontget2, --dontget-level2 : do not get LEVEL2 output [default (get LEVEL2 output)]"); |
| 362 |
cout << " debug mode debug " << dbg_mode.debug << endl << endl; |
printf( "\n --dontgete, --dontget-exttrack : do not get ext.tracking output [default (ext.algorythm 202)]"); |
| 363 |
|
printf( "\n --dontgetn, --dontget-nuclei : do not get nuclei cleaned tracks [default (get nuclei output)]"); |
| 364 |
|
printf( "\n --extalg ID : apply ext.tracking algorythm n.ID [default (ID=202) ] "); |
| 365 |
|
printf( "\n --geth,, --get-hough : get Hough-transform output [default (no Hough-t. output) ] "); |
| 366 |
|
printf( "\n -pfa PFAID : type of output for LEVEL2, root/hbook [default 14 (COG4) ] "); |
| 367 |
|
printf( "\n -N PATH : load parameter of type N=1,2... from PATH [default (from DB) ] "); |
| 368 |
|
printf( "\n --verbose, -v : verbose mode "); |
| 369 |
|
printf( "\n --debug, -d : debug mode "); |
| 370 |
|
printf( "\n --warning, -w : warning mode "); |
| 371 |
|
printf( "\n -skip NEV : skip first NEV events from each run "); |
| 372 |
|
// printf( "\n --standalone, -s : standalone mode (without RunInfo) ... but it might not work \n"); |
| 373 |
|
// printf( "\n -host HOST : Name for the host [default mysql://localhost/pamelaprod ]"); |
| 374 |
|
// printf( "\n -user USER : Username for the DB [default anonymous] "); |
| 375 |
|
// printf( "\n -psw PSW : Password for the DB [default (none)]\n \n \n"); |
| 376 |
|
|
| 377 |
|
|
| 378 |
} |
} |