ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
egammaD3PDAnalysis
src
egammaMaxECellAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id: egammaMaxECellAlg.cxx 775884 2016-09-29 15:57:53Z ssnyder $
12
13
14
#include "
egammaMaxECellAlg.h
"
15
#include "
D3PDMakerInterfaces/ICollectionGetterTool.h
"
16
#include "
xAODEgamma/Egamma.h
"
17
#include "
xAODCaloEvent/CaloCluster.h
"
18
#include "
AthenaKernel/errorcheck.h
"
19
20
21
namespace
D3PD
{
22
23
24
egammaMaxECellAlg::egammaMaxECellAlg
(
const
std::string& name,
25
ISvcLocator* svcloc)
26
:
AthAlgorithm
(name, svcloc),
27
m_getter
(this)
28
{
29
declareProperty
(
"AuxPrefix"
,
m_auxPrefix
,
30
"Prefix to add to aux data items."
);
31
declareProperty
(
"AllowMissing"
,
m_allowMissing
=
false
,
32
"If true, don't complain if input objects are missing."
);
33
declareProperty
(
"Getter"
,
m_getter
,
34
"Getter instance for the input egamma objects."
);
35
}
36
37
41
StatusCode
egammaMaxECellAlg::initialize
()
42
{
43
ATH_MSG_INFO
(
" Starting egammaMaxECellAlg"
);
44
45
CHECK
( AthAlgorithm::initialize() );
46
CHECK
(
m_cablingKey
.initialize() );
47
CHECK
(
m_getter
.retrieve() );
48
CHECK
(
m_getter
->configureD3PD<
xAOD::Egamma
>() );
49
return
StatusCode::SUCCESS;
50
}
51
52
56
StatusCode
egammaMaxECellAlg::execute
(
const
EventContext& ctx)
57
{
58
StatusCode
sc
= StatusCode::SUCCESS;
59
60
#define DECOR(TYPE,N) xAOD::Egamma::Decorator<TYPE> N (m_auxPrefix + #N)
61
DECOR
(
float
, maxEcell_time);
62
DECOR
(
float
, maxEcell_energy);
63
DECOR
(
int
, maxEcell_gain);
64
DECOR
(
unsigned
int
, maxEcell_onlId);
65
DECOR
(
float
, maxEcell_x);
66
DECOR
(
float
, maxEcell_y);
67
DECOR
(
float
, maxEcell_z);
68
#undef DECOR
69
70
CHECK
(
m_getter
->reset (
m_allowMissing
) );
71
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
, ctx};
72
const
LArOnOffIdMapping
* cabling{*cablingHdl};
73
if
(!cabling){
74
ATH_MSG_ERROR
(
"Do not have mapping object "
<<
m_cablingKey
.key() );
75
return
StatusCode::FAILURE;
76
}
77
while
(
const
xAOD::Egamma
* eg =
m_getter
->next<
xAOD::Egamma
>())
78
{
79
const
xAOD::CaloCluster
*cluster = eg->caloCluster();
80
81
maxEcell_time(*eg) = -9898.9;
82
maxEcell_energy(*eg) = -9898.9;
83
maxEcell_gain(*eg) = -1;
84
maxEcell_onlId(*eg) = 0;
85
86
maxEcell_x(*eg) = -9898.9;
87
maxEcell_y(*eg) = -9898.9;
88
maxEcell_z(*eg) = -9898.9;
89
90
if
(cluster){
91
if
(cluster->
getCellLinks
()){
92
93
float
emax=-9999.;
94
95
const
CaloCell
* cell_maxE=0;
96
for
(
const
CaloCell
* cell : *cluster) {
97
int
sampling = cell->caloDDE()->getSampling();
98
if
(sampling== CaloCell_ID::EMB2 || sampling== CaloCell_ID::EME2) {
99
if
( (cell->provenance() & 0x2000) ) {
100
if
(cell->energy() > emax) {
101
emax=cell->energy();
102
cell_maxE=cell;
103
}
104
}
105
}
106
}
107
108
if
(cell_maxE){
109
const
CaloDetDescrElement
* caloDDEl = cell_maxE->
caloDDE
();
110
111
maxEcell_time(*eg) = cell_maxE->
time
();
112
maxEcell_energy(*eg) = cell_maxE->
energy
();
113
maxEcell_gain(*eg) = (int) cell_maxE->
gain
();
114
maxEcell_onlId(*eg) = (
unsigned
int) (cabling->createSignalChannelID(caloDDEl->
identify
())).get_compact();
115
116
maxEcell_x(*eg) = caloDDEl->
x
();
117
maxEcell_y(*eg) = caloDDEl->
y
();
118
maxEcell_z(*eg) = caloDDEl->
z
();
119
}
120
121
122
}
123
}
124
125
m_getter
->releaseElement (eg);
126
}
127
128
return
sc
;
129
}
130
131
132
}
// namespace D3PD
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Egamma.h
CaloCluster.h
ICollectionGetterTool.h
Abstract interface to get a collection of objects and iterate over it.
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloCell::time
float time() const
get time (data member)
Definition
CaloCell.h:368
CaloCell::energy
double energy() const
get energy (data member)
Definition
CaloCell.h:327
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition
CaloCell.h:321
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition
CaloCell.h:361
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrElement::y
float y() const
cell y
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
CaloDetDescrElement::identify
Identifier identify() const override final
cell identifier
Definition
CaloDetDescrElement.cxx:63
CaloDetDescrElement::x
float x() const
cell x
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
CaloDetDescrElement::z
float z() const
cell z
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:367
D3PD::egammaMaxECellAlg::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition
egammaMaxECellAlg.cxx:41
D3PD::egammaMaxECellAlg::m_allowMissing
bool m_allowMissing
Property: If true, don't complain if input objects are missing.
Definition
egammaMaxECellAlg.h:68
D3PD::egammaMaxECellAlg::egammaMaxECellAlg
egammaMaxECellAlg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
Definition
egammaMaxECellAlg.cxx:24
D3PD::egammaMaxECellAlg::execute
virtual StatusCode execute(const EventContext &ctx)
Standard Gaudi execute method.
Definition
egammaMaxECellAlg.cxx:56
D3PD::egammaMaxECellAlg::m_auxPrefix
std::string m_auxPrefix
Property: Prefix to add to aux data items.
Definition
egammaMaxECellAlg.h:62
D3PD::egammaMaxECellAlg::m_getter
ToolHandle< ICollectionGetterTool > m_getter
Property: Getter for input egamma objects.
Definition
egammaMaxECellAlg.h:65
D3PD::egammaMaxECellAlg::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
egammaMaxECellAlg.h:60
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
Definition
CaloCluster_v1.cxx:829
DECOR
#define DECOR(TYPE, N)
egammaMaxECellAlg.h
Find max E cell in middle layer for an egamma object EM Cluster and store in UserData.
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::Egamma
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition
Egamma.h:17
Generated on
for ATLAS Offline Software by
1.17.0