ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
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
5
#include "
EMB1CellsFromCaloCells.h
"
6
#include <algorithm>
//copy_if
7
8
EMB1CellsFromCaloCells::EMB1CellsFromCaloCells
(
const
std::string&
type
,
9
const
std::string& name,
10
const
IInterface* parent):
11
base_class(
type
, name, parent){
12
}
13
14
StatusCode
EMB1CellsFromCaloCells::initialize
() {
15
CHECK
(
m_caloCellsKey
.initialize());
16
CHECK
(detStore()->retrieve (
m_calocell_id
,
"CaloCell_ID"
));
17
18
return
StatusCode::SUCCESS;
19
}
20
21
StatusCode
22
EMB1CellsFromCaloCells::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
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
EMB1CellsFromCaloCells.h
CaloCell_Base_ID::LAREM
@ LAREM
Definition
CaloCell_Base_ID.h:45
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
EMB1CellsFromCaloCells::EMB1CellsFromCaloCells
EMB1CellsFromCaloCells(const std::string &type, const std::string &name, const IInterface *parent)
Definition
EMB1CellsFromCaloCells.cxx:8
EMB1CellsFromCaloCells::m_calocell_id
const CaloCell_ID * m_calocell_id
Definition
EMB1CellsFromCaloCells.h:38
EMB1CellsFromCaloCells::m_caloCellsKey
SG::ReadHandleKey< CaloCellContainer > m_caloCellsKey
Definition
EMB1CellsFromCaloCells.h:35
EMB1CellsFromCaloCells::cells
virtual StatusCode cells(std::vector< std::vector< const CaloCell * > > &, const EventContext &) const override
Definition
EMB1CellsFromCaloCells.cxx:22
EMB1CellsFromCaloCells::initialize
virtual StatusCode initialize() override
Definition
EMB1CellsFromCaloCells.cxx:14
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
type
Generated on
for ATLAS Offline Software by
1.17.0