ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
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
//-----------------------
21
#include "
CaloTopoSplitterHashCluster.h
"
22
#include "
CaloTopoSplitterClusterCell.h
"
23
24
25
//-----------
26
// Methods --
27
//-----------
28
29
void
CaloTopoSplitterHashCluster::add
(
HashCell
& hashCell)
30
{
31
if
( !
m_parentCluster
) {
32
const
CaloTopoSplitterClusterCell
* pCell = hashCell.
getCaloTopoTmpClusterCell
();
33
m_parentCluster
= pCell->
getParentCluster
();
34
m_parentClusterIndex
= pCell->
getParentClusterIndex
();
35
}
36
37
Base::add
(hashCell);
38
m_hasValidEnergy
=
false
;
39
m_centroid
.reset();
40
}
41
42
void
CaloTopoSplitterHashCluster::remove
(
const
HashCell
& hashCell)
43
{
44
const
CaloTopoSplitterClusterCell
* cell = hashCell.
getCaloTopoTmpClusterCell
();
45
{
46
pointer_list::iterator
iter =
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
65
void
CaloTopoSplitterHashCluster::add
66
(
CaloTopoSplitterHashCluster
& rClus)
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
}
77
78
float
CaloTopoSplitterHashCluster::getEnergy
()
79
{
80
if
( !
m_hasValidEnergy
)
81
this->
calcEnergy
();
82
return
m_energy
;
83
}
84
85
const
HepGeom::Vector3D<double> &
CaloTopoSplitterHashCluster::getCentroid
()
86
{
87
if
( !
m_centroid
)
88
this->
calcCentroid
();
89
return
m_centroid
.value();
90
}
91
92
void
CaloTopoSplitterHashCluster::calcEnergy
()
93
{
94
if
( !
m_members
.empty() ) {
95
m_energy
= 0;
96
for
( iterator iter=
begin
(); iter!=
end
(); ++iter)
97
{
98
CaloTopoSplitterClusterCell
*pClusCell = *iter;
99
xAOD::CaloCluster::cell_iterator
itrCell = pClusCell->
getCellIterator
();
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
113
void
CaloTopoSplitterHashCluster::calcCentroid
()
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
}
141
CaloTopoSplitterClusterCell.h
CaloTopoSplitterHashCluster.h
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition
CaloCell.h:333
CaloCell::y
float y() const
get y (through CaloDetDescrElement)
Definition
CaloCell.h:436
CaloCell::z
float z() const
get z (through CaloDetDescrElement)
Definition
CaloCell.h:443
CaloCell::x
float x() const
get x (through CaloDetDescrElement)
Definition
CaloCell.h:429
CaloClusterCellLink::iterator::weight
weight_t weight() const
Accessor for weight associated to this cell.
Definition
CaloClusterCellLink.h:147
CaloTopoSplitterClusterCell
Definition
CaloTopoSplitterClusterCell.h:29
CaloTopoSplitterClusterCell::getCaloTopoTmpHashCluster
const CaloTopoSplitterHashCluster * getCaloTopoTmpHashCluster() const
Definition
CaloTopoSplitterClusterCell.h:121
CaloTopoSplitterClusterCell::getShared
bool getShared() const
Definition
CaloTopoSplitterClusterCell.h:85
CaloTopoSplitterClusterCell::getParentCluster
const xAOD::CaloCluster * getParentCluster() const
Definition
CaloTopoSplitterClusterCell.h:70
CaloTopoSplitterClusterCell::getCellIterator
const xAOD::CaloCluster::cell_iterator & getCellIterator() const
Definition
CaloTopoSplitterClusterCell.h:75
CaloTopoSplitterClusterCell::getParentClusterIndex
size_t getParentClusterIndex() const
Definition
CaloTopoSplitterClusterCell.h:80
CaloTopoSplitterClusterCell::getSharedWeight
const float & getSharedWeight()
Definition
CaloTopoSplitterClusterCell.h:111
CaloTopoSplitterHashCluster::getCentroid
const HepGeom::Vector3D< double > & getCentroid()
Definition
CaloTopoSplitterHashCluster.cxx:85
CaloTopoSplitterHashCluster::remove
void remove(const HashCell &hashCell)
Definition
CaloTopoSplitterHashCluster.cxx:42
CaloTopoSplitterHashCluster::m_parentClusterIndex
size_t m_parentClusterIndex
Definition
CaloTopoSplitterHashCluster.h:42
CaloTopoSplitterHashCluster::calcCentroid
void calcCentroid()
Definition
CaloTopoSplitterHashCluster.cxx:113
CaloTopoSplitterHashCluster::getEnergy
float getEnergy()
Definition
CaloTopoSplitterHashCluster.cxx:78
CaloTopoSplitterHashCluster::CaloTopoSplitterHashCluster
CaloTopoSplitterHashCluster(pool_type &pool)
Definition
CaloTopoSplitterHashCluster.h:51
CaloTopoSplitterHashCluster::add
void add(HashCell &hashCell)
Definition
CaloTopoSplitterHashCluster.cxx:29
CaloTopoSplitterHashCluster::HashCell
CaloTopoTmpHashCell< CaloTopoSplitterClusterCell > HashCell
Definition
CaloTopoSplitterHashCluster.h:36
CaloTopoSplitterHashCluster::m_parentCluster
const xAOD::CaloCluster * m_parentCluster
Definition
CaloTopoSplitterHashCluster.h:41
CaloTopoSplitterHashCluster::calcEnergy
void calcEnergy()
Definition
CaloTopoSplitterHashCluster.cxx:92
CaloTopoSplitterHashCluster::m_hasValidEnergy
bool m_hasValidEnergy
Definition
CaloTopoSplitterHashCluster.h:44
CaloTopoSplitterHashCluster::m_centroid
std::optional< HepGeom::Vector3D< double > > m_centroid
Definition
CaloTopoSplitterHashCluster.h:46
CaloTopoSplitterHashCluster::m_energy
float m_energy
Definition
CaloTopoSplitterHashCluster.h:43
CaloTopoTmpHashCell::getCaloTopoTmpClusterCell
const T * getCaloTopoTmpClusterCell() const
Definition
CaloTopoTmpHashCell.h:59
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::add
void add(HashCell &hashCell)
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::m_members
pointer_list m_members
Definition
CaloTopoTmpHashClusterBase.h:38
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::end
iterator end()
Definition
CaloTopoTmpHashClusterBase.h:95
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::m_maxRatio
float m_maxRatio
Definition
CaloTopoTmpHashClusterBase.h:39
CaloTopoTmpHashClusterBase< CaloTopoSplitterClusterCell >::begin
iterator begin()
Definition
CaloTopoTmpHashClusterBase.h:90
CxxUtils::pointer_list::iterator
Forward iterator over the list.
Definition
pointer_list.h:281
xAOD::CaloCluster_v1::cell_iterator
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version).
Definition
CaloCluster_v1.h:819
Generated on
for ATLAS Offline Software by
1.17.0