ATLAS Offline Software
Loading...
Searching...
No Matches
Global/GlobalSimulation/src/FirstChain/EMB1CellsFromCaloCells.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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 EMB1CellsFromCaloCells::cells(std::vector<const CaloCell*>& cells,
22 const EventContext& ctx) const {
23
24 // Read in a container containing all CaloCells
25
27
28 h_caloCells = SG::makeHandle(m_caloCellsKey, ctx);
29 CHECK(h_caloCells.isValid());
30
31 const auto& allCaloCells = *h_caloCells;
32 ATH_MSG_DEBUG("allCaloCells size " << allCaloCells.size());
34 if(!allCaloCells.checkOrderedAndComplete()){
35 ATH_MSG_ERROR("CaloCellCollection fails checks");
36 return StatusCode::FAILURE;
37 }
38 }
39
40
41 // lambda to select EMB1 cells
42 auto EMB1_sel = [](const CaloCell* cell) {
43 return cell->caloDDE()->getSampling() == CaloCell_Base_ID::EMB1;
44 };
45
46
47 std::copy_if(allCaloCells.beginConstCalo(CaloCell_ID::LAREM),
48 allCaloCells.endConstCalo(CaloCell_ID::LAREM),
49 std::back_inserter(cells),
50 EMB1_sel);
51
52
53 return StatusCode::SUCCESS;
54 }
55}
#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
virtual StatusCode cells(std::vector< const CaloCell * > &, const EventContext &) const override
EMB1CellsFromCaloCells(const std::string &type, const std::string &name, const IInterface *parent)
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())