The cut off variable is used to avoid FPEs risen where one of the matrix enties exceeds a large number and hence the determinant becomes tremendously larger
468 {
469 MuonCombined::MuonSegmentInfo
info;
470
471
472
474 info.segment = &segment;
475 info.trackAtSegment = exTrack;
476
477 Muon::IMuonSegmentHitSummaryTool::HitCounts hitCounts =
m_hitSummaryTool->getHitCounts(segment);
478
479
480
482
483
484
487
488
489
492
493
494
497
498
499
500 info.exCovYTheta = 0.;
501 if (exTrack->covariance()) {
509 } else {
510 info.exErrorX = -999.;
511 info.exErrorY = -999.;
512 }
513
514
517
518
523
524
525
527 Trk::LocalDirection exTrkLocDir;
528 exTrack->associatedSurface().globalToLocalDirection(exTrack->momentum(), exTrkLocDir);
531
532
533
534 double exTrkErrXZ(0.), exTrkErrYZ(0.), segErrXZ(0.), segErrYZ(0.), covLocYYZ(0.);
535
537 info.exErrorXZ = exTrkErrXZ;
538 info.exErrorYZ = exTrkErrYZ;
539 info.exCovYZY = covLocYYZ;
541 info.segErrorXZ = segErrXZ;
542 info.segErrorYZ = segErrYZ;
545
548
549 ATH_MSG_DEBUG(
" info.exErrorYZ " <<
info.exErrorYZ <<
" info.segErrorYZ " <<
info.segErrorYZ <<
" info.exCovYZY " <<
info.exCovYZY);
551
554
556
559
560
561
562
563
564 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{
m_DetectorManagerKey, ctx};
565 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.
cptr();
566 if (!MuonDetMgr) {
567 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
569 }
570 double maxResXMdt{-1e9}, maxResPhi{-1e9}, maxPullPhi{-1e9}, minResPhi{1e9}, minPullPhi{1e9};
571
573 const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(seg_it);
574 if (mdt) {
575
577
578
581
582 const MuonGM::MdtReadoutElement* detEl =
584 if (!detEl) {
586 continue;
587 }
589
590
591
593 if (!exP) {
595 continue;
596 }
598 <<
" exPos " << exP->parameters()[
Trk::locR] <<
" y " << exP->parameters()[
Trk::locZ] <<
" tubeL " << tubeLen);
599 double exResidual = std::abs(exP->parameters()[
Trk::locZ]) - 0.5 * tubeLen;
600 if (maxResXMdt < exResidual) maxResXMdt = exResidual;
601 if (exResidual > 0.)
ATH_MSG_DEBUG(
"Extrapolated position outside tube, " << exResidual);
602 } else {
603
607
608 std::unique_ptr<Trk::TrackParameters> exP{
610 if (!exP) {
612 continue;
613 }
614 std::optional<Trk::ResidualPull> resPull{
616 if (!resPull) {
618
619 continue;
620 }
621 const double residual = resPull->residual().front();
622 const double pull = resPull->pull().front();
623
624 maxResPhi = std::max(residual, maxResPhi);
625 minResPhi = std::min(residual, minResPhi);
626 maxPullPhi = std::max(pull, maxPullPhi);
627 minPullPhi = std::min(pull, minPullPhi);
628
630 }
631 }
632 ATH_MSG_DEBUG(
"Residual phi min " << minResPhi <<
" max " << maxResPhi <<
" pull min " << minPullPhi <<
" max " << maxPullPhi
633 << " dist from tube end " << maxResXMdt);
634
635
636
637
638 info.maximumResidualAlongTube = maxResXMdt;
639 info.maximumResidualPhi = maxResPhi;
640 info.maximumPullPhi = maxPullPhi;
641
642 info.minimumResidualPhi = minResPhi;
643 info.minimumPullPhi = minPullPhi;
644
645 info.pullChamber = maxResXMdt /
info.exErrorX;
646
647
651 constexpr double matrix_cutoff = 1.e20;
652 double a = std::pow(std::min(matrix_cutoff,
info.exErrorY), 2);
653 double b = std::abs(
info.exCovYZY) < matrix_cutoff ?
info.exCovYZY : (
info.exCovYZY < 0 ? -1. : 1) * matrix_cutoff;
654 double d = std::pow(std::min(matrix_cutoff,
info.exErrorYZ), 2);
656
658 if (det < 0.1 *
a * d) {
659 scale = std::sqrt(0.9 *
a * d) / std::abs(b);
661 }
662 if (det ==0.) {
665 }
668
669
670
671
672
674
676 << segment.
globalPosition().theta() <<
" correction " << correction);
680 if (error_rescy > 0) {
681 error_rescy = std::sqrt(error_rescy + error_segcy);
682 } else {
683 error_rescy = std::sqrt(
info.exErrorY *
info.exErrorY + error_segcy);
684 }
685
686
687
689
690
691
693 info.chi2Y = 0.5*( chi2Y /
det);
694 if (
info.chi2Y < 0)
ATH_MSG_DEBUG(
" NEGATIVE chi2Y " << chi2Y <<
" dydyz " << dydyz <<
" determinant " << det);
695
697
698
699
700
703
704
705 info.stationLayer = 0;
706 switch (stIndex) {
707 case StIndex::BI:
708 info.stationLayer = 1;
709 break;
710 case StIndex::BM:
711 info.stationLayer = 2;
712 break;
713 case StIndex::BO:
714 info.stationLayer = 3;
715 break;
716 case StIndex::BE:
717 info.stationLayer = 4;
718 break;
719 case StIndex::EI:
721 break;
722 case StIndex::EM:
723 info.stationLayer = 12;
724 break;
725 case StIndex::EO:
726 info.stationLayer = 13;
727 break;
728 case StIndex::EE:
729 info.stationLayer = 14;
730 break;
731 case StIndex::StUnknown:
732 case StIndex::StIndexMax:
733 ATH_MSG_WARNING(__func__<<
"(): "<<__LINE__<<
"Invalid station index passed");
734 break;
735 }
736
738
740 const Muon::MuonSegmentQuality*
q =
dynamic_cast<const Muon::MuonSegmentQuality*
>(segment.
fitQuality());
741 if (q)
info.nholes =
q->numberOfHoles();
742
743
745
746
749
750
751
752
753
754
756 constexpr double a_locY{13.8269}, b_locY{1.23548}, c_locY{2.73400}, a_AYZ{12.0655}, b_AYZ{1.87578}, c_AYZ{1.88660}, width_locY{20.},
757 width_AYZ{0.004};
758
759 double dlocY =
info.resY;
760 double dAYZ =
info.dangleYZ;
761
762 double logLocY = std::log(1 + std::abs(dlocY / width_locY));
763 double logAYZ = std::log(1 + std::abs(dAYZ / width_AYZ));
764
765 info.RLocY = a_locY / (1. + b_locY * (logLocY) * (logLocY) + c_locY * (logLocY) * (logLocY) * (logLocY));
766 info.RAYZ = a_AYZ / (1. + b_AYZ * (logAYZ) * (logAYZ) + c_AYZ * (logAYZ) * (logAYZ) * (logAYZ));
767
768 int selected = 0;
770
773 bool pass = true;
774 if (pass) selected = 1;
775 }
776
777 info.selected = selected;
778
780}
double getActiveTubeLength(const int tubeLayer, const int tube) const
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual const Trk::StraightLineSurface & associatedSurface() const override final
Returns the surface on which this measurement was taken.
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
const Trk::LocalDirection & localDirection() const
local direction
const Amg::Vector3D & globalDirection() const
global direction
virtual const Amg::Vector3D & globalPosition() const override final
global position
const_pointer_type cptr()
double angleXZ() const
access method for angle of local XZ projection
double angleYZ() const
access method for angle of local YZ projection
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
@ Unbiased
RP with track state that has measurement not included.
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
StIndex
enum to classify the different station layers in the muon spectrometer
@ NoField
Field is set to 0., 0., 0.,.