ATLAS Offline Software
Loading...
Searching...
No Matches
TrigGepPerf/src/EMB1CellsFromCaloCells.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <algorithm> //copy_if
7
9 const std::string& name,
10 const IInterface* parent):
11 base_class(type, name, parent){
12}
13
15 CHECK(m_caloCellsKey.initialize());
16 CHECK(detStore()->retrieve (m_calocell_id, "CaloCell_ID"));
17
18 return StatusCode::SUCCESS;
19}
20
21StatusCode
22EMB1CellsFromCaloCells::cells(std::vector<std::vector<const CaloCell*>>& cells,
23 const EventContext& ctx) const {
24 // Read in a container containing (all) CaloCells
25
26 auto h_caloCells = SG::makeHandle(m_caloCellsKey, ctx);
27 CHECK(h_caloCells.isValid());
28
29 const auto & allCaloCells = *h_caloCells;
30
31
32 // limit cells to LAREM CaloCells
33 if(! allCaloCells.hasCalo(m_calocell_id->LAREM)){
34 ATH_MSG_ERROR("CaloCellCollection does not contain LAREM cells");
35 return StatusCode::FAILURE;
36 }
37
38 std::vector<const CaloCell*>
39 laremCells(allCaloCells.beginConstCalo(CaloCell_ID::LAREM),
40 allCaloCells.endConstCalo(CaloCell_ID::LAREM));
41
42 // selector
43 auto EMB1_sel = [&calocell_id=m_calocell_id](const CaloCell* cell) {
44 return
45 calocell_id->calo_sample(calocell_id->calo_cell_hash(cell->ID())) ==
46 CaloCell_Base_ID::EMB1;
47 };
48
49
50 std::vector<const CaloCell*> emb1_cells;
51 std::copy_if(laremCells.cbegin(),
52 laremCells.cend(),
53 std::back_inserter(emb1_cells),
54 EMB1_sel);
55
56 cells.push_back(std::move(emb1_cells));
57
58 return StatusCode::SUCCESS;
59}
#define ATH_MSG_ERROR(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
EMB1CellsFromCaloCells(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadHandleKey< CaloCellContainer > m_caloCellsKey
virtual StatusCode cells(std::vector< std::vector< const CaloCell * > > &, const EventContext &) const override
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())