ATLAS Offline Software
Loading...
Searching...
No Matches
EMBE1CellsFromCaloCells.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace GlobalSim {
8
10 const std::string& name,
11 const IInterface* parent):
12 base_class(type, name, parent){
13 }
14
16 CHECK(m_caloCellsKey.initialize());
17 return StatusCode::SUCCESS;
18 }
19
20 StatusCode
21 EMBE1CellsFromCaloCells::cells(std::vector<const CaloCell*>& cells,
22 const EventContext& ctx) const {
23
24 // Read in a container containing all CaloCells
26
27 h_caloCells = SG::makeHandle(m_caloCellsKey, ctx);
28 CHECK(h_caloCells.isValid());
29
30 const auto& allCaloCells = *h_caloCells;
31 ATH_MSG_DEBUG("allCaloCells size " << allCaloCells.size());
33 if(!allCaloCells.checkOrderedAndComplete()){
34 ATH_MSG_ERROR("CaloCellCollection fails checks");
35 return StatusCode::FAILURE;
36 }
37 }
38
39
40 // lambda to select EMB1 and EME1 cells
41 auto EMBE1_sel = [](const CaloCell* cell) {
42 if (cell->caloDDE()->getSampling() == CaloCell_Base_ID::EMB1 || cell->caloDDE()->getSampling() == CaloCell_Base_ID::EME1){
43 return true;
44 } else {
45 return false;
46 }
47 };
48
49
50 std::copy_if(allCaloCells.beginConstCalo(CaloCell_ID::LAREM),
51 allCaloCells.endConstCalo(CaloCell_ID::LAREM),
52 std::back_inserter(cells),
53 EMBE1_sel);
54
55
56 return StatusCode::SUCCESS;
57 }
58}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
SG::ReadHandleKey< CaloCellContainer > m_caloCellsKey
virtual StatusCode initialize() override
virtual StatusCode cells(std::vector< const CaloCell * > &, const EventContext &) const override
EMBE1CellsFromCaloCells(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< bool > m_makeCaloCellContainerChecks
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())