ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTopoSplitterHashCluster.cxx
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: see CaloTopoSplitterHashCluster.h
9//
10// Environment:
11// Software developed for the ATLAS Detector at CERN LHC
12//
13// Author List:
14// Sven Menke
15//
16//-----------------------------------------------------------------------
17
18//-----------------------
19// This Class's Header --
20//-----------------------
23
24
25//-----------
26// Methods --
27//-----------
28
30{
31 if ( !m_parentCluster ) {
35 }
36
37 Base::add(hashCell);
38 m_hasValidEnergy = false;
39 m_centroid.reset();
40}
41
43{
45 {
47 std::find (m_members.begin(), m_members.end(), cell);
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}
64
77
79{
80 if ( !m_hasValidEnergy)
81 this->calcEnergy();
82 return m_energy;
83}
84
85const HepGeom::Vector3D<double> & CaloTopoSplitterHashCluster::getCentroid()
86{
87 if ( !m_centroid)
88 this->calcCentroid();
89 return m_centroid.value();
90}
91
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}
112
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;
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}
141
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition CaloCell.h:333
float y() const
get y (through CaloDetDescrElement)
Definition CaloCell.h:436
float z() const
get z (through CaloDetDescrElement)
Definition CaloCell.h:443
float x() const
get x (through CaloDetDescrElement)
Definition CaloCell.h:429
const CaloTopoSplitterHashCluster * getCaloTopoTmpHashCluster() const
const xAOD::CaloCluster * getParentCluster() const
const xAOD::CaloCluster::cell_iterator & getCellIterator() const
const HepGeom::Vector3D< double > & getCentroid()
void remove(const HashCell &hashCell)
CaloTopoTmpHashCell< CaloTopoSplitterClusterCell > HashCell
const xAOD::CaloCluster * m_parentCluster
std::optional< HepGeom::Vector3D< double > > m_centroid
const T * getCaloTopoTmpClusterCell() const
Forward iterator over the list.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version)