28 ATH_MSG_FATAL(
"No e-gamma collection provided for thinning. At least one "
29 "egamma collection (photons/electrons) must be provided!");
30 return StatusCode::FAILURE;
37 if (msgLvl(MSG::DEBUG)) {
51 if (msgLvl(MSG::DEBUG)) {
58 return StatusCode::SUCCESS;
67 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, char>> decon;
68 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decoE;
75 for (
int i = 0; i < 2; i++) {
86 for (
int i = 0; i < 2; i++) {
87 decon[i](*photon) =
res.nCells[i];
88 decoE[i](*photon) =
res.eCells[i];
96 decon.clear(); decon.reserve(2);
97 decoE.clear(); decoE.reserve(2);
99 for (
int i = 0; i < 2; i++) {
111 for (
int i = 0; i < 2; i++) {
112 decon[i](*electron) =
res.nCells[i];
113 decoE[i](*electron) =
res.eCells[i];
118 return StatusCode::SUCCESS;
139 double etamax = -999., phimax = -999.;
145 info.etamax = etamax;
146 info.phimax = phimax;
160 return StatusCode::FAILURE;
168 return StatusCode::FAILURE;
175 return StatusCode::FAILURE;
179 it_cell_e = cellLinks->
end();
183 std::pair<const CaloCell*,double> maxcell{
nullptr,0};
184 for(; it_cell != it_cell_e; ++it_cell) {
187 if (!cell->caloDDE()) {
189 << cell->eta() <<
" phi = " << cell->phi());
192 int layer = cell->caloDDE()->getSampling();
193 if (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) {
194 double w = it_cell.
weight();
195 double eCell = cell->energy();
199 maxcell.first = cell;
207 etamax = maxcell.first->caloDDE()->eta_raw();
208 phimax = maxcell.first->caloDDE()->phi_raw();
209 if (msgLvl(MSG::DEBUG)) {
211 double etaAmax = clus->
etamax(sam);
212 double phiAmax = clus->
phimax(sam);
215 <<
" maximum layer 2 energy cell, E = " << maxcell.first->energy()
216 <<
" check E = " << vemax
217 <<
" w = " << maxcell.second <<
"\n"
218 <<
" in calo frame, eta = " << etamax <<
" phi = " << phimax <<
"\n"
219 <<
" in ATLAS frame, eta = " << etaAmax <<
" phi = " << phiAmax);
222 ATH_MSG_WARNING(
"No layer 2 cell with positive energy ! Should never happen");
223 return StatusCode::FAILURE;
225 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::pair< std::vector< unsigned int >, bool > res
xAOD::ElectronContainer * electronContainer
xAOD::PhotonContainer * photonContainer
Container class for CaloCell.
Data object for each calorimeter readout cell.
const_iterator to loop over cells belonging to a cluster
weight_t weight() const
Accessor for weight associated to this cell.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
const CaloCellContainer * getCellContainer() const
Method to access underlying cell container.
const_iterator end() const
const end method
const DataLink< CaloCellContainer > & getCellContainerLink() const
const_iterator begin() const
const begin method
const ID_type & dataID() const
Get the key that we reference, as a string.
SG::WriteDecorHandleKeyArray< xAOD::EgammaContainer > m_SGKey_photons_decorations
IegammaCellRecoveryTool::Info decorateObject(const xAOD::Egamma *&egamma) const
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::WriteDecorHandleKeyArray< xAOD::EgammaContainer > m_SGKey_electrons_decorations
ToolHandle< IegammaCellRecoveryTool > m_egammaCellRecoveryTool
Pointer to the egammaCellRecoveryTool.
StatusCode findMaxECell(const xAOD::CaloCluster *clus, double &etamax, double &phimax) const
SG::ReadHandleKey< CaloCellContainer > m_SGKey_CaloCells
virtual StatusCode initialize() override final
SG::ReadHandleKey< xAOD::EgammaContainer > m_SGKey_photons
SG::ReadHandleKey< xAOD::EgammaContainer > m_SGKey_electrons
Gaudi::Property< bool > m_UseWeightForMaxCell
virtual double pt() const
transverse momentum
virtual double phi() const
phi in [-pi,pi[
virtual double eta() const
pseudo rapidity
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
float energy_max(const CaloSample sampling) const
Retrieve maximum cell energy in given sampling.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".