ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
egamma
egammaCaloUtils
src
findMaxECell.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
egammaCaloUtils/findMaxECell.h
"
6
7
#include "
CaloEvent/CaloClusterCellLinkContainer.h
"
8
#include "
CaloEvent/CaloCellContainer.h
"
9
10
namespace
egammaCellUtils
11
{
12
MaxECell::MaxECell
(
13
const
xAOD::CaloCluster
*clus,
14
const
std::string &cellCKey,
bool
UseWeightForMaxCell) :
15
AthMessaging
(
"egammaCellUtils::MaxECell"
) {
16
17
const
CaloClusterCellLink
* cellLinks = clus->
getCellLinks
();
18
if
(!cellLinks) {
19
ATH_MSG_WARNING
(
"No cell link for cluster. Do nothing"
);
20
}
else
{
21
22
// First check :
23
const
CaloCellContainer
*caloCells = cellLinks->
getCellContainer
();
24
if
(!caloCells) {
25
ATH_MSG_WARNING
(
"No cells for cluster. Do nothing"
);
26
}
else
if
(cellLinks->
getCellContainerLink
().
dataID
() != cellCKey) {
27
// Second check :
28
// one might have used a custom cell container for the linked cells
29
ATH_MSG_ERROR
(
"Wrong key for the calo cells"
);
30
}
else
{
31
32
CaloClusterCellLink::const_iterator
it_cell = cellLinks->
begin
(),
33
it_cell_e = cellLinks->
end
();
34
35
// find maximum cell energy in layer 2
36
double
emax = 0.;
37
std::pair<const CaloCell*,double> maxcell{
nullptr
,0};
//just for debug
38
for
(; it_cell != it_cell_e; ++it_cell) {
39
const
CaloCell
* cell = (*it_cell);
40
if
(cell) {
41
if
(!cell->caloDDE()) {
42
ATH_MSG_WARNING
(
"Calo cell without detector element ?? eta = "
43
<< cell->eta() <<
" phi = "
<< cell->phi());
44
continue
;
45
}
46
int
layer = cell->caloDDE()->getSampling();
47
if
(layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) {
48
double
w = it_cell.
weight
();
49
double
eCell = cell->energy();
50
if
(UseWeightForMaxCell) eCell *= w;
51
if
(eCell > emax) {
52
emax = eCell;
53
maxcell.first = cell;
54
maxcell.second = w;
55
}
56
}
57
}
58
}
59
60
if
(emax > 0) {
61
etaCell
= maxcell.first->caloDDE()->eta_raw();
62
phiCell
= maxcell.first->caloDDE()->phi_raw();
63
if
(
msgLvl
(MSG::DEBUG)) {
64
CaloSampling::CaloSample
sam = maxcell.first->caloDDE()->getSampling();
65
double
etaAmax = clus->
etamax
(sam);
66
double
phiAmax = clus->
phimax
(sam);
67
double
vemax = clus->
energy_max
(sam);
68
ATH_MSG_DEBUG
(
"Cluster energy in sampling 2 = "
<< clus->
energyBE
(2)
69
<<
" maximum layer 2 energy cell, E = "
<< maxcell.first->energy()
70
<<
" check E = "
<< vemax
71
<<
" w = "
<< maxcell.second <<
"\n"
72
<<
" in calo frame, eta = "
<<
etaCell
<<
" phi = "
<<
phiCell
<<
"\n"
73
<<
" in ATLAS frame, eta = "
<< etaAmax <<
" phi = "
<< phiAmax);
74
}
75
}
else
{
76
ATH_MSG_WARNING
(
"No layer 2 cell with positive energy ! Should never happen"
);
77
sc
= StatusCode::FAILURE;
78
}
79
sc
= StatusCode::SUCCESS;
80
}
// links OK, good cell container
81
}
// no links
82
}
// end function
83
}
84
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCellContainer.h
CaloClusterCellLinkContainer.h
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition
AthMessaging.h:151
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloClusterCellLink::const_iterator
const_iterator to loop over cells belonging to a cluster
Definition
CaloClusterCellLink.h:57
CaloClusterCellLink::const_iterator::weight
weight_t weight() const
Accessor for weight associated to this cell.
Definition
CaloClusterCellLink.h:82
CaloClusterCellLink
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
Definition
CaloClusterCellLink.h:24
CaloClusterCellLink::getCellContainer
const CaloCellContainer * getCellContainer() const
Method to access underlying cell container.
Definition
CaloClusterCellLink.h:212
CaloClusterCellLink::end
const_iterator end() const
const end method
Definition
CaloClusterCellLink.h:112
CaloClusterCellLink::getCellContainerLink
const DataLink< CaloCellContainer > & getCellContainerLink() const
Definition
CaloClusterCellLink.h:213
CaloClusterCellLink::begin
const_iterator begin() const
const begin method
Definition
CaloClusterCellLink.h:107
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
DataLink::dataID
const ID_type & dataID() const
Get the key that we reference, as a string.
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
Definition
CaloCluster_v1.cxx:829
xAOD::CaloCluster_v1::energy_max
float energy_max(const CaloSample sampling) const
Retrieve maximum cell energy in given sampling.
Definition
CaloCluster_v1.cxx:556
xAOD::CaloCluster_v1::energyBE
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
Definition
CaloCluster_v1.cxx:623
xAOD::CaloCluster_v1::etamax
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
Definition
CaloCluster_v1.cxx:569
xAOD::CaloCluster_v1::phimax
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
Definition
CaloCluster_v1.cxx:582
findMaxECell.h
egammaCellUtils
Definition
findMaxECell.h:13
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
egammaCellUtils::MaxECell::MaxECell
MaxECell()=delete
egammaCellUtils::MaxECell::etaCell
double etaCell
Definition
findMaxECell.h:16
egammaCellUtils::MaxECell::sc
StatusCode sc
Definition
findMaxECell.h:18
egammaCellUtils::MaxECell::phiCell
double phiCell
Definition
findMaxECell.h:17
Generated on
for ATLAS Offline Software by
1.17.0