ATLAS Offline Software
CopyCaloCalibrationHitContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 CopyCaloCalibrationHitContainer::CopyCaloCalibrationHitContainer(const std::string &name, ISvcLocator *pSvcLocator)
9  : AthReentrantAlgorithm(name, pSvcLocator) { }
10 
12 {
13  ATH_MSG_DEBUG("Initializing...");
14 
15  // Check that collection name is not empty
16  if (m_collectionName.empty()) {
17  ATH_MSG_ERROR("CaloCalibrationHitContainer collection name should not be empty");
18  return StatusCode::FAILURE;
19  }
20 
21  // Check and initialize keys
23  ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_signalInputKey);
25  ATH_MSG_VERBOSE("Initialized WriteHandleKey: " << m_outputKey);
26 
27  return StatusCode::SUCCESS;
28 }
29 
31 {
32  ATH_MSG_DEBUG("execute() begin");
33 
34  // Reading the input containers
35  ATH_MSG_VERBOSE("Retrieving input containers");
36 
38  if (!signalContainer.isValid()) {
39  ATH_MSG_ERROR("Could not get signal CaloCalibrationHitContainer container " << signalContainer.name() << " from store " << signalContainer.store());
40  return StatusCode::FAILURE;
41  }
42  ATH_MSG_DEBUG("Found signal CaloCalibrationHitContainer container " << signalContainer.name() << " in store " << signalContainer.store());
43 
44  // Creating output RDO container
46  ATH_CHECK(outputContainer.record(std::make_unique<CaloCalibrationHitContainer>(m_collectionName)));
47  if (!outputContainer.isValid()) {
48  ATH_MSG_ERROR("Could not record output CaloCalibrationHitContainer container " << outputContainer.name() << " to store " << outputContainer.store());
49  return StatusCode::FAILURE;
50  }
51  ATH_MSG_DEBUG("Recorded output CaloCalibrationHitContainer container " << outputContainer.name() << " in store " << outputContainer.store());
52 
53  // Copy signal CaloHits
54  for (const CaloCalibrationHit *record : *signalContainer) {
55  outputContainer->push_back(new CaloCalibrationHit(*record));
56  }
57 
58  ATH_MSG_DEBUG("execute() end");
59  return StatusCode::SUCCESS;
60 }
CopyCaloCalibrationHitContainer::CopyCaloCalibrationHitContainer
CopyCaloCalibrationHitContainer(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CopyCaloCalibrationHitContainer.cxx:8
CopyCaloCalibrationHitContainer::m_collectionName
Gaudi::Property< std::string > m_collectionName
Definition: CopyCaloCalibrationHitContainer.h:24
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
CopyCaloCalibrationHitContainer::m_signalInputKey
SG::ReadHandleKey< CaloCalibrationHitContainer > m_signalInputKey
Definition: CopyCaloCalibrationHitContainer.h:21
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
AthenaHitsVector::push_back
void push_back(T *t)
Definition: AthenaHitsVector.h:153
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition: StoreGate/src/VarHandleBase.cxx:376
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CopyCaloCalibrationHitContainer.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
CopyCaloCalibrationHitContainer::m_outputKey
SG::WriteHandleKey< CaloCalibrationHitContainer > m_outputKey
Definition: CopyCaloCalibrationHitContainer.h:22
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
CaloCalibrationHit
Class to store calorimeter calibration hit.
Definition: CaloCalibrationHit.h:23
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::WriteHandle< CaloCalibrationHitContainer >
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CopyCaloCalibrationHitContainer::initialize
virtual StatusCode initialize() override
Definition: CopyCaloCalibrationHitContainer.cxx:11
CopyCaloCalibrationHitContainer::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: CopyCaloCalibrationHitContainer.cxx:30