ATLAS Offline Software
SortDcsByY.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_SORTDCSBYY_H
6 #define DCMATH_SORTDCSBYY_H
7 
8 #include <functional>
9 #include <iostream>
10 
11 #include "CxxUtils/fpcompare.h"
14 
15 namespace TrkDriftCircleMath {
16 
17  struct SortDcsByY {
18  bool operator()(const DriftCircle& dc1, const DriftCircle& dc2) const {
19  if (dc1.id() == dc2.id()) return false;
20  if (CxxUtils::fpcompare::less(dc1.y(), dc2.y())) return true;
21  if (CxxUtils::fpcompare::less(dc2.y(), dc1.y())) return false;
22  return CxxUtils::fpcompare::less(dc1.x(), dc2.x());
23  }
24  };
25 
26  struct SameTube {
27  bool operator()(const DriftCircle& dc1, const DriftCircle& dc2) const {
28  if (dc1.id() == dc2.id()) return true;
29  return false;
30  }
31  };
32 
33  struct NeighbourTube {
34  bool operator()(const DriftCircle& dc1, const DriftCircle& dc2) const {
35  // check whether this is not the same tube
36  SameTube sameTube;
37  if (sameTube(dc1, dc2)) return false;
38 
39  // check whether in the same layer
40  if (std::abs(dc1.y() - dc2.y()) > 1.) return false;
41 
42  // check whether direct neighbours
43  if (std::abs(dc1.x() - dc2.x()) > 31.) return false;
44 
45  return true;
46  }
47  };
48 } // namespace TrkDriftCircleMath
49 #endif
TrkDriftCircleMath::NeighbourTube
Definition: SortDcsByY.h:33
TrkDriftCircleMath::SameTube
Definition: SortDcsByY.h:26
TrkDriftCircleMath::SortDcsByY::operator()
bool operator()(const DriftCircle &dc1, const DriftCircle &dc2) const
Definition: SortDcsByY.h:18
TrkDriftCircleMath
Function object to check whether two Segments are sub/super sets or different.
Definition: IMdtSegmentFinder.h:13
DriftCircle.h
TrkDriftCircleMath::DriftCircle::x
double x() const
direct access to local x position
Definition: DriftCircle.h:80
TrkDriftCircleMath::DriftCircle
This class represents a drift time measurement.
Definition: DriftCircle.h:22
TrkDriftCircleMath::NeighbourTube::operator()
bool operator()(const DriftCircle &dc1, const DriftCircle &dc2) const
Definition: SortDcsByY.h:34
TrkDriftCircleMath::SortDcsByY
Definition: SortDcsByY.h:17
fpcompare.h
Workaround x86 precision issues for FP inequality comparisons.
DCOnTrack.h
CxxUtils::fpcompare::less
bool less(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:166
TrkDriftCircleMath::DriftCircle::id
const MdtId & id() const
access to identifier
Definition: DriftCircle.h:77
TrkDriftCircleMath::SameTube::operator()
bool operator()(const DriftCircle &dc1, const DriftCircle &dc2) const
Definition: SortDcsByY.h:27
TrkDriftCircleMath::DriftCircle::y
double y() const
direct access to local y position
Definition: DriftCircle.h:83