ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
egammaD3PDAnalysis
src
egammaSumCellsGainAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id: egammaSumCellsGainAlg.cxx 775880 2016-09-29 15:35:25Z ssnyder $
12
13
14
#include "
egammaSumCellsGainAlg.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
egammaSumCellsGainAlg::egammaSumCellsGainAlg
(
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
egammaSumCellsGainAlg::initialize
()
42
{
43
CHECK
( AthAlgorithm::initialize() );
44
CHECK
(
m_getter
.retrieve() );
45
CHECK
(
m_getter
->configureD3PD<
xAOD::Egamma
>() );
46
return
StatusCode::SUCCESS;
47
}
48
49
53
StatusCode
egammaSumCellsGainAlg::execute
(
const
EventContext&
/*ctx*/
)
54
{
55
StatusCode
sc
= StatusCode::SUCCESS;
56
57
ATH_MSG_DEBUG
(
" In execute: Getting egamma Objects "
);
58
59
#define DECOR(TYPE,N) xAOD::Egamma::Decorator<TYPE> N (m_auxPrefix + #N)
60
DECOR
(
float
, Es0LowGain);
61
DECOR
(
float
, Es0MedGain);
62
DECOR
(
float
, Es0HighGain);
63
64
DECOR
(
float
, Es1LowGain);
65
DECOR
(
float
, Es1MedGain);
66
DECOR
(
float
, Es1HighGain);
67
68
DECOR
(
float
, Es2LowGain);
69
DECOR
(
float
, Es2MedGain);
70
DECOR
(
float
, Es2HighGain);
71
72
DECOR
(
float
, Es3LowGain);
73
DECOR
(
float
, Es3MedGain);
74
DECOR
(
float
, Es3HighGain);
75
#undef DECOR
76
77
CHECK
(
m_getter
->reset (
m_allowMissing
) );
78
while
(
const
xAOD::Egamma
* eg =
m_getter
->next<
xAOD::Egamma
>()){
79
const
xAOD::CaloCluster
*cluster = eg->caloCluster();
80
81
float
cell_sum_energy_gainlow[4];
82
float
cell_sum_energy_gainmed[4];
83
float
cell_sum_energy_gainhgh[4];
84
for
(
int
i=0; i<4; i++){
85
cell_sum_energy_gainlow[i]=0;
86
cell_sum_energy_gainmed[i]=0;
87
cell_sum_energy_gainhgh[i]=0;
88
}
89
90
ATH_MSG_DEBUG
(
" Checking Cluster "
);
91
92
if
(cluster) {
93
if
(cluster->
getCellLinks
()) {
94
95
for
(
const
CaloCell
* cell : *cluster) {
96
int
sampling = cell->caloDDE()->getSampling();
97
int
layer = -1;
98
switch
(sampling){
99
case
CaloCell_ID::PreSamplerB:
100
case
CaloCell_ID::PreSamplerE:
101
layer=0;
102
break
;
103
case
CaloCell_ID::EMB1:
104
case
CaloCell_ID::EME1:
105
layer=1;
106
break
;
107
case
CaloCell_ID::EMB2:
108
case
CaloCell_ID::EME2:
109
layer=2;
110
break
;
111
case
CaloCell_ID::EMB3:
112
case
CaloCell_ID::EME3:
113
layer=3;
114
break
;
115
default
:
116
break
;
117
}
118
119
if
(layer < 0)
continue
;
120
121
switch
(cell->gain()){
122
case
0: cell_sum_energy_gainhgh[layer] += cell->energy();
break
;
123
case
1: cell_sum_energy_gainmed[layer] += cell->energy();
break
;
124
case
2: cell_sum_energy_gainlow[layer] += cell->energy();
break
;
125
default
:
break
;
126
}
127
}
128
}
129
}
130
131
Es0LowGain(*eg) = cell_sum_energy_gainlow[0];
132
Es0MedGain(*eg) = cell_sum_energy_gainmed[0];
133
Es0HighGain(*eg) = cell_sum_energy_gainhgh[0];
134
135
Es1LowGain(*eg) = cell_sum_energy_gainlow[1];
136
Es1MedGain(*eg) = cell_sum_energy_gainmed[1];
137
Es1HighGain(*eg) = cell_sum_energy_gainhgh[1];
138
139
Es2LowGain(*eg) = cell_sum_energy_gainlow[2];
140
Es2MedGain(*eg) = cell_sum_energy_gainmed[2];
141
Es2HighGain(*eg) = cell_sum_energy_gainhgh[2];
142
143
Es3LowGain(*eg) = cell_sum_energy_gainlow[3];
144
Es3MedGain(*eg) = cell_sum_energy_gainmed[3];
145
Es3HighGain(*eg) = cell_sum_energy_gainhgh[3];
146
147
m_getter
->releaseElement (eg);
148
}
149
150
return
sc
;
151
}
152
153
154
}
// namespace D3PD
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
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
D3PD::egammaSumCellsGainAlg::m_allowMissing
bool m_allowMissing
Property: If true, don't complain if input objects are missing.
Definition
egammaSumCellsGainAlg.h:63
D3PD::egammaSumCellsGainAlg::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition
egammaSumCellsGainAlg.cxx:41
D3PD::egammaSumCellsGainAlg::m_auxPrefix
std::string m_auxPrefix
Property: Prefix to add to aux data items.
Definition
egammaSumCellsGainAlg.h:57
D3PD::egammaSumCellsGainAlg::egammaSumCellsGainAlg
egammaSumCellsGainAlg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
Definition
egammaSumCellsGainAlg.cxx:24
D3PD::egammaSumCellsGainAlg::m_getter
ToolHandle< ICollectionGetterTool > m_getter
Property: Getter for input egamma objects.
Definition
egammaSumCellsGainAlg.h:60
D3PD::egammaSumCellsGainAlg::execute
virtual StatusCode execute(const EventContext &ctx)
Standard Gaudi execute method.
Definition
egammaSumCellsGainAlg.cxx:53
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)
egammaSumCellsGainAlg.h
Sum cell energies with given gain.
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