ATLAS Offline Software
Loading...
Searching...
No Matches
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
15namespace 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
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
This class represents a drift time measurement.
Definition DriftCircle.h:22
const MdtId & id() const
access to identifier
Definition DriftCircle.h:77
double x() const
direct access to local x position
Definition DriftCircle.h:80
double y() const
direct access to local y position
Definition DriftCircle.h:83
Workaround x86 precision issues for FP inequality comparisons.
bool less(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition fpcompare.h:166
Function object to check whether two Segments are sub/super sets or different.
bool operator()(const DriftCircle &dc1, const DriftCircle &dc2) const
Definition SortDcsByY.h:34
bool operator()(const DriftCircle &dc1, const DriftCircle &dc2) const
Definition SortDcsByY.h:27
bool operator()(const DriftCircle &dc1, const DriftCircle &dc2) const
Definition SortDcsByY.h:18