ATLAS Offline Software
Loading...
Searching...
No Matches
HgtdClusterizationAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10namespace ActsTrk {
11
13 ISvcLocator* pSvcLocator)
14 : AthReentrantAlgorithm(name, pSvcLocator)
15 {}
16
18 {
19 ATH_MSG_DEBUG("Initializing " << name() << " ...");
20 ATH_CHECK(m_clusteringTool.retrieve());
21 ATH_CHECK(m_monTool.retrieve(EnableTool{not m_monTool.empty()}));
22
23 ATH_CHECK(m_rdoContainerKey.initialize());
24 ATH_CHECK(m_clusterContainerKey.initialize());
25
26 return StatusCode::SUCCESS;
27
28 }
29
31 ATH_MSG_INFO("Clusterization statistics" << std::endl << makeTable(m_stat,
32 std::array<std::string, kNStat>{
33 "RDOs",
34 "Clusters"
35 }).columnWidth(10));
36
37 return StatusCode::SUCCESS;
38 }
39
40 StatusCode HgtdClusterizationAlg::execute(const EventContext& ctx) const
41 {
42 ATH_MSG_DEBUG("Executing " << name() << " ...");
43
44 auto timer = Monitored::Timer<std::chrono::milliseconds>( "TIME_execute" );
45 auto mon = Monitored::Group( m_monTool, timer );
46
48 if (!rdoContainer.isValid()) {
49 ATH_MSG_ERROR("Failed to retrieve HGTD RDO container");
50 return StatusCode::FAILURE;
51 }
52
54 ATH_CHECK(clusterContainer.record(std::make_unique<xAOD::HGTDClusterContainer>(),
55 std::make_unique<xAOD::HGTDClusterAuxContainer>()));
56
57 for (const auto rdoCollection : *rdoContainer) {
58 if (rdoCollection->empty()) {
59 continue;
60 }
61 m_stat[kNRdo] += rdoCollection->size();
62 ATH_CHECK(m_clusteringTool->clusterize(ctx, *rdoCollection, *clusterContainer));
63 }
64
65 m_stat[kNClusters] += clusterContainer->size();
66 ATH_MSG_DEBUG("Clusters produced size: "<<clusterContainer->size());
67 return StatusCode::SUCCESS;
68 }
69
70
71}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
TableUtils::StatTable< T > makeTable(const std::array< T, N > &counter, const std::array< std::string, N > &label)
Definition TableUtils.h:523
SG::WriteHandleKey< xAOD::HGTDClusterContainer > m_clusterContainerKey
SG::ReadHandleKey< HGTD_RDO_Container > m_rdoContainerKey
virtual StatusCode execute(const EventContext &ctx) const override
HgtdClusterizationAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode finalize() override
ToolHandle< IHGTDClusteringTool > m_clusteringTool
virtual StatusCode initialize() override
ToolHandle< GenericMonitoringTool > m_monTool
An algorithm that can be simultaneously executed in multiple threads.
Group of local monitoring quantities and retain correlation when filling histograms
A monitored timer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())