ATLAS Offline Software
Loading...
Searching...
No Matches
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
15
16namespace 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
double phi() const
Definition Line.h:62
double y0() const
Definition Line.h:64
Function object to check whether two Segments are sub/super sets or different.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
IsSubsetSegment(double phiCut, double y0Cut)
int operator()(const Segment &seg1, const Segment &seg2) const
counts the number of hits shared by the two segments