16 declareInterface<IMuonSegmentMatchingTool>(
this);
19 "Perform matching for segments in a small/large overlap");
21 "Perform matching for segments in regions without field");
28 "Cut on the angular difference between the best phi and the one consistent with the chamber bounds");
31 "Cut on the angular difference between the best phi and the one consistent with the chamber bounds");
33 "Cut on the distance of recalculated position to the tube edge");
35 "Cut on the segment position residual after recalculation of the paramters");
37 "Cut on the average pull of the phi hits with the new segment parameters");
40 "Cut on the angular difference between the extrapolated segment angle and reference");
42 "Cut on the distance of extrapolated segment position and reference");
44 "If the two segments are further apart than this distance, they are considered to not match");
47 "Accept only segments that are in the same sector for tight matching");
49 "Use tight selection for busy event to suppress combinatorics and improve CPU");
52 "Print matching angle information to screen. WARNING: always returns True for suppressNoise");
54 "Cut on sumDeltaYZ, segments in BI and BM, small phi sec");
56 "Cut on sumDeltaYZ, segments in BI and BO, small phi sec");
58 "Cut on sumDeltaYZ, segments in BM and BO, small phi sec");
60 "Cut on sumDeltaYZ, segments in EI and EM, small phi sec");
62 "Cut on sumDeltaYZ, segments in EI and EO, small phi sec");
64 "Cut on sumDeltaYZ, segments in EM and EO, small phi sec");
66 "Cut on sumDeltaYZ, segments in BI and BM, large phi sec");
68 "Cut on sumDeltaYZ, segments in BI and BO, large phi sec");
70 "Cut on sumDeltaYZ, segments in BM and BO, large phi sec");
72 "Cut on sumDeltaYZ, segments in EI and EM, large phi sec");
74 "Cut on sumDeltaYZ, segments in EI and EO, large phi sec");
76 "Cut on sumDeltaYZ, segments in EM and EO, large phi sec");
92 return StatusCode::SUCCESS;
98 double goodOverlapMatchFraction =
103 double goodStraightLineMatchFraction =
107 << goodStraightLineMatchFraction);
109 double goodCurvedMatchFraction =
117 return StatusCode::SUCCESS;
127 if (chid1 == chid2)
return false;
136 if (stIndex1 == stIndex2) {
146 && ( std::abs(phi1 - phi2) == 1 || (phi1 == 1 && phi2 == 16)
147 || (phi1 == 16 && phi2 == 1)))
156 if (stIndex1 == stIndex2)
return false;
163 if (stIndex1 == stIndex2)
return false;
240 if (!
result.goodMatch()) {
250 <<
result.phiResult.deltaYZ);
257 ATH_MSG_DEBUG(
" failed phi hit pull cut: seg1 " <<
result.averagePhiHitPullSegment1 <<
" seg2 "
258 <<
result.averagePhiHitPullSegment2);
272 ATH_MSG_DEBUG(
" failed position residual cut: seg1 " <<
result.segmentResult1.positionResidual <<
" seg2 "
273 <<
result.segmentResult2.positionResidual);
292 if (stIndex1 == stIndex2)
return true;
311 if (phi1 != phi2)
return true;
317 return isSmallChamber1 != isSmallChamber2;
345 std::cout <<
"SegmentPositionChange "
348 <<
result.phiSector_b <<
" " <<
result.deltaTheta_a <<
" " <<
result.deltaTheta_b <<
" "
356 <<
" " <<
result.phiSector_b <<
" thetas " <<
result.deltaTheta_a <<
" "
357 <<
result.deltaTheta_b <<
" thetaSum " <<
result.deltaTheta <<
" tight cuts "
361 if (
result.angleAB > 1.0)
return false;
366 if (isCSC_a || isCSC_b) {
371 if ((isCSC_a && !isEndcap_b) || (isCSC_b && !isEndcap_a))
return false;
375 else if (isBEE_a || isBEE_b)
378 return result.deltaTheta <= 0.300;
381 else if (isEndcap_a != isEndcap_b)
384 return result.deltaTheta <= 0.300;
390 if (
result.deltaTheta > 0.300) {
401 if (
result.phiSector_a % 2 == 0) {
403 }
else if (
result.phiSector_a % 2 == 1) {
411 if (
result.phiSector_a % 2 == 0) {
413 }
else if (
result.phiSector_a % 2 == 1) {
422 if (
result.phiSector_a % 2 == 0) {
424 }
else if (
result.phiSector_a % 2 == 1) {
432 if (
result.phiSector_a % 2 == 0) {
439 }
else if (
result.phiSector_a % 2 == 1) {
452 if (
result.phiSector_a % 2 == 0) {
459 }
else if (
result.phiSector_a % 2 == 1) {
473 if (
result.phiSector_a % 2 == 0) {
475 }
else if (
result.phiSector_a % 2 == 1) {
487 ATH_MSG_VERBOSE(
" rejection pair as in different sector and using tight cuts");
490 if (isCSC_a || isCSC_b) {
494 if (
result.deltaTheta > 0.100) {
497 if ((isCSC_a && !isEndcap_b) || (isCSC_b && !isEndcap_a))
return false;
505 else if (isBEE_a || isBEE_b)
507 return result.deltaTheta <= 0.200;
512 return result.deltaTheta <= 0.150;
515 else if (isEndcap_a != isEndcap_b)
517 return result.deltaTheta <= 0.150;
524 if (nChambers_a < 2 && nChambers_b < 2) {
526 }
else if (
result.deltaTheta > 0.150) {
535 if (
result.phiSector_a % 2 == 0) {
537 }
else if (
result.phiSector_a % 2 == 1) {
544 if (
result.phiSector_a % 2 == 0) {
546 }
else if (
result.phiSector_a % 2 == 1) {
553 if (
result.phiSector_a % 2 == 0) {
555 }
else if (
result.phiSector_a % 2 == 1) {
563 if (
result.phiSector_a % 2 == 0) {
569 }
else if (
result.phiSector_a % 2 == 1) {
580 if (
result.phiSector_a % 2 == 0) {
586 }
else if (
result.phiSector_a % 2 == 1) {
597 if (
result.phiSector_a % 2 == 0) {
599 }
else if (
result.phiSector_a % 2 == 1) {
609 const bool& useTightCuts)
const
622 std::cout <<
"SegmentPositionChange Phi"
625 <<
" deltaPhidir " <<
result.deltaPhidir <<
" phiposerr_a " <<
result.phiposerr_a <<
" phiposerr_b "
626 <<
result.phiposerr_b <<
" phidirerr_a " <<
result.phidirerr_a <<
" phidirerr_b "
627 <<
result.phidirerr_b <<
" shorttube_a " <<
result.shorttube_a <<
" shorttube_b "
628 <<
result.shorttube_b << std::endl;
634 && ((
result.phiSector_a != 16 &&
result.phiSector_b != 1)
635 && (
result.phiSector_a != 1 &&
result.phiSector_b != 16))
643 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) {
650 if (
result.phiSector_a % 2 == 0) {
651 return result.deltaPhipos <= 0.1;
654 if (
result.phiSector_a % 2 == 1) {
655 return result.deltaPhipos <= 0.2;
662 if (
result.phiposerr_a < 10001.000 &&
result.phiposerr_b < 10001.000) {
663 if (!isEndcap_a && !isEndcap_b) {
664 return result.deltaPhipos <= 0.1;
666 if (isEndcap_a && isEndcap_b) {
667 return result.deltaPhipos <= 0.2;
676 if (
result.phiposerr_a < 10001.000) {
678 return result.shorttube_a <= 800;
682 return result.shorttube_a <= 3500 ||
result.shorttube_a == 99999.;
685 return result.shorttube_a <= 3500 ||
result.shorttube_a == 99999.;
688 return result.shorttube_a <= 800;
692 if (
result.phiposerr_b < 10001.000) {
694 return result.shorttube_b <= 800;
697 return result.shorttube_b <= 800;
700 return result.shorttube_b <= 800;
703 return result.shorttube_b <= 1400;
714 if (
result.phiposerr_a < 10001.000 &&
result.phiposerr_b < 10001.000) {
715 if (!isEndcap_a && !isEndcap_b) {
716 return result.deltaPhipos <= 0.1;
718 if (isEndcap_a && isEndcap_b) {
720 if (
result.phiSector_a % 2 == 0) {
721 return result.deltaPhipos <= 0.08;
724 if (
result.phiSector_a % 2 == 1) {
725 return result.deltaPhipos <= 0.1;
733 if (
result.phiposerr_a < 10001.000 &&
result.phiposerr_b < 10001.000) {
734 if (!isEndcap_a && !isEndcap_b) {
735 return result.deltaPhipos <= 0.05;
737 if (isEndcap_a && isEndcap_b) {
738 return result.deltaPhipos <= 0.1;
744 if (
result.phiposerr_a < 10001.000) {
746 return result.shorttube_a <= 600;
749 return result.shorttube_a <= 3500 ||
result.shorttube_a == 99999.;
752 return result.shorttube_a <= 3500 ||
result.shorttube_a == 99999.;
755 return result.shorttube_a <= 500;
759 if (
result.phiposerr_b < 10001.000) {
761 return result.shorttube_b <= 600;
764 return result.shorttube_b <= 700;
767 return result.shorttube_b <= 700;
770 return result.shorttube_b <= 700;
781 bool useTightCuts)
const
788 if (chid1 == chid2)
return false;
792 if (stIndex1 == stIndex2)
return false;
802 if (!segInner || !segOuter) {
811 double r_expected{0.}, theta_expected{0.}, rhoInv{0.};
812 simpleEndcapExtrapolate(pos1.x(), pos1.y(), pos1.z(), dir1.theta(), pos2.z(), r_expected, theta_expected, rhoInv);
814 if (rhoInv < 0) rhoInv *= -1.;
815 double dr = pos2.perp() - r_expected;
816 double dtheta = dir2.theta() - theta_expected;
840 <<
" " <<
m_printer->print(seg2) << std::endl
841 <<
" dr " <<
dr <<
" cut " << drCut <<
" dtheta " << dtheta <<
" cut " << dthetaCut
842 <<
" rhoInv " << 1e6 * rhoInv);
844 if (std::abs(
dr) > drCut)
return false;
845 if (std::abs(dtheta) > dthetaCut)
return false;
852 double theta_segment,
double z_extrapolated,
double& r_expected,
853 double& theta_expected,
double& rhoInv)
const
866 double z_start = 7000.;
867 double z_end = 12000.;
869 if (z_extrapolated < 0) z_start = -z_start;
872 double r_segment = std::hypot(x_segment , y_segment);
874 if (std::abs(z_extrapolated) > std::abs(z_segment)) {
875 ATH_MSG_WARNING(
" extrapolate outwards is not implemented for z " << z_extrapolated);
880 if (std::abs(z_segment) < std::abs(
z_end)) {
881 ATH_MSG_WARNING(
" segment before end of Toroid: SL extrapolation is used implemented " << z_segment);
885 const double tan_seg =
std::tan(theta_segment);
887 double r_end = r_segment + (
z_end - z_segment) * tan_seg;
890 rhoInv = (r_end -
z_end * tan_seg) / zgeo;
891 double tantheta = tan_seg - 2 * (
z_end - z_start) * rhoInv;
892 r_expected = z_extrapolated * tantheta + (z_extrapolated - z_start) * (z_extrapolated - z_start) * rhoInv;
896 double r_SL = r_segment + (z_extrapolated - z_segment) * tan_seg;
897 r_expected = r_expected + 0.3 * (r_expected - r_SL);
898 theta_expected =
std::atan(tantheta + 2 * (z_extrapolated - z_start) * rhoInv);
900 if (tan_seg < 0 && theta_expected < 0) theta_expected +=
M_PI;
901 if (tan_seg > 0 && theta_expected < 0) theta_expected = -theta_expected;