17 : base_class(ty, na, pa) {
18 declareProperty(
"UseCosmicsSettings",
m_isCosmics =
false,
"Pick up settings for cosmics");
20 "Perform matching for segments in a small/large overlap");
22 "Perform matching for segments in regions without field");
23 declareProperty(
"DoCurvedMatch",
m_doCurvedMatch =
true,
"Perform matching for segments in a field regions");
24 declareProperty(
"doThetaMatching",
m_thetaMatch =
false,
"Pre-matching in theta");
25 declareProperty(
"doPhiMatching",
m_phiMatch =
false,
"Pre-matching in phi");
29 "Cut on the angular difference between the best phi and the one consistent with the chamber bounds");
32 "Cut on the angular difference between the best phi and the one consistent with the chamber bounds");
34 "Cut on the distance of recalculated position to the tube edge");
36 "Cut on the segment position residual after recalculation of the paramters");
38 "Cut on the average pull of the phi hits with the new segment parameters");
41 "Cut on the angular difference between the extrapolated segment angle and reference");
43 "Cut on the distance of extrapolated segment position and reference");
45 "If the two segments are further apart than this distance, they are considered to not match");
48 "Accept only segments that are in the same sector for tight matching");
50 "Use tight selection for busy event to suppress combinatorics and improve CPU");
53 "Cut on sumDeltaYZ, segments in BI and BM, small phi sec");
55 "Cut on sumDeltaYZ, segments in BI and BO, small phi sec");
57 "Cut on sumDeltaYZ, segments in BM and BO, small phi sec");
59 "Cut on sumDeltaYZ, segments in EI and EM, small phi sec");
61 "Cut on sumDeltaYZ, segments in EI and EO, small phi sec");
63 "Cut on sumDeltaYZ, segments in EM and EO, small phi sec");
65 "Cut on sumDeltaYZ, segments in BI and BM, large phi sec");
67 "Cut on sumDeltaYZ, segments in BI and BO, large phi sec");
69 "Cut on sumDeltaYZ, segments in BM and BO, large phi sec");
71 "Cut on sumDeltaYZ, segments in EI and EM, large phi sec");
73 "Cut on sumDeltaYZ, segments in EI and EO, large phi sec");
75 "Cut on sumDeltaYZ, segments in EM and EO, large phi sec");
91 return StatusCode::SUCCESS;
97 double goodOverlapMatchFraction =
102 double goodStraightLineMatchFraction =
106 << goodStraightLineMatchFraction);
108 double goodCurvedMatchFraction =
116 return StatusCode::SUCCESS;
126 if (chid1 == chid2)
return false;
135 if (stIndex1 == stIndex2) {
139 const int eta1 =
m_idHelperSvc->mdtIdHelper().stationEta(chid1);
140 const int eta2 =
m_idHelperSvc->mdtIdHelper().stationEta(chid2);
144 if ( std::abs(eta1-eta2) <=1
145 && ( std::abs(phi1 - phi2) == 1 || (phi1 == 1 && phi2 == 16)
146 || (phi1 == 16 && phi2 == 1)))
155 if (stIndex1 == stIndex2)
return false;
162 if (stIndex1 == stIndex2)
return false;
239 if (!
result.goodMatch()) {
249 <<
result.phiResult.deltaYZ);
256 ATH_MSG_DEBUG(
" failed phi hit pull cut: seg1 " <<
result.averagePhiHitPullSegment1 <<
" seg2 "
257 <<
result.averagePhiHitPullSegment2);
271 ATH_MSG_DEBUG(
" failed position residual cut: seg1 " <<
result.segmentResult1.positionResidual <<
" seg2 "
272 <<
result.segmentResult2.positionResidual);
291 if (stIndex1 == stIndex2)
return true;
294 if ((stIndex1 == StIndex::EO && stIndex2 == StIndex::EM)||
295 (stIndex1 == StIndex::EM && stIndex2 == StIndex::EO))
310 if (phi1 != phi2)
return true;
316 return isSmallChamber1 != isSmallChamber2;
335 bool isBEE_a = station_a == StIndex::BE;
339 bool isBEE_b = station_b == StIndex::BE;
347 <<
result.phiSector_b <<
" " <<
result.deltaTheta_a <<
" " <<
result.deltaTheta_b <<
" "
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) {
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;
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) {
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;
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
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 "
616 && ((
result.phiSector_a != 16 &&
result.phiSector_b != 1)
617 && (
result.phiSector_a != 1 &&
result.phiSector_b != 16))
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;
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;
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;
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;
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;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This is the common class for 3D segments used in the muon spectrometer.
const Amg::Vector3D & globalDirection() const
global direction
virtual const Amg::Vector3D & globalPosition() const override final
global position
Eigen::Matrix< double, 3, 1 > Vector3D
StIndex
enum to classify the different station layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.