ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Overlay
OverlayCopyAlgs
src
CopyPRD_MultiTruthCollection.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CopyPRD_MultiTruthCollection.h
"
6
7
8
CopyPRD_MultiTruthCollection::CopyPRD_MultiTruthCollection
(
const
std::string &name, ISvcLocator *pSvcLocator)
9
:
AthReentrantAlgorithm
(name, pSvcLocator) { }
10
11
StatusCode
CopyPRD_MultiTruthCollection::initialize
()
12
{
13
ATH_MSG_DEBUG
(
"Initializing..."
);
14
15
// Check and initialize keys
16
ATH_CHECK
(
m_inputKey
.initialize() );
17
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_inputKey
);
18
ATH_CHECK
(
m_outputKey
.initialize() );
19
ATH_MSG_VERBOSE
(
"Initialized WriteHandleKey: "
<<
m_outputKey
);
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
CopyPRD_MultiTruthCollection::execute
(
const
EventContext& ctx)
const
25
{
26
ATH_MSG_DEBUG
(
"execute() begin"
);
27
// Reading the input container
28
ATH_MSG_VERBOSE
(
"Retrieving input container"
);
29
30
SG::ReadHandle<PRD_MultiTruthCollection>
inputContainer(
m_inputKey
, ctx);
31
if
(!inputContainer.
isValid
()) {
32
ATH_MSG_ERROR
(
"Could not get pileup PRD_MultiTruthCollection "
<< inputContainer.
name
() <<
" from store "
<< inputContainer.
store
());
33
return
StatusCode::FAILURE;
34
}
35
ATH_MSG_DEBUG
(
"Found pileup PRD_MultiTruthCollection "
<< inputContainer.
name
() <<
" in store "
<< inputContainer.
store
());
36
37
// Creating output RDO container
38
SG::WriteHandle<PRD_MultiTruthCollection>
outputContainer(
m_outputKey
, ctx);
39
ATH_CHECK
(outputContainer.
record
(std::make_unique<PRD_MultiTruthCollection>()));
40
if
(!outputContainer.
isValid
()) {
41
ATH_MSG_ERROR
(
"Could not record output PRD_MultiTruthCollection "
<< outputContainer.
name
() <<
" to store "
<< outputContainer.
store
());
42
return
StatusCode::FAILURE;
43
}
44
ATH_MSG_DEBUG
(
"Recorded output PRD_MultiTruthCollection container "
<< outputContainer.
name
() <<
" in store "
<< outputContainer.
store
());
45
46
for
(
const
std::pair<const Identifier, HepMcParticleLink>& element : *inputContainer){
47
outputContainer->emplace(element.first,element.second);
48
}
49
return
StatusCode::SUCCESS;
50
}
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_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CopyPRD_MultiTruthCollection.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CopyPRD_MultiTruthCollection::m_outputKey
SG::WriteHandleKey< PRD_MultiTruthCollection > m_outputKey
Definition
CopyPRD_MultiTruthCollection.h:22
CopyPRD_MultiTruthCollection::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CopyPRD_MultiTruthCollection.cxx:24
CopyPRD_MultiTruthCollection::initialize
virtual StatusCode initialize() override
Definition
CopyPRD_MultiTruthCollection.cxx:11
CopyPRD_MultiTruthCollection::CopyPRD_MultiTruthCollection
CopyPRD_MultiTruthCollection(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CopyPRD_MultiTruthCollection.cxx:8
CopyPRD_MultiTruthCollection::m_inputKey
SG::ReadHandleKey< PRD_MultiTruthCollection > m_inputKey
Definition
CopyPRD_MultiTruthCollection.h:21
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition
StoreGate/src/VarHandleBase.cxx:382
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Generated on
for ATLAS Offline Software by
1.17.0