ATLAS Offline Software
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 
19 #include "LArCellContFakeWriter.h"
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
32 #include "LArCellContFakeCreator.h"
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") );
48  return StatusCode::SUCCESS;
49 }
50 
51 // Execute method:
53 {
54  ATH_MSG_DEBUG("LArCellContFakeWriter::execute()" );
55 
57  ATH_CHECK(caloMgrHandle.isValid());
58 
59  LArCellContFakeCreator creator;
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 
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 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArCellContFakeWriter::LArCellContFakeWriter
LArCellContFakeWriter()
Avoid use of default constructor.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
LArCellContFakeWriter::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Need DD mgr to create cells.
Definition: LArCellContFakeWriter.h:75
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArCellContFakeWriter::finalize
virtual StatusCode finalize() override
Algorithm finalize at end of job.
Definition: LArCellContFakeWriter.cxx:109
CaloCell_ID.h
LArCellContFakeWriter.h
Test Algorithm for POOL I/O uses CaloCellContainer for LAr as test data.
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
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::execute
virtual StatusCode execute() override
Algorithm execute once per event.
Definition: LArCellContFakeWriter.cxx:52
LArCellContFakeWriter::initialize
virtual StatusCode initialize() override
Algorithm initialize at begin of job.
Definition: LArCellContFakeWriter.cxx:43
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
LArCellContFakeCreator
Create a CaloCellContainer with LArCells for POOL I/O tests algs.
Definition: LArCellContFakeCreator.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArCellContFakeCreator.h
Create a CaloCellContainer with LArCells for POOL I/O tests algs.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
LArCellContFakeWriter::m_calocellId
const CaloCell_ID * m_calocellId
Need id helper to create cells.
Definition: LArCellContFakeWriter.h:81
DeMoScan.first
bool first
Definition: DeMoScan.py:534
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArCellContFakeWriter::printCells
void printCells(const CaloCellContainer *larCont) const
Print out cell info.
Definition: LArCellContFakeWriter.cxx:81
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.