ATLAS Offline Software
Loading...
Searching...
No Matches
TrkDriftCircleMath::SegmentFinder Class Reference

#include <SegmentFinder.h>

Collaboration diagram for TrkDriftCircleMath::SegmentFinder:

Public Member Functions

 SegmentFinder ()
 SegmentFinder (const SegmentFinder &)=delete
 copy c'tor deleted to prevent ownership/leak issues
SegmentFinderoperator= (const SegmentFinder &)=delete
 assignment deleted to prevent ownership/leak issues
 SegmentFinder (double roadWidth, double deltaCut, bool fullScan)
 ~SegmentFinder ()
void handleHits (const DCVec &dcs, const CLVec &clusters, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
SegVec findSegments (const DCVec &dcs) const
SegVec findSegments (const DCVec &dcs, const CLVec &clusters) const
SegVec cleanSegments (const SegVec &segments) const
SegVec refitSegments (const SegVec &segs) const
bool dropHits (Segment &segment, bool &hasDroppedHit, unsigned int &dropDepth) const
void setTGCPullCut (double cut)
void setRPCPullCut (double cut)
void setRecoverMDT (bool doRecover)
void setDropHits (bool doDrop)
void setSeedCleaning (bool doCleanup)
void setSingleMultiLayerScan (bool doScan)
void setChi2DropCut (double chi2)
void setDeltaCut (double cut)
void setRatioEmptyTubesCut (double ratioEmptyTubesCut)
void setMdtGeometry (const ChamberGeometry *mdtGeo)
void setPhiRoad (double phiRoad, double phiChamber, double sinPhiCut=0.2, bool useRoadPhi=true, bool useChamberPhi=true)
void setSortSegmentsUsingAllHits (bool doAllHitsSort)
void setUseChamberPhi (bool useChamberPhi)
void setRemoveSingleOutliers (bool removeSingleOutliers)
void setCurvedSegmentFinder (bool doCurvedSegmentFinder)
void setFitter (std::shared_ptr< const DCSLFitter > fitter)
void setMaxDropDepth (int max)
void setResidualCutT0 (double resCut)
void setDeltaCutT0 (double deltaCut)
void setUseSegmentQuality (bool useQ)
void debugLevel (int debugLevel)

Protected Member Functions

unsigned int emptyCrossedTubes (const Line &line, const DCVec &closeEmptyTubes) const
DCVec emptyNeighbours (const DCVec &dcs) const
void handleSeedPair (const DriftCircle &seed1, const DriftCircle &seeds2, const DCVec &dcs, const CLVec &cls, MatchDCWithLine &matchWithLine, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
void fullScan (const DCVec &seeds, const DCVec &dcs, const CLVec &cls, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
void twoMultiLayerScan (const DCVec &seeds_ml1, const DCVec &seeds_ml2, const DCVec &dcs, const CLVec &cls, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
bool directionCheck (const LocVec2D &LocVec2D) const
void associateClusters (SegVec &segs, const CLVec &cls) const
void associateClusters (Segment &seg, const CLVec &cls) const
void crossedTubes (Segment &seg) const
bool goodHitRatio (Segment &seg) const
void updateDirections ()
 update the cached values for the phi road and chamber road
void printSettings () const
 print settings
double tubeRadius () const

Static Protected Member Functions

static DCVec selectSeeds (const DCVec &dcs, int maxSerie)
static std::pair< DCVec, DCVecsplitInMulitlayers (const DCVec &dcs)
static DCVec removeDCOnSegments (const DCVec &dcs, const SegVec &segs)
static void updateMatch (Segment &seg, MatchDCWithLine &matchWithLine)

Protected Attributes

double m_deltaCut {5.}
double m_roadWidth {1.5}
double m_phiRoad {M_PI_2}
LocVec2D m_roadDir {0., 0.}
double m_phiChamber {M_PI_2}
LocVec2D m_chamberDir {0., 0.}
double m_phiDifCut {0.5}
double m_ratioEmptyTubesCut {1.}
double m_chi2Cut {10}
double m_tgcPullCut {5}
double m_rpcPullCut {5}
double m_resCutT0 {1.}
double m_deltaCutT0 {5.}
bool m_useSegmentQuality {false}
bool m_recoverMdtHits {true}
std::shared_ptr< const DCSLFitterm_fitter
DCSLHitSelector m_hitSelector
MatchCrossedTubes m_matchCrossed
bool m_removeSingleOutliers {true}
bool m_fullScan {false}
bool m_singleMultiLayerScan {true}
bool m_seedCleaning {false}
bool m_doDrop {true}
unsigned int m_dropDepthMax {4}
bool m_doAllHitSort {false}
bool m_doCurvedSegmentFinder {false}
bool m_useChamberPhi {true}
bool m_useRoadPhi {true}
const ChamberGeometrym_mdtGeometry {nullptr}
int m_debugLevel {0}
std::vector< int > m_dropDepthAcceptCounts ATLAS_THREAD_SAFE {(int)m_dropDepthMax + 2, 0}
std::vector< int > m_dropDepthRejectCounts ATLAS_THREAD_SAFE {(int)m_dropDepthMax + 1, 0}
std::mutex m_mutex

Detailed Description

Definition at line 33 of file SegmentFinder.h.

Constructor & Destructor Documentation

◆ SegmentFinder() [1/3]

TrkDriftCircleMath::SegmentFinder::SegmentFinder ( )

Definition at line 23 of file SegmentFinder.cxx.

24 : m_fitter (std::make_shared<DCSLFitter>())
25 {
26 // update the cached directions
28 }
std::shared_ptr< const DCSLFitter > m_fitter
void updateDirections()
update the cached values for the phi road and chamber road

◆ SegmentFinder() [2/3]

TrkDriftCircleMath::SegmentFinder::SegmentFinder ( const SegmentFinder & )
delete

copy c'tor deleted to prevent ownership/leak issues

◆ SegmentFinder() [3/3]

TrkDriftCircleMath::SegmentFinder::SegmentFinder ( double roadWidth,
double deltaCut,
bool fullScan )

Definition at line 30 of file SegmentFinder.cxx.

30 :
31 m_deltaCut{deltaCut}, m_roadWidth{roadWidth},
32 m_fitter (std::make_shared<DCSLFitter>()),
34 {
35 // update the cached directions
37 }
void fullScan(const DCVec &seeds, const DCVec &dcs, const CLVec &cls, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const

◆ ~SegmentFinder()

TrkDriftCircleMath::SegmentFinder::~SegmentFinder ( )

Definition at line 39 of file SegmentFinder.cxx.

39 {
40 if (m_debugLevel > 0) {
41 std::lock_guard<std::mutex> lock(m_mutex);
42 std::cout << " drop summary " << std::endl;
43 for (unsigned int i = 0; i < m_dropDepthMax + 1; ++i) { std::cout << " Accepted " << m_dropDepthAcceptCounts[i] << std::endl; }
44 for (unsigned int i = 0; i < m_dropDepthMax; ++i) { std::cout << " Rejected " << m_dropDepthRejectCounts[i] << std::endl; }
45 }
46 }
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.

Member Function Documentation

◆ associateClusters() [1/2]

void TrkDriftCircleMath::SegmentFinder::associateClusters ( Segment & seg,
const CLVec & cls ) const
protected

Definition at line 921 of file SegmentFinder.cxx.

921 {
922 // calculate residuals with line
923 ResidualWithSegment resSeg(seg);
924
925 // store associated clusters
926 CLVec assCls;
927
928 bool hasClustersBefore = false;
929 bool hasClustersAfter = false;
930
931 CLCit cit = cls.begin();
932 CLCit cit_end = cls.end();
933 for (; cit != cit_end; ++cit) {
934 // always assign phi hits
935 if (cit->id().measuresPhi() == 1) {
936 if (m_debugLevel >= 1)
937 std::cout << " phi hit, not associated: id " << cit->id().id() << " pos " << cit->position() << std::endl;
938 continue;
939 }
940
941 // calculate residual
942 double res = resSeg.residual(*cit);
943 double error = std::sqrt(cit->err() * cit->err() + resSeg.trackError2(*cit));
944 double pull = res / error;
945
946 if (m_debugLevel >= 4)
947 std::cout << " handling cluster " << cit->id() << " res " << res << " pull " << pull << " hit error " << cit->err()
948 << " track error " << sqrt(resSeg.trackError2(*cit)) << " pos " << cit->position();
949
950 double pullCut = cit->id().isTgc() ? m_tgcPullCut : m_rpcPullCut;
951
952 // spatial associate
953 if (std::abs(pull) < pullCut) {
954 assCls.push_back(*cit);
955 if (cit->position().y() < 0.) hasClustersBefore = true;
956 if (cit->position().y() > 0.) hasClustersAfter = true;
957 if (m_debugLevel >= 4) std::cout << " associated" << std::endl;
958 } else {
959 if (m_debugLevel >= 4) std::cout << " dropped" << std::endl;
960 }
961 }
962
963 if (assCls.empty()) return;
964
965 seg.clusters(assCls);
966 unsigned int ncl = 0;
967 if (hasClustersBefore) ++ncl;
968 if (hasClustersAfter) ++ncl;
969 seg.clusterLayers(ncl);
970 }
std::pair< std::vector< unsigned int >, bool > res

◆ associateClusters() [2/2]

void TrkDriftCircleMath::SegmentFinder::associateClusters ( SegVec & segs,
const CLVec & cls ) const
protected

Definition at line 915 of file SegmentFinder.cxx.

915 {
916 // loop over all segments pass to associateClusters
917 SegIt sit = segs.begin();
918 SegIt sit_end = segs.end();
919 for (; sit != sit_end; ++sit) { associateClusters(*sit, cls); }
920 }
void associateClusters(SegVec &segs, const CLVec &cls) const

◆ cleanSegments()

SegVec TrkDriftCircleMath::SegmentFinder::cleanSegments ( const SegVec & segments) const

Definition at line 618 of file SegmentFinder.cxx.

618 {
619 SegVec segments = refitSegments(segs);
620
621 // no segments found return empty segment vector
622 // if only one segment found no further processing needed
623 if (segments.size() <= 1) return segments;
624
625 // vector to hold clean segments
626 SegVec selectedSegments;
627
628 // sort segments
629 if (m_doAllHitSort)
630 std::stable_sort(segments.begin(), segments.end(), SortSegByNumberOfHitsAndChi2());
631 else
632 std::stable_sort(segments.begin(), segments.end(), SortSegByNumberOfMDTHitsAndChi2());
633
634 if (m_debugLevel >= 3) {
635 std::cout << " sorting segments " << std::endl;
636 for (auto & segment : segments) { std::cout << segment << std::endl; }
637 }
638 // first segment is automatically accepted
639 selectedSegments.push_back(segments.front());
640
641 // function object to count number of shared hits between segments
642 SharedHitsSegments sharedHits(false);
643
644 // discard all segments that share hits with the best segment(s)
645 SegIt it = segments.begin() + 1;
646 SegIt it_end = segments.end();
647 for (; it != it_end; ++it) {
648 unsigned int shareHits(0);
649 bool addSeg(true);
650 for (auto & selectedSegment : selectedSegments) {
651 // count number of shared hits
652 shareHits = sharedHits(*it, selectedSegment);
653 if (shareHits != 0) {
654 unsigned int nmdtHitsIt = it->hitsOnTrack();
655 unsigned int nmdtHitsSit = selectedSegment.hitsOnTrack();
656
657 // deal with curved segments
658 if (it->hasCurvatureParameters()) {
659 if (selectedSegment.hasCurvatureParameters()) continue;
660 if (shareHits == it->hitsOnTrack()) {
661 if ((selectedSegment.chi2() < it->chi2()) || (std::abs(it->deltaAlpha()) < 0.01)) {
662 addSeg = false;
663 break;
664 }
665 } else if (selectedSegment.hasCurvatureParameters()) {
666 if (std::abs(it->line().phi() - selectedSegment.line().phi()) < 0.05 &&
667 std::abs(it->deltaAlpha() - selectedSegment.deltaAlpha()) < 0.01) {
668 ResidualWithLine resWithLine(it->line());
669 if (std::abs(resWithLine.residual(selectedSegment.line().position())) < 0.1) {
670 addSeg = false;
671 break;
672 }
673 }
674 } else {
675 // if the curved segment has unique hits, keep both
676 selectedSegment.ambigue(2);
677 continue;
678 }
679 }
680
681 // reject segment if it containes less hits on track
682 if (nmdtHitsSit > nmdtHitsIt) {
683 addSeg = false;
684 break;
685 }
686
687 // reject segment if slected has clusters and current doesn't
688 if (!selectedSegment.clusters().empty() && it->clusters().empty()) {
689 addSeg = false;
690 break;
691 }
692 if (std::abs(it->chi2() - selectedSegment.chi2()) > selectedSegment.hitsOnTrack()) {
693 addSeg = false;
694 break;
695 }
696
697 // if number of hits the same reject if difference in angle smaller 0.05 and distance between lines small 0.1 mm
698 if (std::abs(it->line().phi() - selectedSegment.line().phi()) < 0.05) {
699 ResidualWithLine resWithLine(it->line());
700 if (std::abs(resWithLine.residual(selectedSegment.line().position())) < 0.1) {
701 addSeg = false;
702 break;
703 }
704 }
705
706 // mark segment as ambiguous
707 selectedSegment.ambigue(2);
708 }
709 }
710 if (addSeg) {
711 selectedSegments.push_back(*it);
712 // set number of ambiguities
713 if (shareHits != 0) selectedSegments.back().ambigue(2);
714 }
715 }
716
717 return selectedSegments;
718 }
SegVec refitSegments(const SegVec &segs) const
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.

◆ crossedTubes()

void TrkDriftCircleMath::SegmentFinder::crossedTubes ( Segment & seg) const
protected

Definition at line 795 of file SegmentFinder.cxx.

795 {
796 if (m_mdtGeometry) {
797 // calculated number of passed tubes
798
799 const DCVec ct = m_mdtGeometry->tubesPassedByLine(seg.line());
800 const MatchResult result = m_matchCrossed(seg.dcs(), ct);
801 unsigned int tubesMl1 {0}, tubesMl2 {0};
802 DCOnTrackCit doit = result.first.begin();
803 DCOnTrackCit doit_end = result.first.end();
804 for (; doit != doit_end; ++doit) {
805 if (doit->state() == DCOnTrack::CloseDC) continue;
806
807 if (doit->id().ml() == 0)
808 ++tubesMl1;
809 else
810 ++tubesMl2;
811 }
812
813 DCCit dcit = ct.begin();
814 DCCit dcit_end = ct.end();
815 for (; dcit != dcit_end; ++dcit) {
816 if (dcit->id().ml() == 0)
817 ++tubesMl1;
818 else
819 ++tubesMl2;
820 }
821
822 if (tubesMl1 + tubesMl2 != ct.size() + result.first.size()) {
823 if (m_debugLevel >= 1)
824 std::cout << " ERROR in empty tube calculation: ml1 " << tubesMl1 << " ml2 " << tubesMl2 << " tot "
825 << ct.size() + result.first.size() << std::endl;
826 }
827
828 seg.crossedTubes(tubesMl1, tubesMl2);
829
830 seg.emptyTubes(result.second);
831 if (m_debugLevel >= 1) {
832 if (seg.crossedTubes() != seg.hitsOnTrack() + seg.deltas() + seg.hitsOutOfTime() + seg.emptyTubes().size()) {
833 std::cout << " ---- mismatch!!! " << std::endl;
834 DCCit eit = result.second.begin();
835 DCCit eit_end = result.second.end();
836 for (; eit != eit_end; ++eit) { std::cout << " match result " << *eit << std::endl; }
837 std::cout << seg << std::endl;
838 }
839 }
840 }
841 }
@ CloseDC
too large drift time
Definition DCOnTrack.h:23
const ChamberGeometry * m_mdtGeometry
DCOnTrackVec::const_iterator DCOnTrackCit
Definition DCOnTrack.h:61
std::pair< DCOnTrackVec, DCVec > MatchResult
counts the number of hits shared by the two segments
DCVec::const_iterator DCCit
std::vector< DriftCircle > DCVec

◆ debugLevel()

void TrkDriftCircleMath::SegmentFinder::debugLevel ( int debugLevel)
inline

Definition at line 72 of file SegmentFinder.h.

◆ directionCheck()

bool TrkDriftCircleMath::SegmentFinder::directionCheck ( const LocVec2D & LocVec2D) const
inlineprotected

Definition at line 146 of file SegmentFinder.h.

146 {
147 // check whether the
148 if (m_useRoadPhi) {
149 double prodRoad = lineDir * m_roadDir;
150 if (prodRoad < 0.) prodRoad *= -1.;
151 if (prodRoad > m_phiDifCut) return true;
152 }
153 if (m_useChamberPhi) {
154 double prodChamber = lineDir * m_chamberDir;
155 if (prodChamber < 0.) prodChamber *= -1.;
156 if (prodChamber > m_phiDifCut) return true;
157 }
158 return false;
159 }

◆ dropHits()

bool TrkDriftCircleMath::SegmentFinder::dropHits ( Segment & segment,
bool & hasDroppedHit,
unsigned int & dropDepth ) const

Definition at line 411 of file SegmentFinder.cxx.

411 {
412 if (dropDepth > m_dropDepthMax) {
413 if (m_debugLevel >= 5) {
414 std::cout << " dropDepth too large keeping segment " << segment << std::endl;
415 std::cout << " dropDepth " << dropDepth << std::endl;
416 for (const DCOnTrack& hit : segment.dcs()) {
417 if (segment.hasT0Shift()) {
418 std::cout << " t0 fit residual " << hit.residual() << std::endl;
419 } else {
420 std::cout << " NO t0 fit residual " << hit.residual() << std::endl;
421 }
422 }
423 }
424 if (m_debugLevel > 0) {
425 std::lock_guard<std::mutex> lock(m_mutex);
426 ++m_dropDepthAcceptCounts[dropDepth];
427 }
428 return true;
429 }
430 ++dropDepth;
431
432 if (m_debugLevel >= 5) std::cout << " dropDepth " << dropDepth << " " << segment << std::endl;
433
434 // discard all segments with less then 3 hits
435 if (segment.ndof() <= 0) {
436 --dropDepth;
437 if (m_debugLevel > 0) {
438 std::lock_guard<std::mutex> lock(m_mutex);
439 ++m_dropDepthRejectCounts[dropDepth];
440 }
441 return false;
442 }
443
444 // if chi2/ndof of segment smaller than cut-off:
445 // do dropping for t0 reffited segments if residual > 1 mm or 5 sigma precise errors
446 // for NOT refitted if residual > 3 mm
447 if (segment.chi2() / segment.ndof() < m_chi2Cut) {
448 bool hasBadHit = false;
450 for (const DCOnTrack& hit : segment.dcs()) {
451 if (segment.hasT0Shift()) {
452 double res = std::abs(hit.residual());
453 if (hit.state() == DCOnTrack::OnTrack && (res > m_resCutT0 || res / hit.drPrecise() > m_deltaCutT0)) {
454 hasBadHit = true;
455 break;
456 }
457 } else {
458 if (hit.state() == DCOnTrack::OnTrack && (std::abs(hit.residual()) > m_deltaCut * hit.dr())) {
459 hasBadHit = true;
460 break;
461 }
462 }
463 }
464 }
465
466 if (!hasBadHit) {
467 if (m_debugLevel >= 5) std::cout << " keeping candidate " << segment << std::endl;
468 --dropDepth;
469 if (m_debugLevel > 0) {
470 std::lock_guard<std::mutex> lock(m_mutex);
471 ++m_dropDepthAcceptCounts[dropDepth];
472 }
473 return true;
474 }
475 }
476
477 if (m_debugLevel >= 5) std::cout << " dropHits " << segment << std::endl;
478
479 // if segment has 3 hots and fails cut discard segment
480 if (segment.hitsOnTrack() <= 3) {
481 --dropDepth;
482 if (m_debugLevel > 0) {
483 std::lock_guard<std::mutex> lock(m_mutex);
484 ++m_dropDepthRejectCounts[dropDepth];
485 }
486 return false;
487 }
488
489 // create selection hits for segment
490 HitSelection selection = m_hitSelector.selectHitsOnTrack(segment.dcs());
491
492 // vector to hold results refit
493 SegVec segs;
494 segs.reserve(segment.hitsOnTrack());
495
496 double bestChi2(1e9);
497 int indexBest(-1);
498
499 MatchDCWithLine matchWithLine;
500
501 // loop over selection and refit without hit
502 for (unsigned int i = 0; i < selection.size(); ++i) {
503 // if this is a hot
504 if (selection[i] == 0) {
505 // unselect hit
506 selection[i] = 1;
507
508 // refit segment
509 Segment result(Line(0., 0., 0.), DCOnTrackVec());
510 if (!m_fitter->fit(result, segment.line(), segment.dcs(), selection)) {
511 if (m_debugLevel >= 5) std::cout << " failed fit (dropHits) " << std::endl;
512 } else {
513 if (m_debugLevel >= 5) std::cout << " dropping hit " << i << " " << segment.dcs()[i] << std::endl;
514
515 // add segment to vector
516 segs.push_back(std::move(result));
517 Segment& newSegment = segs.back();
518
519 // find all hits within cut-off
520 matchWithLine.set(newSegment.line(), 0.7 * m_deltaCut, MatchDCWithLine::Pull, tubeRadius());
521 bool usePrecise = newSegment.hasT0Shift();
522 DCOnTrackVec hitsOnLine = matchWithLine.match(newSegment.dcs(), &selection, m_recoverMdtHits, usePrecise);
523
524 // if less then three hits left drop segment
525 if (matchWithLine.hitsOnTrack() <= 2) {
526 // reset flag
527 selection[i] = 0;
528 segs.pop_back(); // remove segment from vector
529 continue;
530 }
531
532 // reset DCOnTracks
533 newSegment.dcs(hitsOnLine);
534
535 // check if number of hits used in fit equal to number of hits within 5 sigma of fit result
536 if (matchWithLine.matchDifference() > 0) {
537 if (m_debugLevel >= 5) {
538 std::cout << " Hits on track content changed after match, redoing fit " << matchWithLine.hitsOnTrack()
539 << std::endl;
540 std::cout << " fit result " << newSegment << std::endl;
541 }
542 // redo refit using new prediction
543 if (!m_fitter->fit(result, newSegment.line(), newSegment.dcs(),
544 m_hitSelector.selectHitsOnTrack(newSegment.dcs()))) {
545 if (m_debugLevel >= 5) std::cout << " failed fit (dropHits2) " << std::endl;
546 // reset flag
547 selection[i] = 0;
548 segs.pop_back(); // remove segment from vector
549 continue;
550 } else {
551 matchWithLine.set(result.line(), 0.7 * m_deltaCut, MatchDCWithLine::Pull, tubeRadius());
552 usePrecise = result.hasT0Shift();
553 hitsOnLine = matchWithLine.match(result.dcs(), &selection, m_recoverMdtHits, usePrecise);
554 newSegment = result;
555 // reset DCOnTracks
556 newSegment.dcs(hitsOnLine);
557 if (m_debugLevel >= 5) std::cout << " redid refit " << newSegment << std::endl;
558 }
559 }
560
561 // update match parameters
562 updateMatch(segs.back(), matchWithLine);
563
564 // keep close hits from initial road as information is not available anymore and shouldn't change to much
565 segs.back().showerHits(segment.showerHits()); // copy showerHits of initial road
566
567 // keep clusters
568 segs.back().clusters(segment.clusters()); // copy clusters of initial road
569 segs.back().clusterLayers(segment.clusterLayers());
570
571 // update crossed tubes
572 crossedTubes(segs.back());
573
574 // remove segments with bad onTrack/emptyTube ratio
575 if (!goodHitRatio(segs.back())) {
576 // reset flag
577 selection[i] = 0;
578 continue;
579 }
580
581 // flag best candidate
582 double chi2 = segs.back().chi2();
583 if (m_useSegmentQuality) chi2 += 5.1 * (segs.back().hitsOutOfTime() + segs.back().emptyTubes().size());
584 if (segs.empty() || bestChi2 > chi2) {
585 bestChi2 = chi2;
586 indexBest = segs.size() - 1;
587 }
588
589 if (m_debugLevel >= 5) std::cout << " fit result " << segs.back() << std::endl;
590 }
591
592 // reset flag
593 selection[i] = 0;
594 }
595 }
596
597 // if we get here we performed hit dropping
598 hasDroppedHit = true;
599
600 if (indexBest == -1) {
601 if (m_debugLevel >= 5) std::cout << " not good candidate found " << std::endl;
602 --dropDepth;
603 if (m_debugLevel > 0) {
604 std::lock_guard<std::mutex> lock(m_mutex);
605 ++m_dropDepthRejectCounts[dropDepth];
606 }
607 return false;
608 }
609
610 segment = segs[indexBest];
611 if (m_debugLevel >= 5) std::cout << " best candidate " << segment << std::endl;
612
613 bool drop = dropHits(segment, hasDroppedHit, dropDepth);
614 --dropDepth;
615 return drop;
616 }
bool hit(const Container &ids, int pdgId)
bool dropHits(Segment &segment, bool &hasDroppedHit, unsigned int &dropDepth) const
bool goodHitRatio(Segment &seg) const
static void updateMatch(Segment &seg, MatchDCWithLine &matchWithLine)
void crossedTubes(Segment &seg) const
double chi2(TH1 *h0, TH1 *h1)
const std::string selection
std::vector< bool > HitSelection
Definition HitSelection.h:9
std::vector< DCOnTrack > DCOnTrackVec
Definition DCOnTrack.h:59

◆ emptyCrossedTubes()

unsigned int TrkDriftCircleMath::SegmentFinder::emptyCrossedTubes ( const Line & line,
const DCVec & closeEmptyTubes ) const
protected

◆ emptyNeighbours()

DCVec TrkDriftCircleMath::SegmentFinder::emptyNeighbours ( const DCVec & dcs) const
protected

◆ findSegments() [1/2]

SegVec TrkDriftCircleMath::SegmentFinder::findSegments ( const DCVec & dcs) const

Definition at line 124 of file SegmentFinder.cxx.

124 {
126 return findSegments(dcsIn, clusters);
127 }
SegVec findSegments(const DCVec &dcs) const

◆ findSegments() [2/2]

SegVec TrkDriftCircleMath::SegmentFinder::findSegments ( const DCVec & dcs,
const CLVec & clusters ) const

Definition at line 227 of file SegmentFinder.cxx.

227 {
228 // prepare segment collection
229 ResolvedCollection<Segment, IsSubsetSegment<SortDcsByY>> segments;
230
231 // find segments
232 handleHits(dcsIn, clsIn, segments);
233
234 // Curved Segment finder
236 CurvedSegmentFinder CurvedSegFinder(m_debugLevel);
237 CurvedSegFinder.curvedSegments(*m_mdtGeometry, segments.data());
238 } else if (m_debugLevel >= 5 && m_doCurvedSegmentFinder)
239 std::cout << "CurvedSegmentFinder was passed a NULL pointer to the ChamberGeometry" << std::endl;
240
241 SegVec selectedSegments;
242
243 // final cleaning of segments
244 cleanSegments(segments.data()).swap(selectedSegments);
245
246 // redo cluster association with final tracks
247 associateClusters(selectedSegments, clsIn);
248
249 if (m_debugLevel >= 1) {
250 std::cout << " final segments " << std::endl;
251 for (auto & selectedSegment : selectedSegments) { std::cout << selectedSegment << std::endl; }
252 }
253
254 return selectedSegments;
255 }
void handleHits(const DCVec &dcs, const CLVec &clusters, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const
SegVec cleanSegments(const SegVec &segments) const

◆ fullScan()

void TrkDriftCircleMath::SegmentFinder::fullScan ( const DCVec & seeds,
const DCVec & dcs,
const CLVec & cls,
ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > & segments ) const
protected

Definition at line 867 of file SegmentFinder.cxx.

868 {
869 MatchDCWithLine matchWithLine;
870
871 // use all combinations of segments as seed
872
873 // hack for bug #45261, should be properly fixed!
874 if (seeds.size() > 50) return;
875
876 for (DCCit it = seeds.begin(); it != seeds.end(); ++it) {
877 for (DCVec::const_reverse_iterator rit = seeds.rbegin(); rit != seeds.rend(); ++rit) {
878 // break of inner loop when *it == *rit
879 if (std::distance(seeds.begin(), it) >= std::distance(rit, seeds.rend() - 1)) break;
880
881 // hits in the same ml are not combined
882 if (std::abs(it->position().y() - rit->position().y()) < 1.) break;
883
884 // find segments using the two seeds
885 handleSeedPair(*it, *rit, dcs, cls, matchWithLine, segments);
886 }
887 }
888 }
void handleSeedPair(const DriftCircle &seed1, const DriftCircle &seeds2, const DCVec &dcs, const CLVec &cls, MatchDCWithLine &matchWithLine, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const

◆ goodHitRatio()

bool TrkDriftCircleMath::SegmentFinder::goodHitRatio ( Segment & seg) const
protected

Definition at line 972 of file SegmentFinder.cxx.

972 {
973 if (!m_mdtGeometry) return true;
974 bool good = (double)(seg.crossedTubes() - seg.hitsOnTrack()) < m_ratioEmptyTubesCut * seg.hitsOnTrack();
975 if (!good) {
976 if (seg.hitsMl1() == 0) {
977 good = (double)(seg.crossedTubesMl2() - seg.hitsMl2()) < m_ratioEmptyTubesCut * seg.hitsMl2();
978 } else if (seg.hitsMl2() == 0) {
979 good = (double)(seg.crossedTubesMl1() - seg.hitsMl1()) < m_ratioEmptyTubesCut * seg.hitsMl1();
980 }
981 }
982 return good;
983 }

◆ handleHits()

void TrkDriftCircleMath::SegmentFinder::handleHits ( const DCVec & dcs,
const CLVec & clusters,
ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > & segments ) const

Definition at line 152 of file SegmentFinder.cxx.

153 {
154 DCVec dcs = dcsIn;
155
156 if (m_debugLevel >= 1) {
157 std::cout << "In handleHits: dcs " << dcsIn.size() << " clusters " << clsIn.size() << std::endl;
159 }
160 // sort input drift circles
161 std::stable_sort(dcs.begin(), dcs.end(), SortDcsByY());
162
163 SegVec preSelSegs;
164 if (!m_fullScan) {
165 // find seeds in multilayer
166 std::pair<DCVec, DCVec> dcsPerMl = splitInMulitlayers(dcs);
167
168 DCVec seedsMl1;
169 DCVec seedsMl2;
170
171 if (m_seedCleaning) {
172 // remove triples or larger ranges per layer
173 selectSeeds(dcsPerMl.first, 3).swap(seedsMl1);
174 selectSeeds(dcsPerMl.second, 3).swap(seedsMl2);
175 } else {
176 seedsMl1 = dcsPerMl.first;
177 seedsMl2 = dcsPerMl.second;
178 }
179
180 // search for segments crossing both multilayers
181 twoMultiLayerScan(seedsMl1, seedsMl2, dcs, clsIn, segments);
182
183 if (m_debugLevel >= 1) {
184 std::cout << " two layer scan " << std::endl;
185 for (const auto & it : segments.data()) { std::cout << " " << it << std::endl; }
186 }
187
188 // reset segments so it contains only the cleaned segments
189 cleanSegments(segments.data()).swap(preSelSegs);
190 segments.set(preSelSegs);
191
192 if (m_debugLevel >= 1) {
193 std::cout << " after cleaning " << std::endl;
194 for (const auto & it : segments.data()) { std::cout << " " << it << std::endl; }
195 }
196
197 unsigned int usedHits(0);
198 for (const auto & it : segments.data()) { usedHits += it.hitsOnTrack(); }
199
200 // if remaining dcs not associated with selected track smaller then 2 no additional segments can be formed
201 // thus no further search in single multi layers is needed
202 if ((usedHits >= dcs.size() - 2 && !m_doCurvedSegmentFinder) || !m_singleMultiLayerScan) {
203 } else {
204 // full combinatorics in single ml
205 fullScan(seedsMl1, dcsPerMl.first, clsIn, segments);
206
207 if (m_debugLevel >= 1) {
208 std::cout << " segments after scan multilayer 1 " << std::endl;
209 for (const auto & it : segments.data()) { std::cout << " " << it << std::endl; }
210 }
211
212 fullScan(seedsMl2, dcsPerMl.second, clsIn, segments);
213
214 if (m_debugLevel >= 1) {
215 std::cout << " segments after scan multilayer 2 " << std::endl;
216 for (const auto & it : segments.data()) { std::cout << " " << it << std::endl; }
217 }
218 }
219
220 } else {
221 // remove triples or larger ranges per layer
222 DCVec seeds = selectSeeds(dcs, 3);
223 fullScan(seeds, dcs, clsIn, segments);
224 }
225 }
void printSettings() const
print settings
static DCVec selectSeeds(const DCVec &dcs, int maxSerie)
static std::pair< DCVec, DCVec > splitInMulitlayers(const DCVec &dcs)
void twoMultiLayerScan(const DCVec &seeds_ml1, const DCVec &seeds_ml2, const DCVec &dcs, const CLVec &cls, ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > &segments) const

◆ handleSeedPair()

void TrkDriftCircleMath::SegmentFinder::handleSeedPair ( const DriftCircle & seed1,
const DriftCircle & seeds2,
const DCVec & dcs,
const CLVec & cls,
MatchDCWithLine & matchWithLine,
ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > & segments ) const
protected

Definition at line 720 of file SegmentFinder.cxx.

722 {
723 // create tangent lines
725
726 // loop over tangent lines match dcs with line
727 for (const auto & line : lines) {
728 // only accept segments with reasonable angle
729 if (!directionCheck(line.direction())) {
730 if (m_debugLevel >= 19) {
731 std::cout << " failed direction cut " << line.direction() * m_roadDir << " line: " << line.phi() << " road "
732 << atan2(m_roadDir.y(), m_roadDir.x()) << " chamber " << atan2(m_chamberDir.y(), m_chamberDir.x())
733 << std::endl;
734 }
735 continue;
736 }
737 matchWithLine.set(line, m_roadWidth, MatchDCWithLine::Road, tubeRadius());
738 const DCOnTrackVec& hitsOnLine = matchWithLine.match(dcs);
739
740 if (matchWithLine.hitsOnTrack() <= 2) {
741 if (m_debugLevel >= 19) { std::cout << " too few hits associated " << matchWithLine.hitsOnTrack() << std::endl; }
742 continue;
743 }
744 if (matchWithLine.hitsOutOfTime() + matchWithLine.deltas() >= matchWithLine.hitsOnTrack()) {
745 if (m_debugLevel >= 19) {
746 std::cout << " too many outliers: hoo " << matchWithLine.hitsOutOfTime() << " delta " << matchWithLine.deltas()
747 << " hot " << matchWithLine.hitsOnTrack() << std::endl;
748 }
749 continue;
750 }
751
752 Segment result(Line(0., 0., 0.), DCOnTrackVec());
753 if (!m_fitter->fit(result, line, hitsOnLine, m_hitSelector.selectHitsOnTrack(hitsOnLine))) {
754 if (m_debugLevel >= 3) std::cout << " failed fit " << std::endl;
755 continue;
756 }
757
758 // also apply direction cuts on output
759 if (!directionCheck(result.line().direction())) {
760 if (m_debugLevel >= 19) {
761 std::cout << " failed direction cut (2) " << result.line().direction() * m_roadDir << " line: " << result.line().phi()
762 << " road " << atan2(m_roadDir.y(), m_roadDir.x()) << " chamber " << atan2(m_chamberDir.y(), m_chamberDir.x())
763 << std::endl;
764 }
765 continue;
766 }
767 Segment seg = result;
768
769 // update match parameters
770 updateMatch(seg, matchWithLine);
771
772 // add shower hits
773 seg.showerHits(matchWithLine.showerHits());
774
775 // associate clusters with segment
776
777 // hack for avoiding bad alloc problem (bug 45261), should be properly fixed!
778 if (cls.size() < 500) { associateClusters(seg, cls); }
779 // calculate crossed tubes
780 crossedTubes(seg);
781
782 // remove segments with bad onTrack/emptyTube ratio
783 if (!goodHitRatio(seg)) {
784 if (m_debugLevel >= 3) std::cout << " candidate dropped due to hit ratio " << seg << std::endl;
785 continue;
786 }
787
788 if (m_debugLevel >= 3) { std::cout << " new segment candidate " << seg << std::endl; }
789
790 // add segment to collection
791 segments.insert(seg);
792 }
793 }
bool directionCheck(const LocVec2D &LocVec2D) const
static LineVec tangentLines(const DriftCircle &dc1, const DriftCircle &dc2)

◆ operator=()

SegmentFinder & TrkDriftCircleMath::SegmentFinder::operator= ( const SegmentFinder & )
delete

assignment deleted to prevent ownership/leak issues

◆ printSettings()

void TrkDriftCircleMath::SegmentFinder::printSettings ( ) const
protected

print settings

Definition at line 129 of file SegmentFinder.cxx.

129 {
130 std::cout << " SegmentFinder::setting: " << std::endl
131 << " Road width " << m_roadWidth << " Pull cuts: MDT " << m_deltaCut << " RPC " << m_rpcPullCut << " TGC "
132 << m_tgcPullCut << std::endl
133 << " Phi seed " << m_phiRoad;
134
135 if (m_useChamberPhi) std::cout << " chamberCut";
136 if (m_useRoadPhi) std::cout << " roadCut";
137
138 if (m_useChamberPhi || m_useRoadPhi) std::cout << " phi cut " << m_phiDifCut << std::endl;
139
140 std::cout << " Empty tube ratio cut " << m_ratioEmptyTubesCut << " chi2 drop cut " << m_chi2Cut << std::endl;
141 std::cout << " Options: ";
142 if (m_fullScan) std::cout << " -- full scan ";
143 if (m_singleMultiLayerScan) std::cout << " -- single multilayer scan ";
144 if (m_seedCleaning) std::cout << " -- seed cleaning ";
145 if (m_doDrop) std::cout << " -- drop hits ";
146 if (m_doAllHitSort) std::cout << " -- sort with all hits ";
147 if (m_doCurvedSegmentFinder) std::cout << " -- curved segment finder ";
148 if (m_mdtGeometry) std::cout << " -- using geometry ";
149 std::cout << std::endl;
150 }

◆ refitSegments()

SegVec TrkDriftCircleMath::SegmentFinder::refitSegments ( const SegVec & segs) const

Copy the segment due to dropHits in line 324

Make a copy of the segment

Definition at line 307 of file SegmentFinder.cxx.

307 {
308 // no segments found return empty segment vector
309 if (segs.empty()) return segs;
310
311 MatchDCWithLine matchWithLine;
312
313 SegVec segments;
314 segments.reserve(segs.size());
315
316 if (m_debugLevel >= 3) { std::cout << " refitting segments " << std::endl; }
317
319 for (const Segment& inSegment : segs) {
320 // keep all curved segments
321 if (inSegment.hasCurvatureParameters()) {
322 segments.emplace_back(inSegment);
323 continue;
324 }
326 Segment resultSeg{inSegment};
327
328 // drop hits is switched on
329 bool goodSeg{true}, hasDroppedHit{false};
330 unsigned int dropDepth = 0;
331 if (m_doDrop) goodSeg = dropHits(resultSeg, hasDroppedHit, dropDepth);
332
333 if (goodSeg) {
334 if (!hasDroppedHit && !m_removeSingleOutliers) {
335 // if the segment was accepted without dropping we still have to refit it
336
337 // find all hits within cut-off
338 matchWithLine.set(inSegment.line(), m_deltaCut, MatchDCWithLine::Pull, tubeRadius());
339 bool usePrecise = resultSeg.hasT0Shift();
340 const DCOnTrackVec& hitsOnLine = matchWithLine.match(inSegment.dcs(), nullptr, m_recoverMdtHits, usePrecise);
341
342 if (matchWithLine.matchDifference() > 0) {
343 if (m_debugLevel >= 4) {
344 std::cout << " -- " << inSegment;
345 std::cout << " -- new DCS " << hitsOnLine.size() << std::endl;
346 for (const DCOnTrack& cit : hitsOnLine) { std::cout << " " << cit << std::endl; }
347 }
348
349 // reject segment if less then 3 hits remain
350 if (matchWithLine.hitsOnTrack() <= 2) { continue; }
351
352 // refit segment
353 Segment result(Line(0., 0., 0.), DCOnTrackVec());
354 if (inSegment.hasT0Shift()) {
355 if (!m_fitter->fit(result, inSegment.line(), hitsOnLine, m_hitSelector.selectHitsOnTrack(hitsOnLine),
356 inSegment.t0Shift())) {
357 if (m_debugLevel >= 4) std::cout << " failed fit " << std::endl;
358 continue;
359 }
360 } else {
361 if (!m_fitter->fit(result, inSegment.line(), hitsOnLine, m_hitSelector.selectHitsOnTrack(hitsOnLine))) {
362 if (m_debugLevel >= 4) std::cout << " failed fit " << std::endl;
363 continue;
364 }
365 }
366 if (m_debugLevel >= 4) {
367 std::cout << " after fit " << std::endl;
368 std::cout << result << std::endl;
369 }
370 resultSeg = result;
371
372 // update match parameters
373 updateMatch(resultSeg, matchWithLine);
374
375 // keep close hits from initial road as information is not available anymore and shouldn't change to much
376 resultSeg.showerHits(inSegment.showerHits()); // copy showerHits of initial road
377
378 // keep clusters
379 resultSeg.clusters(inSegment.clusters()); // copy clusters of initial road
380
381 // update crossed tubes
382 crossedTubes(resultSeg);
383
384 // check hit ratio
385 if (!goodHitRatio(resultSeg)) continue;
386
387 // once more do dropping
388 if (m_doDrop) goodSeg = dropHits(resultSeg, hasDroppedHit, dropDepth);
389
390 if (!goodSeg) {
391 if (m_debugLevel >= 2) { std::cout << " segment lossed after refit and dropping " << resultSeg << std::endl; }
392 continue;
393 }
394 }
395 }
396
397 // update segment parameters
398 segments.emplace_back(std::move(resultSeg));
399 if (m_debugLevel >= 2) {
400 std::cout << " new segment added " << segments.size() << std::endl;
401 std::cout << segments.back() << std::endl;
402 }
403 } else {
404 if (m_debugLevel >= 2) std::cout << " segment lost during hit dropping " << std::endl;
405 }
406 }
407
408 return segments;
409 }

◆ removeDCOnSegments()

DCVec TrkDriftCircleMath::SegmentFinder::removeDCOnSegments ( const DCVec & dcs,
const SegVec & segs )
staticprotected

Definition at line 890 of file SegmentFinder.cxx.

890 {
891 if (segs.empty()) return dcs;
892
893 DCVec newdcs;
894
895 SameTube sameTube;
896
897 DCCit dit = dcs.begin();
898 DCCit dit_end = dcs.end();
899
900 for (; dit != dit_end; ++dit) {
901 bool found(false);
902 for (const auto & seg : segs) {
903 DCOnTrackCit pos = std::lower_bound(seg.dcs().begin(), seg.dcs().end(), *dit, SortDcsByY());
904 if (pos != seg.dcs().end() && pos->state() != DCOnTrack::CloseDC && sameTube(*pos, *dit)) {
905 found = true;
906 break;
907 }
908 }
909 if (!found) { newdcs.push_back(*dit); }
910 }
911
912 return newdcs;
913 }

◆ selectSeeds()

DCVec TrkDriftCircleMath::SegmentFinder::selectSeeds ( const DCVec & dcs,
int maxSerie )
staticprotected

Definition at line 270 of file SegmentFinder.cxx.

270 {
271 // this algorithm assumes a sorted collection!!
272 if (dcs.size() <= 2) return dcs;
273
274 DCVec seeds;
275
276 NeighbourTube isNeighbour;
277
278 DCCit it_start_serie;
279 DCCit it = dcs.begin();
280 DCCit it_end = dcs.end() - 1;
281
282 while (it <= it_end) {
283 // mark first entry as start serie
284 it_start_serie = it;
285
286 // loop over next entries until an entry is no neighbour or we reached the end of the data set
287 while (it != it_end && isNeighbour(*it, *(it + 1))) { ++it; }
288
289 // if less then 2 neighbours found, add hits to seeds
290 if (std::distance(it_start_serie, it + 1) < maxSerie) {
291 // add new seeds
292 for (; it_start_serie != it + 1; ++it_start_serie) {
293 // only fill hits that are "in time"
294 if (it_start_serie->driftState() == DriftCircle::InTime) { seeds.push_back(*it_start_serie); }
295 }
296 }
297 // all other combinations are not taken into account
298
299 // if we reached the end of the data set quit loop
300 if (it == dcs.end()) break;
301 ++it;
302 }
303
304 return seeds;
305 }
@ InTime
drift time too small to be compatible with drift spectrum
Definition DriftCircle.h:27

◆ setChi2DropCut()

void TrkDriftCircleMath::SegmentFinder::setChi2DropCut ( double chi2)

Definition at line 81 of file SegmentFinder.cxx.

81{ m_chi2Cut = chi2; }

◆ setCurvedSegmentFinder()

void TrkDriftCircleMath::SegmentFinder::setCurvedSegmentFinder ( bool doCurvedSegmentFinder)

Definition at line 69 of file SegmentFinder.cxx.

69{ m_doCurvedSegmentFinder = doCurvedSegmentFinder; }

◆ setDeltaCut()

void TrkDriftCircleMath::SegmentFinder::setDeltaCut ( double cut)

Definition at line 83 of file SegmentFinder.cxx.

◆ setDeltaCutT0()

void TrkDriftCircleMath::SegmentFinder::setDeltaCutT0 ( double deltaCut)

Definition at line 63 of file SegmentFinder.cxx.

63{ m_deltaCutT0 = deltaCut; }

◆ setDropHits()

void TrkDriftCircleMath::SegmentFinder::setDropHits ( bool doDrop)

Definition at line 77 of file SegmentFinder.cxx.

77{ m_doDrop = doDrop; }

◆ setFitter()

void TrkDriftCircleMath::SegmentFinder::setFitter ( std::shared_ptr< const DCSLFitter > fitter)
inline

Definition at line 66 of file SegmentFinder.h.

66{ m_fitter = std::move(fitter); }

◆ setMaxDropDepth()

void TrkDriftCircleMath::SegmentFinder::setMaxDropDepth ( int max)

Definition at line 48 of file SegmentFinder.cxx.

48 {
50 std::lock_guard<std::mutex> lock(m_mutex);
51 m_dropDepthAcceptCounts.clear();
52 m_dropDepthAcceptCounts.resize(max + 1, 0);
53 m_dropDepthRejectCounts.clear();
54 m_dropDepthRejectCounts.resize(max + 1, 0);
55 }
#define max(a, b)
Definition cfImp.cxx:41

◆ setMdtGeometry()

void TrkDriftCircleMath::SegmentFinder::setMdtGeometry ( const ChamberGeometry * mdtGeo)
inline

Definition at line 60 of file SegmentFinder.h.

60{ m_mdtGeometry = mdtGeo; }

◆ setPhiRoad()

void TrkDriftCircleMath::SegmentFinder::setPhiRoad ( double phiRoad,
double phiChamber,
double sinPhiCut = 0.2,
bool useRoadPhi = true,
bool useChamberPhi = true )

Definition at line 89 of file SegmentFinder.cxx.

89 {
90 // set road
91 m_phiRoad = phiRoad;
92
93 // set phi chamber
94 m_phiChamber = phiChamber;
95
96 // set road cut
97 m_phiDifCut = sinPhiCut;
98
99 m_useRoadPhi = useRoadPhi;
100 m_useChamberPhi = useChamberPhi;
101
102 // update the cached directions
104 }

◆ setRatioEmptyTubesCut()

void TrkDriftCircleMath::SegmentFinder::setRatioEmptyTubesCut ( double ratioEmptyTubesCut)

Definition at line 87 of file SegmentFinder.cxx.

87{ m_ratioEmptyTubesCut = ratioEmptyTubesCut; }

◆ setRecoverMDT()

void TrkDriftCircleMath::SegmentFinder::setRecoverMDT ( bool doRecover)

Definition at line 57 of file SegmentFinder.cxx.

57{ m_recoverMdtHits = doRecover; }

◆ setRemoveSingleOutliers()

void TrkDriftCircleMath::SegmentFinder::setRemoveSingleOutliers ( bool removeSingleOutliers)

Definition at line 71 of file SegmentFinder.cxx.

71{ m_removeSingleOutliers = removeSingleOutliers; }

◆ setResidualCutT0()

void TrkDriftCircleMath::SegmentFinder::setResidualCutT0 ( double resCut)

Definition at line 61 of file SegmentFinder.cxx.

61{ m_resCutT0 = resCut; }

◆ setRPCPullCut()

void TrkDriftCircleMath::SegmentFinder::setRPCPullCut ( double cut)

Definition at line 75 of file SegmentFinder.cxx.

75{ m_rpcPullCut = cut; }

◆ setSeedCleaning()

void TrkDriftCircleMath::SegmentFinder::setSeedCleaning ( bool doCleanup)

Definition at line 79 of file SegmentFinder.cxx.

79{ m_seedCleaning = doCleanup; }

◆ setSingleMultiLayerScan()

void TrkDriftCircleMath::SegmentFinder::setSingleMultiLayerScan ( bool doScan)

Definition at line 85 of file SegmentFinder.cxx.

85{ m_singleMultiLayerScan = doScan; }

◆ setSortSegmentsUsingAllHits()

void TrkDriftCircleMath::SegmentFinder::setSortSegmentsUsingAllHits ( bool doAllHitsSort)

Definition at line 59 of file SegmentFinder.cxx.

59{ m_doAllHitSort = doAllHitsSort; }

◆ setTGCPullCut()

void TrkDriftCircleMath::SegmentFinder::setTGCPullCut ( double cut)

Definition at line 73 of file SegmentFinder.cxx.

73{ m_tgcPullCut = cut; }

◆ setUseChamberPhi()

void TrkDriftCircleMath::SegmentFinder::setUseChamberPhi ( bool useChamberPhi)

Definition at line 67 of file SegmentFinder.cxx.

67{ m_useChamberPhi = useChamberPhi; }

◆ setUseSegmentQuality()

void TrkDriftCircleMath::SegmentFinder::setUseSegmentQuality ( bool useQ)

Definition at line 65 of file SegmentFinder.cxx.

65{ m_useSegmentQuality = useQ; }

◆ splitInMulitlayers()

std::pair< DCVec, DCVec > TrkDriftCircleMath::SegmentFinder::splitInMulitlayers ( const DCVec & dcs)
staticprotected

Definition at line 257 of file SegmentFinder.cxx.

257 {
258 DCVec ml1, ml2;
259 ml1.reserve(dcs.size());
260 ml2.reserve(dcs.size());
261 for (const DriftCircle& circ : dcs) {
262 if (circ.id().ml() == 0)
263 ml1.emplace_back(circ);
264 else
265 ml2.emplace_back(circ);
266 }
267 return std::make_pair(std::move(ml1), std::move(ml2));
268 }

◆ tubeRadius()

double TrkDriftCircleMath::SegmentFinder::tubeRadius ( ) const
inlineprotected

Definition at line 105 of file SegmentFinder.h.

105{ return m_mdtGeometry ? m_mdtGeometry->tubeRadius() : 14.6; }

◆ twoMultiLayerScan()

void TrkDriftCircleMath::SegmentFinder::twoMultiLayerScan ( const DCVec & seeds_ml1,
const DCVec & seeds_ml2,
const DCVec & dcs,
const CLVec & cls,
ResolvedCollection< Segment, IsSubsetSegment< SortDcsByY > > & segments ) const
protected

Definition at line 851 of file SegmentFinder.cxx.

852 {
853 MatchDCWithLine matchWithLine;
854
855 // hack for bug #45261, should be properly fixed!
856 if (seeds_ml1.size() * seeds_ml2.size() > 2500) return;
857
858 // combine a dc from the first set with a dc from the second set
859 for (const auto & it1 : seeds_ml1) {
860 for (DCVec::const_reverse_iterator it2 = seeds_ml2.rbegin(); it2 != seeds_ml2.rend(); ++it2) {
861 // find segments using the two seeds
862 handleSeedPair(it1, *it2, dcs, cls, matchWithLine, segments);
863 }
864 }
865 }

◆ updateDirections()

void TrkDriftCircleMath::SegmentFinder::updateDirections ( )
protected

update the cached values for the phi road and chamber road

Definition at line 106 of file SegmentFinder.cxx.

106 {
107 m_roadDir = LocVec2D(std::cos(m_phiRoad), std::sin(m_phiRoad));
108 m_chamberDir = LocVec2D(std::cos(m_phiChamber), std::sin(m_phiChamber));
109
110 // set road cut
111 m_phiDifCut = std::cos(m_phiDifCut);
112
113 Line roadLine(LocVec2D(0., 0.), m_roadDir);
114 if (roadLine.phi() != m_phiRoad) {
115 if (m_debugLevel >= 1) std::cout << " bad phi for road: road " << m_phiRoad << " dir phi " << roadLine.phi() << std::endl;
116 }
117 Line chamberLine(LocVec2D(0., 0.), m_chamberDir);
118 if (chamberLine.phi() != m_phiChamber) {
119 if (m_debugLevel >= 1)
120 std::cout << " bad phi for chamber: chamber " << m_phiChamber << " dir phi " << chamberLine.phi() << std::endl;
121 }
122 }

◆ updateMatch()

void TrkDriftCircleMath::SegmentFinder::updateMatch ( Segment & seg,
MatchDCWithLine & matchWithLine )
staticprotected

Definition at line 843 of file SegmentFinder.cxx.

843 {
844 seg.deltas(matchWithLine.deltas());
845 seg.hitsOutOfTime(matchWithLine.hitsOutOfTime());
846 seg.hitsOnTrack(matchWithLine.hitsOnTrack());
847 seg.hitsPerMl(matchWithLine.hitsMl1(), matchWithLine.hitsMl2());
848 seg.closeHits(matchWithLine.closeHits());
849 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

std::vector<int> m_dropDepthRejectCounts TrkDriftCircleMath::SegmentFinder::ATLAS_THREAD_SAFE {(int)m_dropDepthMax + 1, 0}
mutableprotected

Definition at line 142 of file SegmentFinder.h.

142{(int)m_dropDepthMax + 1, 0}; // Guarded by m_mutex

◆ ATLAS_THREAD_SAFE [2/2]

std::vector<int> m_dropDepthAcceptCounts TrkDriftCircleMath::SegmentFinder::ATLAS_THREAD_SAFE {(int)m_dropDepthMax + 2, 0}
mutableprotected

Definition at line 141 of file SegmentFinder.h.

141{(int)m_dropDepthMax + 2, 0}; // Guarded by m_mutex

◆ m_chamberDir

LocVec2D TrkDriftCircleMath::SegmentFinder::m_chamberDir {0., 0.}
protected

Definition at line 112 of file SegmentFinder.h.

112{0., 0.};

◆ m_chi2Cut

double TrkDriftCircleMath::SegmentFinder::m_chi2Cut {10}
protected

Definition at line 116 of file SegmentFinder.h.

116{10};

◆ m_debugLevel

int TrkDriftCircleMath::SegmentFinder::m_debugLevel {0}
protected

Definition at line 139 of file SegmentFinder.h.

139{0};

◆ m_deltaCut

double TrkDriftCircleMath::SegmentFinder::m_deltaCut {5.}
protected

Definition at line 107 of file SegmentFinder.h.

107{5.};

◆ m_deltaCutT0

double TrkDriftCircleMath::SegmentFinder::m_deltaCutT0 {5.}
protected

Definition at line 120 of file SegmentFinder.h.

120{5.};

◆ m_doAllHitSort

bool TrkDriftCircleMath::SegmentFinder::m_doAllHitSort {false}
protected

Definition at line 134 of file SegmentFinder.h.

134{false};

◆ m_doCurvedSegmentFinder

bool TrkDriftCircleMath::SegmentFinder::m_doCurvedSegmentFinder {false}
protected

Definition at line 135 of file SegmentFinder.h.

135{false};

◆ m_doDrop

bool TrkDriftCircleMath::SegmentFinder::m_doDrop {true}
protected

Definition at line 132 of file SegmentFinder.h.

132{true};

◆ m_dropDepthMax

unsigned int TrkDriftCircleMath::SegmentFinder::m_dropDepthMax {4}
protected

Definition at line 133 of file SegmentFinder.h.

133{4};

◆ m_fitter

std::shared_ptr<const DCSLFitter> TrkDriftCircleMath::SegmentFinder::m_fitter
protected

Definition at line 124 of file SegmentFinder.h.

◆ m_fullScan

bool TrkDriftCircleMath::SegmentFinder::m_fullScan {false}
protected

Definition at line 129 of file SegmentFinder.h.

129{false};

◆ m_hitSelector

DCSLHitSelector TrkDriftCircleMath::SegmentFinder::m_hitSelector
protected

Definition at line 125 of file SegmentFinder.h.

◆ m_matchCrossed

MatchCrossedTubes TrkDriftCircleMath::SegmentFinder::m_matchCrossed
protected

Definition at line 126 of file SegmentFinder.h.

◆ m_mdtGeometry

const ChamberGeometry* TrkDriftCircleMath::SegmentFinder::m_mdtGeometry {nullptr}
protected

Definition at line 138 of file SegmentFinder.h.

138{nullptr};

◆ m_mutex

std::mutex TrkDriftCircleMath::SegmentFinder::m_mutex
mutableprotected

Definition at line 143 of file SegmentFinder.h.

◆ m_phiChamber

double TrkDriftCircleMath::SegmentFinder::m_phiChamber {M_PI_2}
protected

Definition at line 111 of file SegmentFinder.h.

111{M_PI_2};

◆ m_phiDifCut

double TrkDriftCircleMath::SegmentFinder::m_phiDifCut {0.5}
protected

Definition at line 114 of file SegmentFinder.h.

114{0.5};

◆ m_phiRoad

double TrkDriftCircleMath::SegmentFinder::m_phiRoad {M_PI_2}
protected

Definition at line 109 of file SegmentFinder.h.

109{M_PI_2};

◆ m_ratioEmptyTubesCut

double TrkDriftCircleMath::SegmentFinder::m_ratioEmptyTubesCut {1.}
protected

Definition at line 115 of file SegmentFinder.h.

115{1.};

◆ m_recoverMdtHits

bool TrkDriftCircleMath::SegmentFinder::m_recoverMdtHits {true}
protected

Definition at line 122 of file SegmentFinder.h.

122{true};

◆ m_removeSingleOutliers

bool TrkDriftCircleMath::SegmentFinder::m_removeSingleOutliers {true}
protected

Definition at line 128 of file SegmentFinder.h.

128{true};

◆ m_resCutT0

double TrkDriftCircleMath::SegmentFinder::m_resCutT0 {1.}
protected

Definition at line 119 of file SegmentFinder.h.

119{1.};

◆ m_roadDir

LocVec2D TrkDriftCircleMath::SegmentFinder::m_roadDir {0., 0.}
protected

Definition at line 110 of file SegmentFinder.h.

110{0., 0.};

◆ m_roadWidth

double TrkDriftCircleMath::SegmentFinder::m_roadWidth {1.5}
protected

Definition at line 108 of file SegmentFinder.h.

108{1.5};

◆ m_rpcPullCut

double TrkDriftCircleMath::SegmentFinder::m_rpcPullCut {5}
protected

Definition at line 118 of file SegmentFinder.h.

118{5};

◆ m_seedCleaning

bool TrkDriftCircleMath::SegmentFinder::m_seedCleaning {false}
protected

Definition at line 131 of file SegmentFinder.h.

131{false};

◆ m_singleMultiLayerScan

bool TrkDriftCircleMath::SegmentFinder::m_singleMultiLayerScan {true}
protected

Definition at line 130 of file SegmentFinder.h.

130{true};

◆ m_tgcPullCut

double TrkDriftCircleMath::SegmentFinder::m_tgcPullCut {5}
protected

Definition at line 117 of file SegmentFinder.h.

117{5};

◆ m_useChamberPhi

bool TrkDriftCircleMath::SegmentFinder::m_useChamberPhi {true}
protected

Definition at line 136 of file SegmentFinder.h.

136{true};

◆ m_useRoadPhi

bool TrkDriftCircleMath::SegmentFinder::m_useRoadPhi {true}
protected

Definition at line 137 of file SegmentFinder.h.

137{true};

◆ m_useSegmentQuality

bool TrkDriftCircleMath::SegmentFinder::m_useSegmentQuality {false}
protected

Definition at line 121 of file SegmentFinder.h.

121{false};

The documentation for this class was generated from the following files: