ATLAS Offline Software
Loading...
Searching...
No Matches
PadClusterizationAlg.cxx
Go to the documentation of this file.
1
8
10
14
15namespace HGTD {
16
18 ISvcLocator* pSvcLocator)
19 : AthReentrantAlgorithm(name, pSvcLocator) {}
20
22
24
25 ATH_CHECK(m_rdo_rh_key.initialize());
26 ATH_CHECK(m_prd_wh_key.initialize());
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
34StatusCode 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 // retrieve the RDOs
39 SG::ReadHandle<HGTD_RDO_Container> rdo_container_handle(m_rdo_rh_key, ctx);
40
41 const HGTD_RDO_Container* rdo_container = rdo_container_handle.cptr();
42
43 if (not rdo_container) {
44 //assume this is fast digi input and ignore
45 return StatusCode::SUCCESS;
46 }
47
48 // register the PRD container in storegate
49 SG::WriteHandle<HGTD_ClusterContainer> prd_container_handle(
50 m_prd_wh_key, ctx);
51
53 prd_container_handle.record(std::make_unique<HGTD_ClusterContainer>(
54 m_hgtd_idhelper->wafer_hash_max())));
55
56 HGTD_ClusterContainer* locp_prd_container = prd_container_handle.ptr();
57
58 std::unique_ptr<DataPool<HGTD_Cluster>> dataItemsPool = nullptr;
59 const bool hasExternalCache = rdo_container->hasExternalCache();
60 if (!hasExternalCache) {
61 dataItemsPool = std::make_unique<DataPool<HGTD_Cluster>>(ctx);
62 dataItemsPool->reserve(10000); // Some large default size
63 }
64
65
66 // Transform the RDOs collection by collection
67 for (const auto rdo_collection : *rdo_container) {
68 if (rdo_collection->empty()) {
69 continue;
70 }
71
72 std::unique_ptr<HGTD_ClusterCollection> prd_collection =
73 m_clusterization_tool->clusterize(*rdo_collection,dataItemsPool.get());
74
75 // can happen if some channels are masked, not really relevant currently
76 if (prd_collection->empty()) {
77 continue;
78 }
79 const IdentifierHash identifyHash{prd_collection->identifyHash()};
80 if (locp_prd_container
81 ->addCollection(prd_collection.release(),identifyHash)
82 .isFailure()) {
83 ATH_MSG_WARNING("Could not add ClusterCollection to container!");
84 }
85 } // END LOOP over container
86
87 return StatusCode::SUCCESS;
88}
89
90} // namespace HGTD
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Trk::PrepRawDataContainer< HGTD_ClusterCollection > HGTD_ClusterContainer
Header file to be included by clients of the Monitored infrastructure.
Handle class for recording to StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteHandleKey< HGTD_ClusterContainer > m_prd_wh_key
SG::ReadHandleKey< HGTD_RDO_Container > m_rdo_rh_key
virtual StatusCode initialize() override final
virtual StatusCode execute(const EventContext &ctx) const override final
PadClusterizationAlg(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< IHGTD_PadClusterizationTool > m_clusterization_tool
ToolHandle< GenericMonitoringTool > m_monTool
virtual bool hasExternalCache() const override final
This is a "hash" representation of an Identifier.
Group of local monitoring quantities and retain correlation when filling histograms
A monitored timer.
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.