ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Overlay
OverlayCopyAlgs
src
CopySCT_ClusterContainer.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 "
CopySCT_ClusterContainer.h
"
6
#include "
InDetPrepRawData/SCT_ClusterCollection.h
"
7
#include "
InDetPrepRawData/SCT_Cluster.h
"
8
#include "
InDetIdentifier/SCT_ID.h
"
9
10
CopySCT_ClusterContainer::CopySCT_ClusterContainer
(
const
std::string &name, ISvcLocator *pSvcLocator)
11
:
AthReentrantAlgorithm
(name, pSvcLocator) { }
12
13
StatusCode
CopySCT_ClusterContainer::initialize
()
14
{
15
ATH_MSG_DEBUG
(
"Initializing..."
);
16
17
// Check and initialize keys
18
ATH_CHECK
(
m_inputKey
.initialize() );
19
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_inputKey
);
20
ATH_CHECK
(
m_outputKey
.initialize() );
21
ATH_MSG_VERBOSE
(
"Initialized WriteHandleKey: "
<<
m_outputKey
);
22
23
ATH_CHECK
(
detStore
()->retrieve(
m_idHelper
,
"SCT_ID"
));
24
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
CopySCT_ClusterContainer::execute
(
const
EventContext& ctx)
const
29
{
30
ATH_MSG_DEBUG
(
"execute() begin"
);
31
// Reading the input container
32
ATH_MSG_VERBOSE
(
"Retrieving input container"
);
33
34
SG::ReadHandle<InDet::SCT_ClusterContainer>
inputContainer(
m_inputKey
, ctx);
35
if
(!inputContainer.
isValid
()) {
36
ATH_MSG_ERROR
(
"Could not get pileup SCT_ClusterContainer "
<< inputContainer.
name
() <<
" from store "
<< inputContainer.
store
());
37
return
StatusCode::FAILURE;
38
}
39
ATH_MSG_DEBUG
(
"Found pileup SCT_ClusterContainer "
<< inputContainer.
name
() <<
" in store "
<< inputContainer.
store
());
40
41
// Creating output RDO container
42
SG::WriteHandle<InDet::SCT_ClusterContainer>
outputContainer(
m_outputKey
, ctx);
43
ATH_CHECK
(outputContainer.
record
(std::make_unique<InDet::SCT_ClusterContainer>(
m_idHelper
->wafer_hash_max())));
44
if
(!outputContainer.
isValid
()) {
45
ATH_MSG_ERROR
(
"Could not record output SCT_ClusterContainer "
<< outputContainer.
name
() <<
" to store "
<< outputContainer.
store
());
46
return
StatusCode::FAILURE;
47
}
48
ATH_MSG_DEBUG
(
"Recorded output SCT_ClusterContainer container "
<< outputContainer.
name
() <<
" in store "
<< outputContainer.
store
());
49
50
for
(
const
InDet::SCT_ClusterCollection* col : *inputContainer){
51
InDet::SCT_ClusterCollection* newCol=
new
InDet::SCT_ClusterCollection(col->identifyHash());
52
newCol->setIdentifier(col->identify());
53
newCol->reserve(col->size());
54
for
(
const
InDet::SCT_Cluster
* clus : *col){
55
newCol->push_back(std::make_unique<InDet::SCT_Cluster>(*clus));
56
}
57
ATH_CHECK
(outputContainer->addCollection(newCol,newCol->identifyHash()));
58
}
59
return
StatusCode::SUCCESS;
60
}
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
CopySCT_ClusterContainer.h
SCT_ClusterCollection.h
SCT_Cluster.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CopySCT_ClusterContainer::m_idHelper
const SCT_ID * m_idHelper
Definition
CopySCT_ClusterContainer.h:26
CopySCT_ClusterContainer::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CopySCT_ClusterContainer.cxx:28
CopySCT_ClusterContainer::initialize
virtual StatusCode initialize() override
Definition
CopySCT_ClusterContainer.cxx:13
CopySCT_ClusterContainer::m_outputKey
SG::WriteHandleKey< InDet::SCT_ClusterContainer > m_outputKey
Definition
CopySCT_ClusterContainer.h:24
CopySCT_ClusterContainer::m_inputKey
SG::ReadHandleKey< InDet::SCT_ClusterContainer > m_inputKey
Definition
CopySCT_ClusterContainer.h:23
CopySCT_ClusterContainer::CopySCT_ClusterContainer
CopySCT_ClusterContainer(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CopySCT_ClusterContainer.cxx:10
InDet::SCT_Cluster
Definition
SCT_Cluster.h:34
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