ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigGepPerf
src
EMB1CellsFromCaloClusters.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 "
EMB1CellsFromCaloClusters.h
"
6
#include "
CxxUtils/prefetch.h
"
7
#include <algorithm>
//copy_if
8
EMB1CellsFromCaloClusters::EMB1CellsFromCaloClusters
(
const
std::string&
type
,
9
const
std::string& name,
10
const
IInterface* parent):
11
base_class(
type
, name, parent){
12
}
13
14
StatusCode
EMB1CellsFromCaloClusters::initialize
() {
15
CHECK
(
m_caloClustersKey
.initialize());
16
17
return
StatusCode::SUCCESS;
18
}
19
20
StatusCode
21
EMB1CellsFromCaloClusters::cells
(std::vector<std::vector<const CaloCell*>>&
cells
,
22
const
EventContext& ctx)
const
{
23
// Read in a container containing CaloClusters
24
25
auto
h_caloClusters =
SG::makeHandle
(
m_caloClustersKey
, ctx);
26
CHECK
(h_caloClusters.isValid());
27
28
auto
dvec = *h_caloClusters;
29
ATH_MSG_DEBUG
(
"number of retrieved clusters: "
<< dvec.size());
30
31
const
CaloCell_ID
* calocell_id{
nullptr
};
32
CHECK
(detStore()->retrieve (calocell_id,
"CaloCell_ID"
));
33
34
// selector
35
auto
EMB1_sel = [&calocell_id](
const
CaloCell
* cell) {
36
return
37
calocell_id->
calo_sample
(calocell_id->
calo_cell_hash
(cell->ID())) ==
38
CaloCell_Base_ID::EMB1;
39
};
40
41
42
43
44
for
(
const
auto
cl : dvec){
45
const
auto
*cell_links = cl->getCellLinks();
46
if
(!cell_links){
47
ATH_MSG_ERROR
(
"No link from cluster to cells"
);
48
return
StatusCode::FAILURE;
49
}
else
{
50
ATH_MSG_DEBUG
(
"Number of cells from cell_links "
<< cell_links->size());
51
}
52
53
54
auto
c_iter = cell_links->begin();
55
auto
c_end = cell_links->end();
56
57
std::vector<const CaloCell*> cluster_cells;
58
std::copy_if(c_iter,
59
c_end,
60
std::back_inserter(cluster_cells),
61
EMB1_sel);
62
63
// having less than two cells in the selected cell container
64
// will mess up the simple seed selection procedure, so
65
// add a requirement on the number of selected cells.
66
if
(cluster_cells.size() > 1) {
67
cells
.push_back(std::move(cluster_cells));
68
}
69
}
70
71
return
StatusCode::SUCCESS;
72
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
EMB1CellsFromCaloClusters.h
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
CaloCell_Base_ID::calo_sample
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Definition
CaloCell_Base_ID.cxx:140
CaloCell_ID
Helper class for offline cell identifiers.
Definition
CaloCell_ID.h:34
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
EMB1CellsFromCaloClusters::initialize
virtual StatusCode initialize() override
Definition
EMB1CellsFromCaloClusters.cxx:14
EMB1CellsFromCaloClusters::EMB1CellsFromCaloClusters
EMB1CellsFromCaloClusters(const std::string &type, const std::string &name, const IInterface *parent)
Definition
EMB1CellsFromCaloClusters.cxx:8
EMB1CellsFromCaloClusters::cells
virtual StatusCode cells(std::vector< std::vector< const CaloCell * > > &, const EventContext &) const override
Definition
EMB1CellsFromCaloClusters.cxx:21
EMB1CellsFromCaloClusters::m_caloClustersKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClustersKey
Definition
EMB1CellsFromCaloClusters.h:33
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
prefetch.h
Functions to prefetch blocks of memory.
type
Generated on
for ATLAS Offline Software by
1.17.0