ATLAS Offline Software
IsSubsetSegment.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DCMATH_ISSUBSETSEGMENT_H
6 #define DCMATH_ISSUBSETSEGMENT_H
7 
16 namespace TrkDriftCircleMath {
17 
18  template <class CDC> struct IsSubsetSegment {
19  IsSubsetSegment() = default;
20  IsSubsetSegment(double phiCut, double y0Cut) : m_phiCut(phiCut), m_y0Cut(y0Cut) {}
21 
22  // SubsetState
23  int operator()(const Segment& seg1, const Segment& seg2) const {
24  // check angular distance between segments and distance from origine
25  // only segments that have similar angles and offsets are considered subsets
26  if (std::abs(xAOD::P4Helpers::deltaPhi(seg1.line().phi(), seg2.line().phi())) < m_phiCut &&
27  std::abs(seg1.line().y0() - seg2.line().y0()) < m_y0Cut) {
28  SharedHitsSegments sharedHitsSegments(true);
29  sharedHitsSegments(seg1, seg2);
30 
31  unsigned int onlyInSeg1 = sharedHitsSegments.onlyInSeg1();
32  unsigned int onlyInSeg2 = sharedHitsSegments.onlyInSeg2();
33  // segment 1 contains no hits that are not in segment 2
34  if (onlyInSeg1 == 0) {
35  // check is segment 1 is a single ml segment that should be kept for the curved segment finder
36  if (seg1.hitsMl1() == 0 || seg1.hitsMl2() == 0) {
37  if (seg2.hitsMl2() < 3 || seg2.hitsMl1() < 3) { return ResolvedCollection<SegVec, IsSubsetSegment>::Different; }
39  }
40  // segment 1 contains the same hits as segment 2
41  if (onlyInSeg2 == 0) {
42  // chose segment with best chi2
43  if (seg1.chi2() < seg2.chi2())
45  else
47  }
49  } else {
50  if (onlyInSeg2 == 0) { return ResolvedCollection<SegVec, IsSubsetSegment>::SuperSet; }
51  }
52  }
54  }
55 
56  private:
57  double m_phiCut{0.05};
58  double m_y0Cut{0.5};
59  };
60 
61 } // namespace TrkDriftCircleMath
62 #endif
TrkDriftCircleMath::Segment::line
const Line & line() const
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:27
xAODP4Helpers.h
TrkDriftCircleMath::IsSubsetSegment::operator()
int operator()(const Segment &seg1, const Segment &seg2) const
Definition: IsSubsetSegment.h:23
TrkDriftCircleMath
Function object to check whether two Segments are sub/super sets or different.
Definition: IMdtSegmentFinder.h:13
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
TrkDriftCircleMath::IsSubsetSegment::IsSubsetSegment
IsSubsetSegment(double phiCut, double y0Cut)
Definition: IsSubsetSegment.h:20
TrkDriftCircleMath::Segment::hitsOutOfTime
void hitsOutOfTime(unsigned int hitsOutOfTime)
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:51
TrkDriftCircleMath::SharedHitsSegments::onlyInSeg1
unsigned int onlyInSeg1() const
Definition: SharedHitsSegments.h:91
TrkDriftCircleMath::SharedHitsSegments::onlyInSeg2
unsigned int onlyInSeg2() const
Definition: SharedHitsSegments.h:92
TrkDriftCircleMath::IsSubsetSegment::IsSubsetSegment
IsSubsetSegment()=default
TrkDriftCircleMath::Line::y0
double y0() const
Definition: Line.h:64
TrkDriftCircleMath::Segment
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:18
TrkDriftCircleMath::Segment::hitsMl1
unsigned int hitsMl1() const
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:90
TrkDriftCircleMath::Segment::hitsMl2
unsigned int hitsMl2() const
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:91
TrkDriftCircleMath::Segment::chi2
double chi2() const
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:42
TrkDriftCircleMath::IsSubsetSegment::m_y0Cut
double m_y0Cut
Definition: IsSubsetSegment.h:58
TrkDriftCircleMath::SharedHitsSegments
counts the number of hits shared by the two segments
Definition: SharedHitsSegments.h:14
ResolvedCollection.h
TrkDriftCircleMath::IsSubsetSegment::m_phiCut
double m_phiCut
Definition: IsSubsetSegment.h:57
SharedHitsSegments.h
Segment.h
TrkDriftCircleMath::ResolvedCollection
Definition: ResolvedCollection.h:13
TrkDriftCircleMath::IsSubsetSegment
Definition: IsSubsetSegment.h:18
TrkDriftCircleMath::Line::phi
double phi() const
Definition: Line.h:62