ATLAS Offline Software
Public Types | Public Member Functions | Protected Types | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
CaloTopoSplitterHashCluster Class Reference

#include <CaloTopoSplitterHashCluster.h>

Inheritance diagram for CaloTopoSplitterHashCluster:
Collaboration diagram for CaloTopoSplitterHashCluster:

Public Types

typedef pointer_list::pool_type pool_type
 

Public Member Functions

 CaloTopoSplitterHashCluster (pool_type &pool)
 
 ~CaloTopoSplitterHashCluster ()=default
 
const xAOD::CaloClustergetParentCluster () const
 
size_t getParentClusterIndex () const
 
void removeAll ()
 
void add (HashCell &hashCell)
 
void remove (const HashCell &hashCell)
 
void add (CaloTopoSplitterHashCluster &hashCluster)
 
float getEnergy ()
 
const HepGeom::Vector3D< double > & getCentroid ()
 
bool getContainsLocalMax () const
 
void setContainsLocalMax ()
 
float getMaxRatio () const
 
int size () const
 
iterator begin ()
 
iterator end ()
 
void add (CaloTopoTmpHashClusterBase &hashCluster)
 

Protected Types

typedef CxxUtils::pointer_list pointer_list
 

Protected Attributes

pointer_list m_members
 
float m_maxRatio
 

Private Types

typedef CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCellBase
 
typedef CaloTopoTmpHashCell< CaloTopoSplitterClusterCellHashCell
 

Private Member Functions

void calcEnergy ()
 
void calcCentroid ()
 

Private Attributes

const xAOD::CaloClusterm_parentCluster = nullptr
 
size_t m_parentClusterIndex = 0
 
float m_energy = 0
 
bool m_hasValidEnergy = false
 
bool m_containsLocalMax = false
 
std::optional< HepGeom::Vector3D< double > > m_centroid
 

Detailed Description

Definition at line 32 of file CaloTopoSplitterHashCluster.h.

Member Typedef Documentation

◆ Base

Definition at line 35 of file CaloTopoSplitterHashCluster.h.

◆ HashCell

Definition at line 36 of file CaloTopoSplitterHashCluster.h.

◆ pointer_list

Definition at line 32 of file CaloTopoTmpHashClusterBase.h.

◆ pool_type

Definition at line 43 of file CaloTopoTmpHashClusterBase.h.

Constructor & Destructor Documentation

◆ CaloTopoSplitterHashCluster()

CaloTopoSplitterHashCluster::CaloTopoSplitterHashCluster ( pool_type pool)
inline

Definition at line 51 of file CaloTopoSplitterHashCluster.h.

52  : Base (pool)
53  {}

◆ ~CaloTopoSplitterHashCluster()

CaloTopoSplitterHashCluster::~CaloTopoSplitterHashCluster ( )
default

Member Function Documentation

◆ add() [1/3]

void CaloTopoSplitterHashCluster::add ( CaloTopoSplitterHashCluster hashCluster)

Definition at line 65 of file CaloTopoSplitterHashCluster.cxx.

67 {
68  if ( !m_parentCluster) {
69  m_parentCluster = rClus.m_parentCluster;
70  m_parentClusterIndex = rClus.m_parentClusterIndex;
71  }
72 
73  Base::add(rClus);
74  m_hasValidEnergy = false;
75  m_centroid.reset();
76 }

◆ add() [2/3]

Definition at line 110 of file CaloTopoTmpHashClusterBase.h.

130 {
131  pointer_list::iterator beg = hashCluster.m_members.begin();
132  pointer_list::iterator end = hashCluster.m_members.end();
133  while (beg != end) {
135  ++beg;
136  }
137  if ( hashCluster.m_maxRatio > m_maxRatio) {
138  m_maxRatio = hashCluster.m_maxRatio;
139  }
140 }

◆ add() [3/3]

void CaloTopoSplitterHashCluster::add ( HashCell hashCell)

Definition at line 29 of file CaloTopoSplitterHashCluster.cxx.

30 {
31  if ( !m_parentCluster ) {
32  const CaloTopoSplitterClusterCell* pCell = hashCell.getCaloTopoTmpClusterCell();
35  }
36 
37  Base::add(hashCell);
38  m_hasValidEnergy = false;
39  m_centroid.reset();
40 }

◆ begin()

iterator CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::begin
inlineinherited

Definition at line 92 of file CaloTopoTmpHashClusterBase.h.

93  {
94  return iterator (m_members.begin());
95  }

◆ calcCentroid()

void CaloTopoSplitterHashCluster::calcCentroid ( )
private

Definition at line 113 of file CaloTopoSplitterHashCluster.cxx.

114 {
115  m_centroid.emplace(0,0,0);
116 
117  if ( !m_members.empty() ) {
118  double thisAbsEng,absEng = 0;
119 
120  for( iterator iter = begin(); iter != end(); ++iter)
121  {
122  CaloTopoSplitterClusterCell *pClusCell = *iter;
123  xAOD::CaloCluster::cell_iterator itrCell = pClusCell->getCellIterator();
124  float myWeight = itrCell.weight();//pClusCell->getParentCluster()->getCellWeight(itrCell);
125  if ( pClusCell->getShared() ) {
126  if ( pClusCell->getCaloTopoTmpHashCluster() == this )
127  myWeight *= pClusCell->getSharedWeight();
128  else
129  myWeight *= (1.-pClusCell->getSharedWeight());
130  }
131 
132  thisAbsEng = fabs(myWeight*itrCell->e());
133  absEng += thisAbsEng;
134  HepGeom::Vector3D<double> thisPos(itrCell->x(), itrCell->y(), itrCell->z());
135  m_centroid.value() += thisAbsEng*thisPos;
136  }
137  if ( absEng > 0 )
138  m_centroid.value() *= (1./absEng);
139  }
140 }

◆ calcEnergy()

void CaloTopoSplitterHashCluster::calcEnergy ( )
private

Definition at line 92 of file CaloTopoSplitterHashCluster.cxx.

93 {
94  if ( ! m_members.empty() ) {
95  m_energy = 0;
96  for( iterator iter=begin(); iter!= end(); ++iter)
97  {
98  CaloTopoSplitterClusterCell *pClusCell = *iter;
100  float myWeight = itrCell.weight();//pClusCell->getParentCluster()->getCellWeight(itrCell);
101  if ( pClusCell->getShared() ) {
102  if ( pClusCell->getCaloTopoTmpHashCluster() == this )
103  myWeight *= pClusCell->getSharedWeight();
104  else
105  myWeight *= (1.-pClusCell->getSharedWeight());
106  }
107  m_energy += myWeight*itrCell->e();
108  }
109  }
110  m_hasValidEnergy = true;
111 }

◆ end()

iterator CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::end
inlineinherited

Definition at line 97 of file CaloTopoTmpHashClusterBase.h.

98  {
99  return iterator (m_members.end());
100  }

◆ getCentroid()

const HepGeom::Vector3D< double > & CaloTopoSplitterHashCluster::getCentroid ( )

Definition at line 85 of file CaloTopoSplitterHashCluster.cxx.

86 {
87  if ( !m_centroid)
88  this->calcCentroid();
89  return m_centroid.value();
90 }

◆ getContainsLocalMax()

bool CaloTopoSplitterHashCluster::getContainsLocalMax ( ) const
inline

Definition at line 91 of file CaloTopoSplitterHashCluster.h.

92  {
93  return m_containsLocalMax;
94  }

◆ getEnergy()

float CaloTopoSplitterHashCluster::getEnergy ( )

Definition at line 78 of file CaloTopoSplitterHashCluster.cxx.

79 {
80  if ( !m_hasValidEnergy)
81  this->calcEnergy();
82  return m_energy;
83 }

◆ getMaxRatio()

float CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::getMaxRatio
inlineinherited

Definition at line 82 of file CaloTopoTmpHashClusterBase.h.

83  {
84  return m_maxRatio;
85  }

◆ getParentCluster()

const xAOD::CaloCluster* CaloTopoSplitterHashCluster::getParentCluster ( ) const
inline

Definition at line 62 of file CaloTopoSplitterHashCluster.h.

63  {
64  return m_parentCluster;
65  }

◆ getParentClusterIndex()

size_t CaloTopoSplitterHashCluster::getParentClusterIndex ( ) const
inline

Definition at line 67 of file CaloTopoSplitterHashCluster.h.

68  {
69  return m_parentClusterIndex;
70  }

◆ remove()

void CaloTopoSplitterHashCluster::remove ( const HashCell hashCell)

Definition at line 42 of file CaloTopoSplitterHashCluster.cxx.

43 {
44  const CaloTopoSplitterClusterCell* cell = hashCell.getCaloTopoTmpClusterCell();
45  {
48  if (iter != m_members.end())
49  m_members.erase (iter);
50  }
51 
52  float ratio = cell->getSignedRatio();
53  if ( ratio >= m_maxRatio ) {
54  for(iterator iter = begin(); iter!= end(); ++iter)
55  {
56  float myRatio = iter->getSignedRatio();
57  if ( iter == m_members.begin() || myRatio > m_maxRatio )
58  m_maxRatio = myRatio;
59  }
60  }
61  m_hasValidEnergy = false;
62  m_centroid.reset();
63 }

◆ removeAll()

void CaloTopoSplitterHashCluster::removeAll ( )
inline

Definition at line 72 of file CaloTopoSplitterHashCluster.h.

73  {
75  m_parentCluster = 0;
76  m_energy = 0;
77  m_hasValidEnergy = false;
78  m_containsLocalMax = false;
79  }

◆ setContainsLocalMax()

void CaloTopoSplitterHashCluster::setContainsLocalMax ( )
inline

Definition at line 96 of file CaloTopoSplitterHashCluster.h.

97  {
98  m_containsLocalMax = true;
99  }

◆ size()

Definition at line 87 of file CaloTopoTmpHashClusterBase.h.

88  {
89  return m_members.size();
90  }

Member Data Documentation

◆ m_centroid

std::optional<HepGeom::Vector3D<double> > CaloTopoSplitterHashCluster::m_centroid
private

Definition at line 46 of file CaloTopoSplitterHashCluster.h.

◆ m_containsLocalMax

bool CaloTopoSplitterHashCluster::m_containsLocalMax = false
private

Definition at line 45 of file CaloTopoSplitterHashCluster.h.

◆ m_energy

float CaloTopoSplitterHashCluster::m_energy = 0
private

Definition at line 43 of file CaloTopoSplitterHashCluster.h.

◆ m_hasValidEnergy

bool CaloTopoSplitterHashCluster::m_hasValidEnergy = false
private

Definition at line 44 of file CaloTopoSplitterHashCluster.h.

◆ m_maxRatio

float CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::m_maxRatio
protectedinherited

Definition at line 39 of file CaloTopoTmpHashClusterBase.h.

◆ m_members

Definition at line 38 of file CaloTopoTmpHashClusterBase.h.

◆ m_parentCluster

const xAOD::CaloCluster* CaloTopoSplitterHashCluster::m_parentCluster = nullptr
private

Definition at line 41 of file CaloTopoSplitterHashCluster.h.

◆ m_parentClusterIndex

size_t CaloTopoSplitterHashCluster::m_parentClusterIndex = 0
private

Definition at line 42 of file CaloTopoSplitterHashCluster.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloTopoSplitterHashCluster::m_energy
float m_energy
Definition: CaloTopoSplitterHashCluster.h:43
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
CaloCell::y
float y() const
get y (through CaloDetDescrElement)
Definition: CaloCell.h:420
CaloTopoSplitterHashCluster::calcEnergy
void calcEnergy()
Definition: CaloTopoSplitterHashCluster.cxx:92
pool
pool namespace
Definition: libname.h:15
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:317
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::begin
iterator begin()
Definition: CaloTopoTmpHashClusterBase.h:92
CaloTopoSplitterClusterCell::getParentClusterIndex
size_t getParentClusterIndex() const
Definition: CaloTopoSplitterClusterCell.h:80
CxxUtils::pointer_list::end
iterator end()
Iterator at the end of the container.
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::removeAll
void removeAll()
Definition: CaloTopoTmpHashClusterBase.h:102
CaloTopoSplitterClusterCell
Definition: CaloTopoSplitterClusterCell.h:29
CaloTopoSplitterHashCluster::m_parentClusterIndex
size_t m_parentClusterIndex
Definition: CaloTopoSplitterHashCluster.h:42
CxxUtils::pointer_list::begin
iterator begin()
Iterator at the beginning of the container.
CaloTopoSplitterClusterCell::getShared
bool getShared() const
Definition: CaloTopoSplitterClusterCell.h:85
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::add
void add(HashCell &hashCell)
Definition: CaloTopoTmpHashClusterBase.h:116
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::end
iterator end()
Definition: CaloTopoTmpHashClusterBase.h:97
CxxUtils::pointer_list_base::push_back
void push_back(value_type p)
Add a new element to the end of the container. O(1)
CaloTopoSplitterHashCluster::m_containsLocalMax
bool m_containsLocalMax
Definition: CaloTopoSplitterHashCluster.h:45
CxxUtils::pointer_list::erase
void erase(iterator it)
Erase one element. O(n)
CaloTopoSplitterHashCluster::m_hasValidEnergy
bool m_hasValidEnergy
Definition: CaloTopoSplitterHashCluster.h:44
CxxUtils::pointer_list_base::size
size_t size() const
The current size of the container. O(1).
CaloTopoSplitterHashCluster::m_centroid
std::optional< HepGeom::Vector3D< double > > m_centroid
Definition: CaloTopoSplitterHashCluster.h:46
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
CaloTopoSplitterClusterCell::getSharedWeight
const float & getSharedWeight()
Definition: CaloTopoSplitterClusterCell.h:111
CaloTopoTmpHashClusterBase::m_maxRatio
float m_maxRatio
Definition: CaloTopoTmpHashClusterBase.h:39
CaloTopoSplitterClusterCell::getCellIterator
const xAOD::CaloCluster::cell_iterator & getCellIterator() const
Definition: CaloTopoSplitterClusterCell.h:75
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
CaloTopoSplitterHashCluster::calcCentroid
void calcCentroid()
Definition: CaloTopoSplitterHashCluster.cxx:113
CaloCell::z
float z() const
get z (through CaloDetDescrElement)
Definition: CaloCell.h:427
CaloTopoSplitterClusterCell::getParentCluster
const xAOD::CaloCluster * getParentCluster() const
Definition: CaloTopoSplitterClusterCell.h:70
CaloCell::x
float x() const
get x (through CaloDetDescrElement)
Definition: CaloCell.h:413
CaloTopoSplitterHashCluster::m_parentCluster
const xAOD::CaloCluster * m_parentCluster
Definition: CaloTopoSplitterHashCluster.h:41
CaloTopoSplitterHashCluster::Base
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell > Base
Definition: CaloTopoSplitterHashCluster.h:35
CxxUtils::pointer_list_base::empty
bool empty() const
Test to see if the container is empty.
CaloTopoSplitterClusterCell::getCaloTopoTmpHashCluster
const CaloTopoSplitterHashCluster * getCaloTopoTmpHashCluster() const
Definition: CaloTopoSplitterClusterCell.h:121
CaloTopoTmpHashClusterBase::m_members
pointer_list m_members
Definition: CaloTopoTmpHashClusterBase.h:38