ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HighGranularityTimingDetector
HGTD_Digitization
HGTD_Overlay
src
HGTD_Overlay.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
HGTD_Overlay.h
"
6
7
#include <
IDC_OverlayBase/IDC_OverlayHelpers.h
>
8
9
10
namespace
Overlay
11
{
12
// Specialize mergeChannelData() for the HGTD
13
template
<>
14
void
mergeChannelData
(
HGTD_RDO
&
/* baseDatum */
,
15
const
HGTD_RDO
&
/* additionalDatum */
,
16
const
IDC_OverlayBase
*
algorithm
)
17
{
18
algorithm
->msg(MSG::DEBUG) <<
"Overlay::mergeChannelData<HGTD_RDORawData>(): "
19
<<
"Merging of data on the same channel is not explicitly implemented for HGTD_RDORawData"
<<
endmsg
;
20
}
21
22
// Specialize copyCollection() for the HGTD
23
template
<>
24
std::unique_ptr<HGTD_RDO_Collection>
copyCollection
(
const
IdentifierHash
&hashId,
25
const
HGTD_RDO_Collection
*collection)
26
{
27
auto
outputCollection = std::make_unique<HGTD_RDO_Collection>(hashId);
28
outputCollection->setIdentifier(collection->
identify
());
29
30
for
(
const
HGTD_RDO
*existingDatum : *collection) {
31
// Owned by the collection
32
auto
*datumCopy =
new
HGTD_RDO
(existingDatum->identify(), existingDatum->getTOA(), existingDatum->getTOT(),
33
existingDatum->getBCID(), existingDatum->getL1ID(), existingDatum->getL1A());
34
outputCollection->push_back(datumCopy);
35
}
36
37
return
outputCollection;
38
}
39
}
// namespace Overlay
40
41
42
HGTD_Overlay::HGTD_Overlay
(
const
std::string &name, ISvcLocator *pSvcLocator)
43
:
IDC_OverlayBase
(name, pSvcLocator)
44
{
45
}
46
47
StatusCode
HGTD_Overlay::initialize
()
48
{
49
ATH_MSG_DEBUG
(
"Initializing..."
);
50
51
// Check and initialize keys
52
ATH_CHECK
(
m_bkgInputKey
.initialize(!
m_bkgInputKey
.key().empty()) );
53
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_bkgInputKey
);
54
ATH_CHECK
(
m_signalInputKey
.initialize() );
55
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_signalInputKey
);
56
ATH_CHECK
(
m_outputKey
.initialize() );
57
ATH_MSG_VERBOSE
(
"Initialized WriteHandleKey: "
<<
m_outputKey
);
58
59
return
StatusCode::SUCCESS;
60
}
61
62
StatusCode
HGTD_Overlay::execute
(
const
EventContext& ctx)
const
63
{
64
ATH_MSG_DEBUG
(
"execute() begin"
);
65
66
// Reading the input RDOs
67
ATH_MSG_VERBOSE
(
"Retrieving input RDO containers"
);
68
69
const
HGTD_RDO_Container
*bkgContainerPtr =
nullptr
;
70
if
(!
m_bkgInputKey
.empty()) {
71
SG::ReadHandle<HGTD_RDO_Container>
bkgContainer(
m_bkgInputKey
, ctx);
72
if
(!bkgContainer.
isValid
()) {
73
ATH_MSG_ERROR
(
"Could not get background HGTD RDO container "
<< bkgContainer.
name
() <<
" from store "
<< bkgContainer.
store
());
74
return
StatusCode::FAILURE;
75
}
76
bkgContainerPtr = bkgContainer.
cptr
();
77
78
ATH_MSG_DEBUG
(
"Found background HGTD RDO container "
<< bkgContainer.
name
() <<
" in store "
<< bkgContainer.
store
());
79
ATH_MSG_DEBUG
(
"HGTD Background = "
<<
Overlay::debugPrint
(bkgContainer.
cptr
()));
80
}
81
82
SG::ReadHandle<HGTD_RDO_Container>
signalContainer(
m_signalInputKey
, ctx);
83
if
(!signalContainer.
isValid
()) {
84
ATH_MSG_ERROR
(
"Could not get signal HGTD RDO container "
<< signalContainer.
name
() <<
" from store "
<< signalContainer.
store
());
85
return
StatusCode::FAILURE;
86
}
87
ATH_MSG_DEBUG
(
"Found signal HGTD RDO container "
<< signalContainer.
name
() <<
" in store "
<< signalContainer.
store
());
88
ATH_MSG_DEBUG
(
"HGTD Signal = "
<<
Overlay::debugPrint
(signalContainer.
cptr
()));
89
90
// Creating output RDO container
91
SG::WriteHandle<HGTD_RDO_Container>
outputContainer(
m_outputKey
, ctx);
92
ATH_CHECK
(outputContainer.
record
(std::make_unique<HGTD_RDO_Container>(signalContainer->size())));
93
if
(!outputContainer.
isValid
()) {
94
ATH_MSG_ERROR
(
"Could not record output HGTD RDO container "
<< outputContainer.
name
() <<
" to store "
<< outputContainer.
store
());
95
return
StatusCode::FAILURE;
96
}
97
ATH_MSG_DEBUG
(
"Recorded output HGTD RDO container "
<< outputContainer.
name
() <<
" in store "
<< outputContainer.
store
());
98
99
ATH_CHECK
(
overlayContainer
(bkgContainerPtr, signalContainer.
cptr
(), outputContainer.
ptr
()));
100
ATH_MSG_DEBUG
(
"HGTD Result = "
<<
Overlay::debugPrint
(outputContainer.
ptr
()));
101
102
ATH_MSG_DEBUG
(
"execute() end"
);
103
return
StatusCode::SUCCESS;
104
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
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
HGTD_Overlay.h
IDC_OverlayHelpers.h
HGTD_Overlay::HGTD_Overlay
HGTD_Overlay(const std::string &name, ISvcLocator *pSvcLocator)
Definition
HGTD_Overlay.cxx:42
HGTD_Overlay::m_bkgInputKey
SG::ReadHandleKey< HGTD_RDO_Container > m_bkgInputKey
Definition
HGTD_Overlay.h:22
HGTD_Overlay::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
HGTD_Overlay.cxx:62
HGTD_Overlay::m_signalInputKey
SG::ReadHandleKey< HGTD_RDO_Container > m_signalInputKey
Definition
HGTD_Overlay.h:23
HGTD_Overlay::initialize
virtual StatusCode initialize() override final
Definition
HGTD_Overlay.cxx:47
HGTD_Overlay::m_outputKey
SG::WriteHandleKey< HGTD_RDO_Container > m_outputKey
Definition
HGTD_Overlay.h:24
HGTD_RDO_Collection
Definition
HGTD_RDO_Collection.h:19
HGTD_RDO_Collection::identify
const Identifier & identify() const
Definition
HGTD_RDO_Collection.h:32
HGTD_RDO_Container
Definition
HGTD_RDO_Container.h:18
HGTD_RDO
Definition
HGTD_RDO.h:53
IDC_OverlayBase
Definition
IDC_OverlayBase.h:25
IDC_OverlayBase::IDC_OverlayBase
IDC_OverlayBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition
IDC_OverlayBase.h:27
IDC_OverlayBase::overlayContainer
StatusCode overlayContainer(const IDC_Container *bkgContainer, const IDC_Container *signalContainer, IDC_Container *outputContainer) const
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
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?
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
algorithm
std::string algorithm
Definition
hcg.cxx:87
Overlay
Helpers for overlaying Identifiable Containers.
Definition
HGTD_Overlay.cxx:11
Overlay::mergeChannelData
void mergeChannelData(HGTD_RDO &, const HGTD_RDO &, const IDC_OverlayBase *algorithm)
Definition
HGTD_Overlay.cxx:14
Overlay::debugPrint
std::string debugPrint(const IDC_Container *container, unsigned numprint=25)
Diagnostic output of Identifiable Containers.
Overlay::copyCollection
std::unique_ptr< HGTD_RDO_Collection > copyCollection(const IdentifierHash &hashId, const HGTD_RDO_Collection *collection)
Definition
HGTD_Overlay.cxx:24
Generated on
for ATLAS Offline Software by
1.17.0