ATLAS Offline Software
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloTopoTmpHashCellSort.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 CALOTOPOTMPHASHCELLSORT_H
6
#define CALOTOPOTMPHASHCELLSORT_H
7
//-----------------------------------------------------------------------
8
// File and Version Information:
9
// $Id: CaloTopoTmpHashCellSort.h,v 1.2 2008-08-28 05:15:05 ssnyder Exp $
10
//
11
// Description: ration (could be S/N, or E/V) sorting for CaloTopoTmpHashCells
12
//
13
// Environment:
14
// Software developed for the ATLAS Detector at the CERN LHC
15
//
16
// Author List:
17
// Sven Menke
18
//
19
//-----------------------------------------------------------------------
20
21
#include "
CaloTopoTmpHashCell.h
"
22
23
namespace
CaloTopoTmpHashCellSort
{
24
25
// comparison, order seed cells by E/V
26
template
<
class
T>
27
class
compare
28
{
29
30
public
:
31
inline
compare
() {} ;
32
inline
bool
operator ()
(
const
CaloTopoTmpHashCell<T>
& c1,
33
const
CaloTopoTmpHashCell<T>
& c2)
34
{
35
return
c1.getCaloTopoTmpClusterCell()->getSignedRatio() > c2.getCaloTopoTmpClusterCell()->getSignedRatio();
36
}
37
38
};
39
40
template
<
class
T>
41
class
compareAbs
42
{
43
44
public
:
45
inline
compareAbs
() {} ;
46
inline
bool
operator ()
(
const
CaloTopoTmpHashCell<T>
& c1,
47
const
CaloTopoTmpHashCell<T>
& c2)
48
{
49
return
std::abs(c1.getCaloTopoTmpClusterCell()->getSignedRatio()) > std::abs(c2.getCaloTopoTmpClusterCell()->getSignedRatio());
50
}
51
};
52
53
//These are used to agree with GPU ordering: use the cell index as a tie-breaker.
54
55
template
<
class
T>
56
class
compareWithIndex
57
{
58
59
public
:
60
inline
compareWithIndex
() {} ;
61
inline
bool
operator ()
(
const
CaloTopoTmpHashCell<T>
& c1,
62
const
CaloTopoTmpHashCell<T>
& c2)
63
{
64
const
auto
s1 = c1.getCaloTopoTmpClusterCell()->getSignedRatio();
65
const
auto
s2 = c2.getCaloTopoTmpClusterCell()->getSignedRatio();
66
if
(s1 == s2) {
67
return
c1.getCaloTopoTmpClusterCell()->getID() > c2.getCaloTopoTmpClusterCell()->getID();
68
}
69
return
s1 > s2;
70
}
71
72
};
73
74
template
<
class
T>
75
class
compareAbsWithIndex
76
{
77
78
public
:
79
inline
compareAbsWithIndex
() {} ;
80
inline
bool
operator ()
(
const
CaloTopoTmpHashCell<T>
& c1,
81
const
CaloTopoTmpHashCell<T>
& c2)
82
{
83
const
auto
s1 = std::abs(c1.getCaloTopoTmpClusterCell()->getSignedRatio());
84
const
auto
s2 = std::abs(c2.getCaloTopoTmpClusterCell()->getSignedRatio());
85
if
(s1 == s2) {
86
return
c1.getCaloTopoTmpClusterCell()->getID() > c2.getCaloTopoTmpClusterCell()->getID();
87
}
88
return
s1 > s2;
89
}
90
};
91
}
92
93
#endif
// CALOTOPOTMPHASHCELLSORT_H
94
CaloTopoTmpHashCell.h
CaloTopoTmpHashCellSort::compareAbsWithIndex::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition
CaloTopoTmpHashCellSort.h:80
CaloTopoTmpHashCellSort::compareAbsWithIndex::compareAbsWithIndex
compareAbsWithIndex()
Definition
CaloTopoTmpHashCellSort.h:79
CaloTopoTmpHashCellSort::compareAbs::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition
CaloTopoTmpHashCellSort.h:46
CaloTopoTmpHashCellSort::compareAbs::compareAbs
compareAbs()
Definition
CaloTopoTmpHashCellSort.h:45
CaloTopoTmpHashCellSort::compareWithIndex::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition
CaloTopoTmpHashCellSort.h:61
CaloTopoTmpHashCellSort::compareWithIndex::compareWithIndex
compareWithIndex()
Definition
CaloTopoTmpHashCellSort.h:60
CaloTopoTmpHashCellSort::compare::compare
compare()
Definition
CaloTopoTmpHashCellSort.h:31
CaloTopoTmpHashCellSort::compare::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition
CaloTopoTmpHashCellSort.h:32
CaloTopoTmpHashCell
Definition
CaloTopoTmpHashCell.h:22
CaloTopoTmpHashCellSort
Definition
CaloTopoTmpHashCellSort.h:23
Generated on
for ATLAS Offline Software by
1.14.0