ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Overlay
OverlayCopyAlgs
src
CopyTrackRecordCollection.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 "
CopyTrackRecordCollection.h
"
6
7
8
CopyTrackRecordCollection::CopyTrackRecordCollection
(
const
std::string &name, ISvcLocator *pSvcLocator)
9
:
AthReentrantAlgorithm
(name, pSvcLocator) { }
10
11
StatusCode
CopyTrackRecordCollection::initialize
()
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
22
ATH_CHECK
(
m_signalInputKey
.initialize() );
23
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_signalInputKey
);
24
ATH_CHECK
(
m_outputKey
.initialize() );
25
ATH_MSG_VERBOSE
(
"Initialized WriteHandleKey: "
<<
m_outputKey
);
26
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
CopyTrackRecordCollection::execute
(
const
EventContext& ctx)
const
31
{
32
ATH_MSG_DEBUG
(
"execute() begin"
);
33
34
// Reading the input containers
35
ATH_MSG_VERBOSE
(
"Retrieving input containers"
);
36
37
SG::ReadHandle<TrackRecordCollection>
signalContainer(
m_signalInputKey
, ctx);
38
if
(!signalContainer.
isValid
()) {
39
ATH_MSG_ERROR
(
"Could not get signal TrackRecordCollection container "
<< signalContainer.
name
() <<
" from store "
<< signalContainer.
store
());
40
return
StatusCode::FAILURE;
41
}
42
ATH_MSG_DEBUG
(
"Found signal TrackRecordCollection container "
<< signalContainer.
name
() <<
" in store "
<< signalContainer.
store
());
43
44
// Creating output RDO container
45
SG::WriteHandle<TrackRecordCollection>
outputContainer(
m_outputKey
, ctx);
46
ATH_CHECK
(outputContainer.
record
(std::make_unique<TrackRecordCollection>(
m_collectionName
)));
47
if
(!outputContainer.
isValid
()) {
48
ATH_MSG_ERROR
(
"Could not record output TrackRecordCollection container "
<< outputContainer.
name
() <<
" to store "
<< outputContainer.
store
());
49
return
StatusCode::FAILURE;
50
}
51
ATH_MSG_DEBUG
(
"Recorded output TrackRecordCollection container "
<< outputContainer.
name
() <<
" in store "
<< outputContainer.
store
());
52
53
// Copy signal TrackRecords
54
outputContainer->reserve(signalContainer->size());
55
for
(
const
TrackRecord
&record : *signalContainer) {
56
outputContainer->push_back(
TrackRecord
(record));
57
}
58
59
ATH_MSG_DEBUG
(
"execute() end"
);
60
return
StatusCode::SUCCESS;
61
}
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
CopyTrackRecordCollection.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CopyTrackRecordCollection::m_signalInputKey
SG::ReadHandleKey< TrackRecordCollection > m_signalInputKey
Definition
CopyTrackRecordCollection.h:21
CopyTrackRecordCollection::initialize
virtual StatusCode initialize() override
Definition
CopyTrackRecordCollection.cxx:11
CopyTrackRecordCollection::m_collectionName
Gaudi::Property< std::string > m_collectionName
Definition
CopyTrackRecordCollection.h:24
CopyTrackRecordCollection::m_outputKey
SG::WriteHandleKey< TrackRecordCollection > m_outputKey
Definition
CopyTrackRecordCollection.h:22
CopyTrackRecordCollection::CopyTrackRecordCollection
CopyTrackRecordCollection(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CopyTrackRecordCollection.cxx:8
CopyTrackRecordCollection::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CopyTrackRecordCollection.cxx:30
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?
TrackRecord
Definition
TrackRecord.h:12
Generated on
for ATLAS Offline Software by
1.17.0