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  return reinterpret_cast<reference> (pointer_list::iterator::operator*());
60  }
61 
63  {
64  return reinterpret_cast<reference> (pointer_list::iterator::operator*());
65  }
66  };
67 
68 
69  // Constructors
71  : m_members (pool),
72  m_maxRatio (0)
73  {
74  }
75 
76  // Operators
77 
78  // Selectors
79 
80  inline float getMaxRatio() const
81  {
82  return m_maxRatio;
83  }
84 
85  inline int size() const
86  {
87  return m_members.size();
88  }
89 
91  {
92  return iterator (m_members.begin());
93  }
94 
96  {
97  return iterator (m_members.end());
98  }
99 
100  void removeAll()
101  {
102  m_members.clear();
103  m_maxRatio=0;
104  }
105 
106  void add(HashCell& hashCell);
107 
108  void add(CaloTopoTmpHashClusterBase& hashCluster);
109 
110 };
111 
112 
113 template <class T>
115 {
116  T* cell = hashCell.getCaloTopoTmpClusterCell();
117  m_members.push_back (cell);
118 
119  float ratio = cell->getSignedRatio();
120  if ( ratio > m_maxRatio ) {
121  m_maxRatio = ratio;
122  }
123 }
124 
125 template <class T>
127  (CaloTopoTmpHashClusterBase& hashCluster)
128 {
129  pointer_list::iterator beg = hashCluster.m_members.begin();
130  pointer_list::iterator end = hashCluster.m_members.end();
131  while (beg != end) {
132  m_members.push_back (*beg);
133  ++beg;
134  }
135  if ( hashCluster.m_maxRatio > m_maxRatio) {
136  m_maxRatio = hashCluster.m_maxRatio;
137  }
138 }
139 
140 #endif // CALOTOPOTMPHASHCLUSTERBASE_H
141 
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:85
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:90
CxxUtils::pointer_list::end
iterator end()
Iterator at the end of the container.
CaloTopoTmpHashClusterBase::removeAll
void removeAll()
Definition: CaloTopoTmpHashClusterBase.h:100
CaloTopoTmpHashClusterBase::iterator::operator->
reference operator->()
Definition: CaloTopoTmpHashClusterBase.h:62
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:114
CaloTopoTmpHashClusterBase::end
iterator end()
Definition: CaloTopoTmpHashClusterBase.h:95
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:80
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:127
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:70
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35