ATLAS Offline Software
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 
10 namespace 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 
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" );
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 }
ActsTrk::HgtdClusterizationAlg::m_clusteringTool
ToolHandle< IHGTDClusteringTool > m_clusteringTool
Definition: HgtdClusterizationAlg.h:32
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
HgtdClusterizationAlg.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ActsTrk::HgtdClusterizationAlg::initialize
virtual StatusCode initialize() override
Definition: HgtdClusterizationAlg.cxx:17
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
ActsTrk::HgtdClusterizationAlg::kNRdo
@ kNRdo
Definition: HgtdClusterizationAlg.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
makeTable
TableUtils::StatTable< T > makeTable(const std::array< T, N > &counter, const std::array< std::string, N > &label)
Definition: TableUtils.h:521
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HGTD_DetectorElement.h
ActsTrk::HgtdClusterizationAlg::HgtdClusterizationAlg
HgtdClusterizationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HgtdClusterizationAlg.cxx:12
ActsTrk::HgtdClusterizationAlg::m_rdoContainerKey
SG::ReadHandleKey< HGTD_RDO_Container > m_rdoContainerKey
Definition: HgtdClusterizationAlg.h:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ActsTrk::HgtdClusterizationAlg::kNClusters
@ kNClusters
Definition: HgtdClusterizationAlg.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
ActsTrk::HgtdClusterizationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: HgtdClusterizationAlg.cxx:40
ActsTrk::HgtdClusterizationAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: HgtdClusterizationAlg.h:33
ActsTrk::HgtdClusterizationAlg::m_clusterContainerKey
SG::WriteHandleKey< xAOD::HGTDClusterContainer > m_clusterContainerKey
Definition: HgtdClusterizationAlg.h:36
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
TableUtils.h
ActsTrk::HgtdClusterizationAlg::finalize
virtual StatusCode finalize() override
Definition: HgtdClusterizationAlg.cxx:30
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32