19#include "CaloGeoHelpers/CaloSampling.h"
37 std::vector<bool> acceptedSamplings(
m_caloID->Unknown,
false);
38 std::vector<CaloSampling::CaloSample> acceptedSamples;
43 if (sampInd != CaloSampling::Unknown) {
44 acceptedSamplings[sampInd] =
true;
45 acceptedSamples.push_back(sampInd);
51 if (msgLvl(MSG::DEBUG)) {
53 msg(MSG::DEBUG) <<
"Accepted calo samplings: ";
54 std::vector<CaloSampling::CaloSample>::iterator itSampling = acceptedSamples.begin();
55 for (; itSampling < acceptedSamples.end(); ++itSampling) {
56 msg(MSG::DEBUG) << (int) (*itSampling) <<
"; ";
60 msg(MSG::DEBUG) <<
"Accepted sub calos: ";
61 std::vector<CaloCell_ID::SUBCALO>::iterator itCalo =
m_acceptedCalos.begin();
63 msg(MSG::DEBUG) << (int) (*itCalo) <<
"; ";
73 if (acceptedSamplings[
m_caloID->calo_sample(cellHash)]) {
80 if (acceptedSamplings[
m_caloID->calo_sample(cellHash)]) {
89 return StatusCode::SUCCESS;
94 const EventContext& ctx)
const
101 std::vector<CaloCell_ID::SUBCALO>::const_iterator it =
m_acceptedCalos.begin();
103 if (srcCont->hasCalo(*it)) theCont->
setHasCalo(*it);
106 return StatusCode::SUCCESS;
111 const EventContext& ctx)
const
118 std::vector<CaloCell_ID::SUBCALO>::const_iterator it =
m_acceptedCalos.begin();
120 if (srcCont->hasCalo(*it)) theCont->
setHasCalo(*it);
123 return StatusCode::SUCCESS;
139 return StatusCode::SUCCESS;
147 std::vector<bool> notInContainer(
m_hashMax,
true);
149 for (; itCell != destCont->
end(); ++itCell) {
150 notInContainer[(*itCell)->caloDDE()->calo_hash()] =
false;
156 if (notInContainer[*it]) {
163 return StatusCode::SUCCESS;
174 for (; itSrcCell != srcCont->
end(); ++itSrcCell) {
176 cellHash = cell->caloDDE()->calo_hash();
181 return StatusCode::SUCCESS;
189 std::vector<bool> notInContainer(
m_hashMax,
true);
191 for (; itCell != destCont->
end(); ++itCell) {
192 notInContainer[(*itCell)->caloDDE()->calo_hash()] =
false;
198 for (; itSrcCell != srcCont->
end(); ++itSrcCell) {
200 cellHash = cell->caloDDE()->calo_hash();
206 return StatusCode::SUCCESS;
210template <
class CONTAINER>
213 CONTAINER* destCont)
const
219 if (cell) destCont->push_back_fast(cell->clone());
222 destCont->resetLookUpTable();
223 return StatusCode::SUCCESS;
227template <
class CONTAINER>
230 CONTAINER* destCont)
const
233 std::vector<bool> notInContainer(
m_hashMax,
true);
235 for (; itCell != destCont->end(); ++itCell) {
236 notInContainer[(*itCell)->caloDDE()->calo_hash()] =
false;
242 if (notInContainer[*it]) {
244 if (cell) destCont->push_back_fast(cell->clone());
248 destCont->resetLookUpTable();
249 return StatusCode::SUCCESS;
253template <
class CONTAINER>
256 CONTAINER* destCont)
const
261 for (; itSrcCell != srcCont->
end(); ++itSrcCell) {
263 cellHash = cell->caloDDE()->calo_hash();
265 destCont->push_back_fast(cell->clone());
268 destCont->resetLookUpTable();
269 return StatusCode::SUCCESS;
273template <
class CONTAINER>
276 CONTAINER* destCont)
const
278 std::vector<bool> notInContainer(
m_hashMax,
true);
280 for (; itCell != destCont->end(); ++itCell) {
281 notInContainer[(*itCell)->caloDDE()->calo_hash()] =
false;
287 for (; itSrcCell != srcCont->
end(); ++itSrcCell) {
289 cellHash = cell->caloDDE()->calo_hash();
291 destCont->push_back_fast(cell->clone());
294 destCont->resetLookUpTable();
295 return StatusCode::SUCCESS;
305 COPY_CELLS copyCells;
313 REPORT_ERROR(StatusCode::FAILURE) <<
"Can't copy to a non-const view container.";
314 return StatusCode::FAILURE;
324 REPORT_ERROR(StatusCode::FAILURE) <<
"Can't copy to a non-const view container.";
325 return StatusCode::FAILURE;
329 return (this->*copyCells)(srcCont, destCont);
339 COPY_CONST_CELLS copyConstCells;
362 return (this->*copyConstCells)(srcCont, destCont);
#define ATH_CHECK
Evaluate an expression and check for errors.
CaloCellContainer that can accept const cell pointers.
Helpers for checking error return status codes and reporting errors.
#define REPORT_ERROR(SC)
Report an error.
Container class for CaloCell.
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
void setHasCalo(const CaloCell_ID::SUBCALO caloNum)
set which calo has been filled.
Data object for each calorimeter readout cell.
CaloCellContainer that can accept const cell pointers.
void setHasCalo(CaloCell_ID::SUBCALO caloNum)
set which calo has been filled.
void push_back_fast(const CaloCell *cell)
reimplementation of push_back to gain speed in readin
void resetLookUpTable()
reset look up table
static CaloSampling::CaloSample getSamplingId(const std::string &samplingName)
Returns the CaloSampling::CaloSample enumerator value.
static bool getCalos(const std::vector< CaloSampling::CaloSample > &theSamplings, std::vector< CaloCell_ID::SUBCALO > &theCalos)
Returns a list of sub-calos for a list of samplings.
iterator begin() noexcept
Return an iterator pointing at the beginning of the collection.
iterator end() noexcept
Return an iterator pointing past the end of the collection.
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
This is a "hash" representation of an Identifier.
const_pointer_type cptr()
Dereference the pointer.
@ OWN_ELEMENTS
this data object owns its elements