ATLAS Offline Software
Loading...
Searching...
No Matches
LArCellContFakeWriter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
16
17
18
20
21// Event includes
23
24// DetDescr includes
26
27// Gaudi includes
28#include "GaudiKernel/MsgStream.h"
29#include "GaudiKernel/SmartDataPtr.h"
30
31// test includes
33
34
35// Constructor with parameters:
37 ISvcLocator *pSvcLocator) :
38 AthAlgorithm(name,pSvcLocator),
39 m_calocellId(nullptr)
40{}
41
42// Initialize method:
44{
45 ATH_MSG_INFO( "LArCellContFakeWriter::initialize()" );
46 ATH_CHECK( detStore()->retrieve(m_calocellId, "CaloCell_ID") );
47 ATH_CHECK(m_caloMgrKey.initialize());
48 return StatusCode::SUCCESS;
49}
50
51// Execute method:
53{
54 ATH_MSG_DEBUG("LArCellContFakeWriter::execute()" );
55
57 ATH_CHECK(caloMgrHandle.isValid());
58
60
61 // Create container
62 MsgStream log(msgSvc(), name());
64 *caloMgrHandle,
65 msg());
66
67 if (!caloCont) {
68 ATH_MSG_ERROR("LarCont has not been created !" );
69 return StatusCode::FAILURE;
70 }
71
72 // register the cell container into StoreGate
73 ATH_CHECK( evtStore()->record(caloCont,"CaloCellCont1") );
74
75 printCells(caloCont);
76
77 return StatusCode::SUCCESS;
78}
79
80// Print cells
82{
83 ATH_MSG_INFO("LArCellContFakeWriter::printRDOs()" );
84
85 // loop on all cells
86
87 CaloCellContainer::const_iterator first = caloCont->begin();
88 CaloCellContainer::const_iterator last = caloCont->end();
89
90 for(; first != last; ++first) {
91
92 ATH_MSG_INFO("CaloCell: id "
93 << m_calocellId->show_to_string((*first)->ID())
94 << " energy " << (*first)->energy()
95 << " time " << (*first)->time()
96 << " quality " << (*first)->quality()
97 << " provenance " << (*first)->provenance()
98 << std::setprecision(5)
99 << " eta " << (*first)->eta()
100 << " phi " << (*first)->phi()
101 );
102 }
103
104 ATH_MSG_DEBUG("LArCellContFakeWriter::printCells() end" );
105}
106
107
108// Finalize method:
110{
111 ATH_MSG_INFO("LArCellContFakeWriter::finalize()" );
112
113 return StatusCode::SUCCESS;
114}
115
116
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Create a CaloCellContainer with LArCells for POOL I/O tests algs.
Test Algorithm for POOL I/O uses CaloCellContainer for LAr as test data.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
Container class for CaloCell.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Create a CaloCellContainer with LArCells for POOL I/O tests algs.
CaloCellContainer * createCaloCellContainer(const CaloCell_ID *calocellId, const CaloDetDescrManager *caloMgr, MsgStream &log) const
Create a CaloCellContainer with LAr cells.
LArCellContFakeWriter()
Avoid use of default constructor.
virtual StatusCode execute() override
Algorithm execute once per event.
const CaloCell_ID * m_calocellId
Need id helper to create cells.
virtual StatusCode finalize() override
Algorithm finalize at end of job.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Need DD mgr to create cells.
void printCells(const CaloCellContainer *larCont) const
Print out cell info.
virtual StatusCode initialize() override
Algorithm initialize at begin of job.