247 std::vector<int> mnt_category;
251 std::vector<float> mnt_cat1_pt;
252 std::vector<float> mnt_cat1_z0;
253 std::vector<float> mnt_cat1_d0;
254 std::vector<float> mnt_cat1_iso01;
255 std::vector<float> mnt_cat1_iso0201;
256 std::vector<float> mnt_cat1_chi2ndof;
257 std::vector<float> mnt_cat1_chi2ndof_pix;
258 std::vector<float> mnt_cat1_refit_pt;
259 std::vector<int> mnt_cat1_n_pix;
260 std::vector<float> mnt_cat1_refit_ptratio;
261 std::vector<float> mnt_cat1_refit_chi2ndof;
262 std::vector<int> mnt_cat1_n_bl;
263 std::vector<float> mnt_cat1_bdtscore;
273 auto mon_cat1_refit_ptratio =
Monitored::Collection(
"pix4_sct0_refit_ptratio", mnt_cat1_refit_ptratio);
274 auto mon_cat1_refit_chi2ndof =
Monitored::Collection(
"pix4_sct0_refit_chi2ndof", mnt_cat1_refit_chi2ndof);
277 auto monDisTrkCat1 =
Monitored::Group(
m_monTool, mon_cat1_pt, mon_cat1_z0, mon_cat1_d0, mon_cat1_iso01, mon_cat1_iso0201, mon_cat1_chi2ndof,
278 mon_cat1_chi2ndof_pix, mon_cat1_refit_pt, mon_cat1_n_pix, mon_cat1_refit_ptratio,
279 mon_cat1_refit_chi2ndof, mon_cat1_n_bl, mon_cat1_bdtscore);
281 std::vector<float> mnt_cat2_pt;
282 std::vector<float> mnt_cat2_refit_pt;
283 std::vector<float> mnt_cat2_refit_z0;
284 std::vector<float> mnt_cat2_refit_d0;
285 std::vector<int> mnt_cat2_n_sct;
286 std::vector<float> mnt_cat2_refit_ptratio;
287 std::vector<float> mnt_cat2_refit_chi2ndof_ratio;
288 std::vector<float> mnt_cat2_iso01;
289 std::vector<float> mnt_cat2_iso0201;
290 std::vector<float> mnt_cat2_chi2ndof_pix;
291 std::vector<int> mnt_cat2_n_pix;
292 std::vector<float> mnt_cat2_bdtscore;
298 auto mon_cat2_refit_ptratio =
Monitored::Collection(
"pix4_sct1p_refit_ptratio", mnt_cat2_refit_ptratio);
299 auto mon_cat2_refit_chi2ndof_ratio =
Monitored::Collection(
"pix4_sct1p_refit_chi2ndof_ratio", mnt_cat2_refit_chi2ndof_ratio);
302 auto mon_cat2_chi2ndof_pix =
Monitored::Collection(
"pix4_sct1p_chi2ndof_pix", mnt_cat2_chi2ndof_pix);
305 auto monDisTrkCat2 =
Monitored::Group(
m_monTool, mon_cat2_pt, mon_cat2_refit_pt, mon_cat2_refit_z0, mon_cat2_refit_d0, mon_cat2_n_sct,
306 mon_cat2_refit_ptratio, mon_cat2_refit_chi2ndof_ratio, mon_cat2_iso01, mon_cat2_iso0201,
307 mon_cat2_chi2ndof_pix, mon_cat2_n_pix, mon_cat2_bdtscore);
309 std::vector<float> mnt_cat3_pt;
310 std::vector<float> mnt_cat3_z0;
311 std::vector<float> mnt_cat3_d0;
312 std::vector<float> mnt_cat3_chi2ndof;
313 std::vector<float> mnt_cat3_chi2ndof_pix;
314 std::vector<float> mnt_cat3_iso01;
315 std::vector<float> mnt_cat3_iso0201;
316 std::vector<float> mnt_cat3_refit_pt;
317 std::vector<float> mnt_cat3_refit_z0;
318 std::vector<float> mnt_cat3_refit_d0;
319 std::vector<int> mnt_cat3_n_pix;
320 std::vector<int> mnt_cat3_n_bl;
321 std::vector<float> mnt_cat3_bdtscore;
335 auto monDisTrkCat3 =
Monitored::Group(
m_monTool, mon_cat3_pt, mon_cat3_z0, mon_cat3_d0, mon_cat3_chi2ndof, mon_cat3_chi2ndof_pix,
336 mon_cat3_iso01, mon_cat3_iso0201, mon_cat3_refit_pt, mon_cat3_refit_z0, mon_cat3_refit_d0,
337 mon_cat3_n_pix, mon_cat3_n_bl, mon_cat3_bdtscore);
339 std::vector<float> mnt_cat4_pt;
340 std::vector<float> mnt_cat4_z0;
341 std::vector<float> mnt_cat4_d0;
342 std::vector<float> mnt_cat4_refit_pt;
343 std::vector<float> mnt_cat4_refit_z0;
344 std::vector<float> mnt_cat4_refit_d0;
345 std::vector<int> mnt_cat4_n_pix;
346 std::vector<int> mnt_cat4_n_sct;
347 std::vector<float> mnt_cat4_refit_ptratio;
348 std::vector<int> mnt_cat4_n_bl;
349 std::vector<float> mnt_cat4_chi2ndof;
350 std::vector<float> mnt_cat4_iso01;
351 std::vector<float> mnt_cat4_iso0201;
352 std::vector<float> mnt_cat4_refit_chi2ndof;
353 std::vector<float> mnt_cat4_bdtscore;
362 auto mon_cat4_refit_ptratio =
Monitored::Collection(
"pix3_sct1p_refit_ptratio", mnt_cat4_refit_ptratio);
367 auto mon_cat4_refit_chi2ndof =
Monitored::Collection(
"pix3_sct1p_refit_chi2ndof", mnt_cat4_refit_chi2ndof);
369 auto monDisTrkCat4 =
Monitored::Group(
m_monTool, mon_cat4_pt, mon_cat4_z0, mon_cat4_d0, mon_cat4_refit_pt, mon_cat4_refit_z0, mon_cat4_refit_d0,
370 mon_cat4_n_pix, mon_cat4_n_sct, mon_cat4_refit_ptratio, mon_cat4_n_bl, mon_cat4_chi2ndof,
371 mon_cat4_iso01, mon_cat4_iso0201, mon_cat4_refit_chi2ndof, mon_cat4_bdtscore);
375 const std::string prefixIn =
"disTrkCand";
376 const std::string prefixOut =
"disTrk";
378 unsigned int i_cand=0;
386 if( category<=0 || category>=5 ) {
393 float ptGeV = cand->getDetail<
float>(prefixIn+
"_pt");
394 float refit_ptGeV = cand->getDetail<
float>(prefixIn+
"_refit_pt");
397 int is_fail = (
int)cand->getDetail<
int16_t>(prefixIn+
"_is_fail");
398 float d0_wrtVtx = cand->getDetail<
float>(prefixIn+
"_d0_wrtVtx");
399 float z0_wrtVtx = cand->getDetail<
float>(prefixIn+
"_z0_wrtVtx");
400 float chi2 = cand->getDetail<
float>(prefixIn+
"_chi2");
401 float ndof = cand->getDetail<
float>(prefixIn+
"_ndof");
402 float chi2ndof = ( std::abs(
ndof) > 1
e-4 ) ?
chi2 /
ndof : 20;
403 int n_hits_pix = (
int)cand->getDetail<
int16_t>(prefixIn+
"_n_hits_pix");
404 int n_hits_sct = (
int)cand->getDetail<
int16_t>(prefixIn+
"_n_hits_sct");
405 int n_hits_bl = (
int)cand->getDetail<
int16_t>(prefixIn+
"_n_hits_innermost");
406 float iso3_dr01 = cand->getDetail<
float>(prefixIn+
"_iso3_dr01");
408 float iso3_dr02 = cand->getDetail<
float>(prefixIn+
"_iso3_dr02");
410 float refit_ptratio = ( std::abs(ptGeV) > 1
e-4 ) ? refit_ptGeV / ptGeV : 0;
411 float refit_d0_wrtVtx = cand->getDetail<
float>(prefixIn+
"_refit_d0_wrtVtx");
412 float refit_z0_wrtVtx = cand->getDetail<
float>(prefixIn+
"_refit_z0_wrtVtx");
413 float refit_chi2 = cand->getDetail<
float>(prefixIn+
"_refit_chi2");
414 float refit_ndof = cand->getDetail<
float>(prefixIn+
"_refit_ndof");
415 float refit_chi2ndof = ( std::abs(refit_ndof) > 1
e-4 ) ? refit_chi2 / refit_ndof : 20;
416 float refit_chi2ndof_ratio = (std::abs(chi2ndof) > 1
e-4 ) ? refit_chi2ndof / chi2ndof : 0;
417 float chi2_pix=0;
float ndof_pix=0;
418 chi2_pix += cand->getDetail<
float>(prefixIn+
"_chi2sum_br_ibl");
419 chi2_pix += cand->getDetail<
float>(prefixIn+
"_chi2sum_br_pix1");
420 chi2_pix += cand->getDetail<
float>(prefixIn+
"_chi2sum_br_pix2");
421 chi2_pix += cand->getDetail<
float>(prefixIn+
"_chi2sum_br_pix3");
422 ndof_pix += cand->getDetail<
float>(prefixIn+
"_ndofsum_br_ibl");
423 ndof_pix += cand->getDetail<
float>(prefixIn+
"_ndofsum_br_pix1");
424 ndof_pix += cand->getDetail<
float>(prefixIn+
"_ndofsum_br_pix2");
425 ndof_pix += cand->getDetail<
float>(prefixIn+
"_ndofsum_br_pix3");
426 float chi2ndof_pix = ( std::abs(ndof_pix) > 1
e-4 ) ? chi2_pix / ndof_pix : 0;
429 float bdt_score = 0.0;
431 bdt_score =
bdt_eval_pix4l_sct0(context, ptGeV, z0_wrtVtx, d0_wrtVtx, iso3_dr01, iso3_dr02-iso3_dr01, chi2ndof, chi2ndof_pix,
432 refit_ptGeV, n_hits_pix, refit_ptratio, refit_chi2ndof, n_hits_bl);
433 mnt_cat1_pt.push_back(ptGeV);
434 mnt_cat1_z0.push_back(z0_wrtVtx);
435 mnt_cat1_d0.push_back(d0_wrtVtx);
436 mnt_cat1_iso01.push_back(iso3_dr01);
437 mnt_cat1_iso0201.push_back(iso3_dr02-iso3_dr01);
438 mnt_cat1_chi2ndof.push_back(chi2ndof);
439 mnt_cat1_chi2ndof_pix.push_back(chi2ndof_pix);
440 mnt_cat1_refit_pt.push_back(refit_ptGeV);
441 mnt_cat1_n_pix.push_back(n_hits_pix);
442 mnt_cat1_refit_ptratio.push_back(refit_ptratio);
443 mnt_cat1_refit_chi2ndof.push_back(refit_chi2ndof);
444 mnt_cat1_n_bl.push_back(n_hits_bl);
445 mnt_cat1_bdtscore.push_back(bdt_score);
448 bdt_score =
bdt_eval_pix4l_sct1p(context, ptGeV, refit_ptGeV, refit_z0_wrtVtx, refit_d0_wrtVtx, n_hits_sct, refit_ptratio,
449 refit_chi2ndof_ratio, iso3_dr01, iso3_dr02-iso3_dr01, is_fail, chi2ndof_pix, n_hits_pix);
450 mnt_cat2_pt.push_back(ptGeV);
451 mnt_cat2_refit_pt.push_back(refit_ptGeV);
452 mnt_cat2_refit_z0.push_back(refit_z0_wrtVtx);
453 mnt_cat2_refit_d0.push_back(refit_d0_wrtVtx);
454 mnt_cat2_n_sct.push_back(n_hits_sct);
455 mnt_cat2_refit_ptratio.push_back(refit_ptratio);
456 mnt_cat2_refit_chi2ndof_ratio.push_back(refit_chi2ndof_ratio);
457 mnt_cat2_iso01.push_back(iso3_dr01);
458 mnt_cat2_iso0201.push_back(iso3_dr02-iso3_dr01);
459 mnt_cat2_chi2ndof_pix.push_back(chi2ndof_pix);
460 mnt_cat2_n_pix.push_back(n_hits_pix);
461 mnt_cat2_bdtscore.push_back(bdt_score);
464 bdt_score =
bdt_eval_pix3l_sct0(context, ptGeV, z0_wrtVtx, d0_wrtVtx, chi2ndof, chi2ndof_pix, iso3_dr01, iso3_dr02-iso3_dr01,
465 refit_ptGeV, refit_z0_wrtVtx, refit_d0_wrtVtx, n_hits_pix, n_hits_bl);
466 mnt_cat3_pt.push_back(ptGeV);
467 mnt_cat3_z0.push_back(z0_wrtVtx);
468 mnt_cat3_d0.push_back(d0_wrtVtx);
469 mnt_cat3_chi2ndof.push_back(chi2ndof);
470 mnt_cat3_chi2ndof_pix.push_back(chi2ndof_pix);
471 mnt_cat3_iso01.push_back(iso3_dr01);
472 mnt_cat3_iso0201.push_back(iso3_dr02-iso3_dr01);
473 mnt_cat3_refit_pt.push_back(refit_ptGeV);
474 mnt_cat3_refit_z0.push_back(refit_z0_wrtVtx);
475 mnt_cat3_refit_d0.push_back(refit_d0_wrtVtx);
476 mnt_cat3_n_pix.push_back(n_hits_pix);
477 mnt_cat3_n_bl.push_back(n_hits_bl);
478 mnt_cat3_bdtscore.push_back(bdt_score);
481 bdt_score =
bdt_eval_pix3l_sct1p(context, ptGeV, z0_wrtVtx, d0_wrtVtx, refit_ptGeV, refit_z0_wrtVtx, refit_d0_wrtVtx, n_hits_pix, n_hits_sct,
482 refit_ptratio, is_fail, n_hits_bl, chi2ndof, iso3_dr01, iso3_dr02-iso3_dr01, refit_chi2ndof);
483 mnt_cat4_pt.push_back(ptGeV);
484 mnt_cat4_z0.push_back(z0_wrtVtx);
485 mnt_cat4_d0.push_back(d0_wrtVtx);
486 mnt_cat4_refit_pt.push_back(refit_ptGeV);
487 mnt_cat4_refit_z0.push_back(refit_z0_wrtVtx);
488 mnt_cat4_refit_d0.push_back(refit_d0_wrtVtx);
489 mnt_cat4_n_pix.push_back(n_hits_pix);
490 mnt_cat4_n_sct.push_back(n_hits_sct);
491 mnt_cat4_refit_ptratio.push_back(refit_ptratio);
492 mnt_cat4_n_bl.push_back(n_hits_bl);
493 mnt_cat4_chi2ndof.push_back(chi2ndof);
494 mnt_cat4_iso01.push_back(iso3_dr01);
495 mnt_cat4_iso0201.push_back(iso3_dr02-iso3_dr01);
496 mnt_cat4_refit_chi2ndof.push_back(refit_chi2ndof);
497 mnt_cat4_bdtscore.push_back(bdt_score);
502 const float PRESEL_PT_GEV = 7.5;
503 const float PRESEL_BDT_SCORE_CAT3 = -0.4;
504 const float PRESEL_BDT_SCORE_CAT4 = -0.2;
505 if( ptGeV < PRESEL_PT_GEV && refit_ptGeV < PRESEL_PT_GEV )
continue;
506 if(
category==3 && bdt_score < PRESEL_BDT_SCORE_CAT3 )
continue;
507 if(
category==4 && bdt_score < PRESEL_BDT_SCORE_CAT4 )
continue;
512 disTrkBDTSelContainer->
push_back(distrk);
516 float eta = cand->getDetail<
float>(prefixIn+
"_eta");
517 float phi = cand->getDetail<
float>(prefixIn+
"_phi");
522 distrk->
setDetail<
float>(prefixOut+
"_d0_wrtVtx", d0_wrtVtx);
523 distrk->
setDetail<
float>(prefixOut+
"_z0_wrtVtx", z0_wrtVtx);
528 distrk->setDetail<
int16_t>(prefixOut+
"_n_hits_innermost", (
int16_t)n_hits_bl);
531 distrk->setDetail<
float>(prefixOut+
"_refit_d0_wrtVtx", refit_d0_wrtVtx);
532 distrk->setDetail<
float>(prefixOut+
"_refit_z0_wrtVtx", refit_z0_wrtVtx);
533 distrk->setDetail<
float>(prefixOut+
"_refit_chi2", refit_chi2);
534 distrk->setDetail<
float>(prefixOut+
"_refit_ndof", refit_ndof);
535 distrk->setDetail<
float>(prefixOut+
"_chi2ndof_pix", chi2ndof_pix);
536 distrk->setDetail<
float>(prefixOut+
"_bdtscore", bdt_score);
541 return StatusCode::SUCCESS;