ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
AtlasTest
DatabaseTest
AthenaPoolTest
src
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
19
#include "
LArCellContFakeWriter.h
"
20
21
// Event includes
22
#include "
CaloEvent/CaloCellContainer.h
"
23
24
// DetDescr includes
25
#include "
CaloIdentifier/CaloCell_ID.h
"
26
27
// Gaudi includes
28
#include "GaudiKernel/MsgStream.h"
29
#include "GaudiKernel/SmartDataPtr.h"
30
31
// test includes
32
#include "
LArCellContFakeCreator.h
"
33
34
35
// Constructor with parameters:
36
LArCellContFakeWriter::LArCellContFakeWriter
(
const
std::string &name,
37
ISvcLocator *pSvcLocator) :
38
AthAlgorithm
(name,pSvcLocator),
39
m_calocellId
(nullptr)
40
{}
41
42
// Initialize method:
43
StatusCode
LArCellContFakeWriter::initialize
()
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:
52
StatusCode
LArCellContFakeWriter::execute
(
const
EventContext& ctx)
53
{
54
ATH_MSG_DEBUG
(
"LArCellContFakeWriter::execute()"
);
55
56
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloMgrKey
, ctx};
57
ATH_CHECK
(caloMgrHandle.
isValid
());
58
59
LArCellContFakeCreator
creator;
60
61
// Create container
62
MsgStream log(msgSvc(), name());
63
CaloCellContainer
* caloCont = creator.
createCaloCellContainer
(
m_calocellId
,
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
81
void
LArCellContFakeWriter::printCells
(
const
CaloCellContainer
* caloCont)
const
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:
109
StatusCode
LArCellContFakeWriter::finalize
()
110
{
111
ATH_MSG_INFO
(
"LArCellContFakeWriter::finalize()"
);
112
113
return
StatusCode::SUCCESS;
114
}
115
116
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCellContainer.h
CaloCell_ID.h
LArCellContFakeCreator.h
Create a CaloCellContainer with LArCells for POOL I/O tests algs.
LArCellContFakeWriter.h
Test Algorithm for POOL I/O uses CaloCellContainer for LAr as test data.
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
DataVector< CaloCell >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
LArCellContFakeCreator
Create a CaloCellContainer with LArCells for POOL I/O tests algs.
Definition
LArCellContFakeCreator.h:37
LArCellContFakeCreator::createCaloCellContainer
CaloCellContainer * createCaloCellContainer(const CaloCell_ID *calocellId, const CaloDetDescrManager *caloMgr, MsgStream &log) const
Create a CaloCellContainer with LAr cells.
Definition
LArCellContFakeCreator.h:61
LArCellContFakeWriter::LArCellContFakeWriter
LArCellContFakeWriter()
Avoid use of default constructor.
LArCellContFakeWriter::m_calocellId
const CaloCell_ID * m_calocellId
Need id helper to create cells.
Definition
LArCellContFakeWriter.h:81
LArCellContFakeWriter::finalize
virtual StatusCode finalize() override
Algorithm finalize at end of job.
Definition
LArCellContFakeWriter.cxx:109
LArCellContFakeWriter::execute
virtual StatusCode execute(const EventContext &ctx) override
Algorithm execute once per event.
Definition
LArCellContFakeWriter.cxx:52
LArCellContFakeWriter::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Need DD mgr to create cells.
Definition
LArCellContFakeWriter.h:75
LArCellContFakeWriter::printCells
void printCells(const CaloCellContainer *larCont) const
Print out cell info.
Definition
LArCellContFakeWriter.cxx:81
LArCellContFakeWriter::initialize
virtual StatusCode initialize() override
Algorithm initialize at begin of job.
Definition
LArCellContFakeWriter.cxx:43
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
Generated on
for ATLAS Offline Software by
1.17.0