ATLAS Offline Software
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 
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,
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,
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>
57  {
58 
59  public:
60  inline compareWithIndex() {} ;
61  inline bool operator () (const CaloTopoTmpHashCell<T>& c1,
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>
76  {
77 
78  public:
79  inline compareAbsWithIndex() {} ;
80  inline bool operator () (const CaloTopoTmpHashCell<T>& c1,
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
Definition: CaloTopoTmpHashCellSort.h:76
CaloTopoTmpHashCell
Definition: CaloTopoTmpHashCell.h:22
extractSporadic.c1
c1
Definition: extractSporadic.py:134
CaloTopoTmpHashCellSort::compareAbs
Definition: CaloTopoTmpHashCellSort.h:42
CaloTopoTmpHashCellSort::compare::compare
compare()
Definition: CaloTopoTmpHashCellSort.h:31
CaloTopoTmpHashCellSort::compareAbs::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition: CaloTopoTmpHashCellSort.h:46
CaloTopoTmpHashCellSort::compareWithIndex::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition: CaloTopoTmpHashCellSort.h:61
CaloTopoTmpHashCellSort::compareAbsWithIndex::compareAbsWithIndex
compareAbsWithIndex()
Definition: CaloTopoTmpHashCellSort.h:79
CaloTopoTmpHashCellSort::compareWithIndex
Definition: CaloTopoTmpHashCellSort.h:57
CaloTopoTmpHashCellSort::compare
Definition: CaloTopoTmpHashCellSort.h:28
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
CaloTopoTmpHashCellSort::compareAbs::compareAbs
compareAbs()
Definition: CaloTopoTmpHashCellSort.h:45
CaloTopoTmpHashCellSort::compare::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition: CaloTopoTmpHashCellSort.h:32
CaloTopoTmpHashCellSort::compareWithIndex::compareWithIndex
compareWithIndex()
Definition: CaloTopoTmpHashCellSort.h:60
CaloTopoTmpHashCellSort
Definition: CaloTopoTmpHashCellSort.h:23
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
CaloTopoTmpHashCellSort::compareAbsWithIndex::operator()
bool operator()(const CaloTopoTmpHashCell< T > &c1, const CaloTopoTmpHashCell< T > &c2)
Definition: CaloTopoTmpHashCellSort.h:80