ATLAS Offline Software
CaloTopoTmpHashClusterBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------
6 // File and Version Information:
7 //
8 // Description: base class for temporary Cluster Container for
9 // topological cluster making tools
10 //
11 // Environment:
12 // Software developed for the ATLAS Detector at the CERN LHC
13 //
14 // Author List:
15 // Sven Menke
16 //
17 //-----------------------------------------------------------------------
18 
19 #ifndef CALOTOPOTMPHASHCLUSTERBASE_H
20 #define CALOTOPOTMPHASHCLUSTERBASE_H
21 
22 #include <vector>
23 #include "CaloTopoTmpHashCell.h"
24 #include "CxxUtils/pointer_list.h"
25 
26 
27 template <class T>
29 {
30 protected:
33 
34  // Friends
35 
36  // Data members
37 
39  float m_maxRatio;
40  // Helper functions
41 
42 public:
44 
45  class iterator
46  : public pointer_list::iterator
47  {
48  public:
49  typedef T* value_type;
51  typedef value_type* pointer;
52 
54  : pointer_list::iterator (iter)
55  {}
56 
58  {
59  // cppcheck-suppress returnTempReference; false positive
60  return reinterpret_cast<reference> (pointer_list::iterator::operator*());
61  }
62 
64  {
65  // cppcheck-suppress returnTempReference; false positive
66  return reinterpret_cast<reference> (pointer_list::iterator::operator*());
67  }
68  };
69 
70 
71  // Constructors
73  : m_members (pool),
74  m_maxRatio (0)
75  {
76  }
77 
78  // Operators
79 
80  // Selectors
81 
82  inline float getMaxRatio() const
83  {
84  return m_maxRatio;
85  }
86 
87  inline int size() const
88  {
89  return m_members.size();
90  }
91 
93  {
94  return iterator (m_members.begin());
95  }
96 
98  {
99  return iterator (m_members.end());
100  }
101 
102  void removeAll()
103  {
104  m_members.clear();
105  m_maxRatio=0;
106  }
107 
108  void add(HashCell& hashCell);
109 
110  void add(CaloTopoTmpHashClusterBase& hashCluster);
111 
112 };
113 
114 
115 template <class T>
117 {
118  T* cell = hashCell.getCaloTopoTmpClusterCell();
119  m_members.push_back (cell);
120 
121  float ratio = cell->getSignedRatio();
122  if ( ratio > m_maxRatio ) {
123  m_maxRatio = ratio;
124  }
125 }
126 
127 template <class T>
129  (CaloTopoTmpHashClusterBase& hashCluster)
130 {
131  pointer_list::iterator beg = hashCluster.m_members.begin();
132  pointer_list::iterator end = hashCluster.m_members.end();
133  while (beg != end) {
134  m_members.push_back (*beg);
135  ++beg;
136  }
137  if ( hashCluster.m_maxRatio > m_maxRatio) {
138  m_maxRatio = hashCluster.m_maxRatio;
139  }
140 }
141 
142 #endif // CALOTOPOTMPHASHCLUSTERBASE_H
143 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloTopoTmpHashCell::getCaloTopoTmpClusterCell
const T * getCaloTopoTmpClusterCell() const
Definition: CaloTopoTmpHashCell.h:59
CaloTopoTmpHashClusterBase::size
int size() const
Definition: CaloTopoTmpHashClusterBase.h:87
CxxUtils::pointer_list::iterator::operator*
reference operator*()
Dereference.
CxxUtils::pointer_list_base::clear
void clear()
Erase the container.
Definition: pointer_list.cxx:89
CaloTopoTmpHashClusterBase::iterator::pointer
value_type * pointer
Definition: CaloTopoTmpHashClusterBase.h:51
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloTopoTmpHashCell.h
CaloTopoTmpHashCell
Definition: CaloTopoTmpHashCell.h:22
CaloTopoTmpHashClusterBase::pool_type
pointer_list::pool_type pool_type
Definition: CaloTopoTmpHashClusterBase.h:43
CaloTopoTmpHashClusterBase::iterator::iterator
iterator(pointer_list::iterator iter)
Definition: CaloTopoTmpHashClusterBase.h:53
pool
pool namespace
Definition: libname.h:15
CaloTopoTmpHashClusterBase::begin
iterator begin()
Definition: CaloTopoTmpHashClusterBase.h:92
CxxUtils::pointer_list::end
iterator end()
Iterator at the end of the container.
CaloTopoTmpHashClusterBase::removeAll
void removeAll()
Definition: CaloTopoTmpHashClusterBase.h:102
CaloTopoTmpHashClusterBase::iterator::operator->
reference operator->()
Definition: CaloTopoTmpHashClusterBase.h:63
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
CxxUtils::pointer_list::begin
iterator begin()
Iterator at the beginning of the container.
CaloTopoTmpHashClusterBase::HashCell
CaloTopoTmpHashCell< T > HashCell
Definition: CaloTopoTmpHashClusterBase.h:31
CaloTopoTmpHashClusterBase::add
void add(HashCell &hashCell)
Definition: CaloTopoTmpHashClusterBase.h:116
CaloTopoTmpHashClusterBase::end
iterator end()
Definition: CaloTopoTmpHashClusterBase.h:97
pointer_list.h
A fast way to store a variable-sized collection of pointers.
CxxUtils::pointer_list
A fast way to store a variable-sized collection of pointers.
Definition: pointer_list.h:242
CxxUtils::pointer_list::allocator
Allocator for pointer_list, specialized for NELT.
Definition: pointer_list.h:256
CaloTopoTmpHashClusterBase::iterator::value_type
T * value_type
Definition: CaloTopoTmpHashClusterBase.h:49
CxxUtils::pointer_list_base::size
size_t size() const
The current size of the container. O(1).
CxxUtils::pointer_list::iterator
Forward iterator over the list.
Definition: pointer_list.h:281
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
CaloTopoTmpHashClusterBase::getMaxRatio
float getMaxRatio() const
Definition: CaloTopoTmpHashClusterBase.h:82
CaloTopoTmpHashClusterBase::iterator::operator*
reference operator*()
Definition: CaloTopoTmpHashClusterBase.h:57
CaloTopoTmpHashClusterBase::pointer_list
CxxUtils::pointer_list pointer_list
Definition: CaloTopoTmpHashClusterBase.h:32
CaloTopoTmpHashClusterBase::m_maxRatio
float m_maxRatio
Definition: CaloTopoTmpHashClusterBase.h:39
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
CaloTopoTmpHashClusterBase::add
void add(CaloTopoTmpHashClusterBase &hashCluster)
Definition: CaloTopoTmpHashClusterBase.h:129
CaloTopoTmpHashClusterBase
Definition: CaloTopoTmpHashClusterBase.h:29
CaloTopoTmpHashClusterBase::iterator::reference
value_type & reference
Definition: CaloTopoTmpHashClusterBase.h:50
CaloTopoTmpHashClusterBase::iterator
Definition: CaloTopoTmpHashClusterBase.h:47
CaloTopoTmpHashClusterBase::m_members
pointer_list m_members
Definition: CaloTopoTmpHashClusterBase.h:38
CaloTopoTmpHashClusterBase::CaloTopoTmpHashClusterBase
CaloTopoTmpHashClusterBase(pool_type &pool)
Definition: CaloTopoTmpHashClusterBase.h:72
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35