ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HighGranularityTimingDetector
HGTD_Reconstruction
HGTD_RecAlgs
src
PadClusterizationAlg.cxx
Go to the documentation of this file.
1
8
9
#include "
PadClusterizationAlg.h
"
10
11
#include "
HGTD_Identifier/HGTD_ID.h
"
12
#include "
StoreGate/WriteHandle.h
"
13
#include "
AthenaMonitoringKernel/Monitored.h
"
14
15
namespace
HGTD
{
16
17
PadClusterizationAlg::PadClusterizationAlg
(
const
std::string& name,
18
ISvcLocator* pSvcLocator)
19
:
AthReentrantAlgorithm
(name, pSvcLocator) {}
20
21
StatusCode
PadClusterizationAlg::initialize
() {
22
23
ATH_CHECK
(
m_clusterization_tool
.retrieve());
24
ATH_CHECK
(
m_prd_wh_key
.initialize());
25
ATH_CHECK
(
m_altiroc_rdo_rh_key
.initialize(
m_use_altiroc_rdo
.value()));
26
ATH_CHECK
(
m_rdo_rh_key
.initialize(not
m_use_altiroc_rdo
.value()));
27
28
ATH_CHECK
(
detStore
()->retrieve(
m_hgtd_idhelper
,
"HGTD_ID"
));
29
ATH_CHECK
(
m_monTool
.retrieve(EnableTool{not m_monTool.empty()}));
30
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
PadClusterizationAlg::execute
(
const
EventContext& ctx)
const
{
35
auto
timer =
Monitored::Timer<std::chrono::milliseconds>
(
"TIME_execute"
);
36
auto
mon =
Monitored::Group
(
m_monTool
, timer );
37
38
// register the PRD container in storegate
39
SG::WriteHandle<HGTD_ClusterContainer>
prd_container_handle(
40
m_prd_wh_key
, ctx);
41
42
ATH_CHECK
(
43
prd_container_handle.
record
(std::make_unique<HGTD_ClusterContainer>(
44
m_hgtd_idhelper
->wafer_hash_max())));
45
46
HGTD_ClusterContainer
* locp_prd_container = prd_container_handle.
ptr
();
47
48
std::unique_ptr<DataPool<HGTD_Cluster>> dataItemsPool =
nullptr
;
49
50
if
(
m_use_altiroc_rdo
.value()){
51
// retrieve the RDOs
52
53
SG::ReadHandle<HGTD_ALTIROC_RDO_Container>
rdo_container_handle(
m_altiroc_rdo_rh_key
, ctx);
54
const
HGTD_ALTIROC_RDO_Container
* rdo_container = rdo_container_handle.
cptr
();
55
56
if
(not rdo_container) {
57
//assume this is fast digi input and ignore
58
return
StatusCode::SUCCESS;
59
}
60
61
const
bool
hasExternalCache = rdo_container->
hasExternalCache
();
62
if
(!hasExternalCache) {
63
dataItemsPool = std::make_unique<DataPool<HGTD_Cluster>>(ctx);
64
dataItemsPool->reserve(10000);
// Some large default size
65
}
66
67
// Transform the RDOs collection by collection
68
for
(
const
auto
rdo_collection : *rdo_container) {
69
if
(rdo_collection->empty()) {
70
continue
;
71
}
72
73
std::unique_ptr<HGTD_ClusterCollection> prd_collection =
74
m_clusterization_tool
->clusterize(*rdo_collection,dataItemsPool.get());
75
76
// can happen if some channels are masked, not really relevant currently
77
if
(prd_collection->empty()) {
78
continue
;
79
}
80
const
IdentifierHash
identifyHash{prd_collection->identifyHash()};
81
if
(locp_prd_container
82
->addCollection(prd_collection.release(),identifyHash)
83
.isFailure()) {
84
ATH_MSG_WARNING
(
"Could not add ClusterCollection to container!"
);
85
}
86
}
// END LOOP over container
87
88
}
else
{
89
// retrieve the RDOs
90
SG::ReadHandle<HGTD_RDO_Container>
rdo_container_handle(
m_rdo_rh_key
, ctx);
91
const
HGTD_RDO_Container
* rdo_container = rdo_container_handle.
cptr
();
92
93
if
(not rdo_container) {
94
//assume this is fast digi input and ignore
95
return
StatusCode::SUCCESS;
96
}
97
98
const
bool
hasExternalCache = rdo_container->
hasExternalCache
();
99
if
(!hasExternalCache) {
100
dataItemsPool = std::make_unique<DataPool<HGTD_Cluster>>(ctx);
101
dataItemsPool->reserve(10000);
// Some large default size
102
}
103
104
105
// Transform the RDOs collection by collection
106
for
(
const
auto
rdo_collection : *rdo_container) {
107
if
(rdo_collection->empty()) {
108
continue
;
109
}
110
111
std::unique_ptr<HGTD_ClusterCollection> prd_collection =
112
m_clusterization_tool
->clusterize(*rdo_collection,dataItemsPool.get());
113
114
// can happen if some channels are masked, not really relevant currently
115
if
(prd_collection->empty()) {
116
continue
;
117
}
118
const
IdentifierHash
identifyHash{prd_collection->identifyHash()};
119
if
(locp_prd_container
120
->addCollection(prd_collection.release(),identifyHash)
121
.isFailure()) {
122
ATH_MSG_WARNING
(
"Could not add ClusterCollection to container!"
);
123
}
124
}
// END LOOP over container
125
}
126
127
return
StatusCode::SUCCESS;
128
}
129
130
}
// namespace HGTD
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
HGTD_ClusterContainer
Trk::PrepRawDataContainer< HGTD_ClusterCollection > HGTD_ClusterContainer
Definition
HGTD_ClusterContainer.h:20
HGTD_ID.h
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
PadClusterizationAlg.h
WriteHandle.h
Handle class for recording to StoreGate.
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
HGTD::PadClusterizationAlg::m_prd_wh_key
SG::WriteHandleKey< HGTD_ClusterContainer > m_prd_wh_key
Definition
PadClusterizationAlg.h:45
HGTD::PadClusterizationAlg::m_rdo_rh_key
SG::ReadHandleKey< HGTD_RDO_Container > m_rdo_rh_key
Definition
PadClusterizationAlg.h:43
HGTD::PadClusterizationAlg::m_use_altiroc_rdo
BooleanProperty m_use_altiroc_rdo
Definition
PadClusterizationAlg.h:47
HGTD::PadClusterizationAlg::initialize
virtual StatusCode initialize() override final
Definition
PadClusterizationAlg.cxx:21
HGTD::PadClusterizationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
PadClusterizationAlg.cxx:34
HGTD::PadClusterizationAlg::PadClusterizationAlg
PadClusterizationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
PadClusterizationAlg.cxx:17
HGTD::PadClusterizationAlg::m_clusterization_tool
ToolHandle< IHGTD_PadClusterizationTool > m_clusterization_tool
Definition
PadClusterizationAlg.h:40
HGTD::PadClusterizationAlg::m_altiroc_rdo_rh_key
SG::ReadHandleKey< HGTD_ALTIROC_RDO_Container > m_altiroc_rdo_rh_key
Definition
PadClusterizationAlg.h:44
HGTD::PadClusterizationAlg::m_hgtd_idhelper
const HGTD_ID * m_hgtd_idhelper
Definition
PadClusterizationAlg.h:49
HGTD::PadClusterizationAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
PadClusterizationAlg.h:41
HGTD_ALTIROC_RDO_Container
Definition
HGTD_ALTIROC_RDO_Container.h:18
HGTD_RDO_Container
Definition
HGTD_RDO_Container.h:18
IdentifiableContainerMT::hasExternalCache
virtual bool hasExternalCache() const override final
Definition
IdentifiableContainerMT.h:155
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Timer
A monitored timer.
Definition
MonitoredTimer.h:32
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
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::ptr
pointer_type ptr()
Dereference the pointer.
HGTD
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
Definition
HGTD_TdcCalibrationTool.h:34
Generated on
for ATLAS Offline Software by
1.17.0