335 bool isBEE_a = station_a == StIndex::BE;
339 bool isBEE_b = station_b == StIndex::BE;
345 <<
" " <<
m_idHelperSvc->chamberNameString(result.chid_a) <<
" "
346 <<
m_idHelperSvc->chamberNameString(result.chid_b) <<
" " << result.phiSector_a <<
" "
347 << result.phiSector_b <<
" " << result.deltaTheta_a <<
" " << result.deltaTheta_b <<
" "
348 << result.deltaTheta <<
" " << result.angleAC <<
" " << result.angleBC <<
" " << result.angleAB);
352 <<
m_idHelperSvc->chamberNameString(result.chid_b) <<
" phis " << result.phiSector_a
353 <<
" " << result.phiSector_b <<
" thetas " << result.deltaTheta_a <<
" "
354 << result.deltaTheta_b <<
" thetaSum " << result.deltaTheta <<
" tight cuts "
358 if (result.angleAB > 1.0)
return false;
363 if (isCSC_a || isCSC_b) {
365 if (result.phiSector_a != result.phiSector_b) {
368 if ((isCSC_a && !isEndcap_b) || (isCSC_b && !isEndcap_a))
return false;
372 else if (isBEE_a || isBEE_b)
375 return result.deltaTheta <= 0.300;
378 else if (isEndcap_a != isEndcap_b)
381 return result.deltaTheta <= 0.300;
384 else if (result.phiSector_a != result.phiSector_b)
387 if (result.deltaTheta > 0.300) {
395 else if (station_a == StIndex::BI && station_b == StIndex::BM)
398 if (result.phiSector_a % 2 == 0) {
400 }
else if (result.phiSector_a % 2 == 1) {
405 else if (station_a == StIndex::BI && station_b == StIndex::BO)
408 if (result.phiSector_a % 2 == 0) {
410 }
else if (result.phiSector_a % 2 == 1) {
416 else if (station_a == StIndex::BM && station_b == StIndex::BO)
419 if (result.phiSector_a % 2 == 0) {
421 }
else if (result.phiSector_a % 2 == 1) {
426 else if (station_a == StIndex::EI && (station_b == StIndex::EM))
429 if (result.phiSector_a % 2 == 0) {
436 }
else if (result.phiSector_a % 2 == 1) {
446 else if (station_a == StIndex::EI && (station_b == StIndex::EO))
449 if (result.phiSector_a % 2 == 0) {
456 }
else if (result.phiSector_a % 2 == 1) {
466 else if (station_a == StIndex::EM && station_b == StIndex::EO)
470 if (result.phiSector_a % 2 == 0) {
472 }
else if (result.phiSector_a % 2 == 1) {
484 ATH_MSG_VERBOSE(
" rejection pair as in different sector and using tight cuts");
487 if (isCSC_a || isCSC_b) {
488 if (result.phiSector_a != result.phiSector_b) {
491 if (result.deltaTheta > 0.100) {
494 if ((isCSC_a && !isEndcap_b) || (isCSC_b && !isEndcap_a))
return false;
502 else if (isBEE_a || isBEE_b)
504 return result.deltaTheta <= 0.200;
507 else if (result.phiSector_a != result.phiSector_b)
509 return result.deltaTheta <= 0.150;
512 else if (isEndcap_a != isEndcap_b)
514 return result.deltaTheta <= 0.150;
517 else if (station_a == StIndex::BI && station_b == StIndex::BM)
519 if (result.phiSector_a % 2 == 0) {
521 }
else if (result.phiSector_a % 2 == 1) {
526 else if (station_a == StIndex::BI && station_b == StIndex::BO)
528 if (result.phiSector_a % 2 == 0) {
530 }
else if (result.phiSector_a % 2 == 1) {
535 else if (station_a == StIndex::BM && station_b == StIndex::BO)
537 if (result.phiSector_a % 2 == 0) {
539 }
else if (result.phiSector_a % 2 == 1) {
544 else if ((station_a == StIndex::EI || station_a == StIndex::BI)
545 && station_b == StIndex::EM)
547 if (result.phiSector_a % 2 == 0) {
553 }
else if (result.phiSector_a % 2 == 1) {
562 else if (station_a == StIndex::EI && (station_b == StIndex::EO))
564 if (result.phiSector_a % 2 == 0) {
570 }
else if (result.phiSector_a % 2 == 1) {
579 else if (station_a == StIndex::EM && station_b == StIndex::EO)
581 if (result.phiSector_a % 2 == 0) {
583 }
else if (result.phiSector_a % 2 == 1) {
593 const bool& useTightCuts)
const
607 <<
" " <<
m_idHelperSvc->chamberNameString(result.chid_a) <<
" "
608 <<
m_idHelperSvc->chamberNameString(result.chid_b) <<
" deltaPhipos " << result.deltaPhipos
609 <<
" deltaPhidir " << result.deltaPhidir <<
" phiposerr_a " << result.phiposerr_a <<
" phiposerr_b "
610 << result.phiposerr_b <<
" phidirerr_a " << result.phidirerr_a <<
" phidirerr_b "
611 << result.phidirerr_b <<
" shorttube_a " << result.shorttube_a <<
" shorttube_b "
612 << result.shorttube_b);
615 if (result.phiSector_a != result.phiSector_b
616 && ((result.phiSector_a != 16 && result.phiSector_b != 1)
617 && (result.phiSector_a != 1 && result.phiSector_b != 16))
618 && (result.phiSector_a != (result.phiSector_b + 1) && result.phiSector_a != (result.phiSector_b - 1)))
624 if (result.phiSector_a == result.phiSector_b) {
625 if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
627 if (!isEndcap_a && !isEndcap_b) {
628 return result.deltaPhipos <= 0.1;
630 if (isEndcap_a && isEndcap_b) {
632 if (result.phiSector_a % 2 == 0) {
633 return result.deltaPhipos <= 0.1;
636 if (result.phiSector_a % 2 == 1) {
637 return result.deltaPhipos <= 0.2;
643 if (result.phiSector_a != result.phiSector_b) {
644 if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
645 if (!isEndcap_a && !isEndcap_b) {
646 return result.deltaPhipos <= 0.1;
648 if (isEndcap_a && isEndcap_b) {
649 return result.deltaPhipos <= 0.2;
656 if (result.phiSector_a != result.phiSector_b) {
658 if (result.phiposerr_a < 10001.000) {
659 if (station_a == StIndex::BM && station_b == StIndex::BO) {
660 return result.shorttube_a <= 800;
662 if (station_a == StIndex::EI && station_b == StIndex::EM) {
664 return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
666 if (station_a == StIndex::EI && station_b == StIndex::EO) {
667 return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
669 if (station_a == StIndex::EM && station_b == StIndex::EO) {
670 return result.shorttube_a <= 800;
674 if (result.phiposerr_b < 10001.000) {
675 if (station_a == StIndex::BI && station_b == StIndex::BM) {
676 return result.shorttube_b <= 800;
678 if (station_a == StIndex::BI && station_b == StIndex::BO) {
679 return result.shorttube_b <= 800;
681 if (station_a == StIndex::BM && station_b == StIndex::BO) {
682 return result.shorttube_b <= 800;
684 if (station_a == StIndex::EI && station_b == StIndex::EM) {
685 return result.shorttube_b <= 1400;
695 if (result.phiSector_a == result.phiSector_b) {
696 if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
697 if (!isEndcap_a && !isEndcap_b) {
698 return result.deltaPhipos <= 0.1;
700 if (isEndcap_a && isEndcap_b) {
702 if (result.phiSector_a % 2 == 0) {
703 return result.deltaPhipos <= 0.08;
706 if (result.phiSector_a % 2 == 1) {
707 return result.deltaPhipos <= 0.1;
714 if (result.phiSector_a != result.phiSector_b) {
715 if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
716 if (!isEndcap_a && !isEndcap_b) {
717 return result.deltaPhipos <= 0.05;
719 if (isEndcap_a && isEndcap_b) {
720 return result.deltaPhipos <= 0.1;
726 if (result.phiposerr_a < 10001.000) {
727 if (station_a == StIndex::BM && station_b == StIndex::BO) {
728 return result.shorttube_a <= 600;
730 if (station_a == StIndex::EI && station_b == StIndex::EM) {
731 return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
733 if (station_a == StIndex::EI && station_b == StIndex::EO) {
734 return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
736 if (station_a == StIndex::EM && station_b == StIndex::EO) {
737 return result.shorttube_a <= 500;
741 if (result.phiposerr_b < 10001.000) {
742 if (station_a == StIndex::BI && station_b == StIndex::BM) {
743 return result.shorttube_b <= 600;
745 if (station_a == StIndex::BI && station_b == StIndex::BO) {
746 return result.shorttube_b <= 700;
748 if (station_a == StIndex::BM && station_b == StIndex::BO) {
749 return result.shorttube_b <= 700;
751 if (station_a == StIndex::EI && station_b == StIndex::EM) {
752 return result.shorttube_b <= 700;
763 bool useTightCuts)
const
770 if (chid1 == chid2)
return false;
774 if (stIndex1 == stIndex2)
return false;
777 if (stIndex1 == StIndex::EI) segInner = &seg1;
778 if (stIndex2 == StIndex::EI) segInner = &seg2;
781 if (stIndex1 == StIndex::EM || stIndex1 == StIndex::EO) segOuter = &seg1;
782 if (stIndex2 == StIndex::EM || stIndex2 == StIndex::EO) segOuter = &seg2;
784 if (!segInner || !segOuter) {
793 double r_expected{0.}, theta_expected{0.}, rhoInv{0.};
794 simpleEndcapExtrapolate(pos1.x(), pos1.y(), pos1.z(), dir1.theta(), pos2.z(), r_expected, theta_expected, rhoInv);
796 if (rhoInv < 0) rhoInv *= -1.;
797 double dr = pos2.perp() - r_expected;
798 double dtheta = dir2.theta() - theta_expected;
807 if ((stIndex1 == StIndex::EM && stIndex2 == StIndex::BI)
808 || (stIndex1 == StIndex::BI && stIndex2 == StIndex::EM))
822 <<
" " <<
m_printer->print(seg2) << std::endl
823 <<
" dr " << dr <<
" cut " << drCut <<
" dtheta " << dtheta <<
" cut " << dthetaCut
824 <<
" rhoInv " << 1e6 * rhoInv);
826 if (std::abs(dr) > drCut)
return false;
827 if (std::abs(dtheta) > dthetaCut)
return false;
834 double theta_segment,
double z_extrapolated,
double& r_expected,
835 double& theta_expected,
double& rhoInv)
const
848 double z_start = 7000.;
849 double z_end = 12000.;
851 if (z_extrapolated < 0) z_start = -z_start;
852 if (z_extrapolated < 0) z_end = -z_end;
854 double r_segment = std::hypot(x_segment , y_segment);
856 if (std::abs(z_extrapolated) > std::abs(z_segment)) {
857 ATH_MSG_WARNING(
" extrapolate outwards is not implemented for z " << z_extrapolated);
862 if (std::abs(z_segment) < std::abs(z_end)) {
863 ATH_MSG_WARNING(
" segment before end of Toroid: SL extrapolation is used implemented " << z_segment);
867 const double tan_seg = std::tan(theta_segment);
869 double r_end = r_segment + (z_end - z_segment) * tan_seg;
871 double zgeo = (z_end - z_start) * (z_end - z_start) - 2 * z_end * (z_end - z_start);
872 rhoInv = (r_end - z_end * tan_seg) / zgeo;
873 double tantheta = tan_seg - 2 * (z_end - z_start) * rhoInv;
874 r_expected = z_extrapolated * tantheta + (z_extrapolated - z_start) * (z_extrapolated - z_start) * rhoInv;
878 double r_SL = r_segment + (z_extrapolated - z_segment) * tan_seg;
879 r_expected = r_expected + 0.3 * (r_expected - r_SL);
880 theta_expected = std::atan(tantheta + 2 * (z_extrapolated - z_start) * rhoInv);
882 if (tan_seg < 0 && theta_expected < 0) theta_expected +=
M_PI;
883 if (tan_seg > 0 && theta_expected < 0) theta_expected = -theta_expected;