ATLAS Offline Software
ClusterizationAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRK_DATAPREPARATION_CLUSTERIZATIONALG_H
6 #define ACTSTRK_DATAPREPARATION_CLUSTERIZATIONALG_H
7 
10 #include <GaudiKernel/ToolHandle.h>
15 #include "src/Cache.h"
16 
17 namespace ActsTrk {
18 
19 template <typename IClusteringTool, bool useCache>
21 public:
22  using RDOContainer = typename IClusteringTool::RDOContainer;
23  using RawDataCollection = typename RDOContainer::base_value_type;
24  using ClusterContainer = typename IClusteringTool::ClusterContainer;
25  using ClusterAuxContainer = typename IClusteringTool::ClusterAuxContainer;
26  using IDHelper = typename IClusteringTool::IDHelper;
27  using BaseClusterType = typename ClusterContainer::base_value_type;
28 
29  //cache related handles
36 
37  ClusterizationAlg(const std::string& name, ISvcLocator* pSvcLocator);
38  virtual ~ClusterizationAlg() = default;
39  virtual StatusCode initialize() override;
40  virtual StatusCode execute(const EventContext& ctx) const override;
41  virtual StatusCode finalize() override;
42 
43 private:
44  ToolHandle<IClusteringTool> m_clusteringTool {this, "ClusteringTool", "",
45  "Clustering Tool"};
46 
47  ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "",
48  "Monitoring tool"};
49 
50  ToolHandle<IRegSelTool> m_regionSelector {this, "RegSelTool", "",
51  "Region selector tool"};
52 
53  SG::ReadHandleKey<RDOContainer> m_rdoContainerKey {this, "RDOContainerKey", "",
54  "Input RDO container key"};
55 
57  "RoIs to read in"};
58 
60  "Key of output xAOD pixel cluster container"};
61 
62  Cache_WriteHandleKey m_ClusterCache{this,"ClusterCache",""};
63  Cache_BackendUpdateHandleKey m_ClusterCacheBackend{this,"ClusterCacheBackend",""};
64 
65  // expected number of clusters for RDO
66  // This values is used for reserving enough memory of the cluster container
67  // reserve = m_expectedClustersPerRDO * nRDOs
68  // The default values has been computed on a tt-bar PU200 sample
69  // comparing the memory usage and the container capacity
70  Gaudi::Property<int> m_expectedClustersPerRDO {this, "expectedClustersPerRDO", 32,
71  "Expected number of clusters for RDO"};
72 
73  Gaudi::Property<std::string> m_idHelperName {this, "IDHelper", "",
74  "Name of ID helper to fetch from detstore" };
75 
76  const IDHelper* m_idHelper = nullptr;
77 
78 private:
79  enum EStat {
82  kNStat
83  };
84 
85  mutable std::array<std::atomic<unsigned int>, kNStat> m_stat ATLAS_THREAD_SAFE {};
86 };
87 
88 } // namespace ActsTrk
89 
90 #include "ClusterizationAlg.icc"
91 
92 #endif
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::ClusterContainer
typename IClusteringTool::ClusterContainer ClusterContainer
Definition: ClusterizationAlg.h:24
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
IRegSelTool.h
ActsTrk::ClusterizationAlg::kNClusters
@ kNClusters
Definition: ClusterizationAlg.h:81
ActsTrk::ClusterizationAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: ClusterizationAlg.h:47
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::IDHelper
typename IClusteringTool::IDHelper IDHelper
Definition: ClusterizationAlg.h:26
SG::UpdateHandleKey
Property holding a SG store/key/clid from which an UpdateHandle is made.
Definition: UpdateHandleKey.h:40
ActsTrk::ClusterizationAlg::m_clusteringTool
ToolHandle< IClusteringTool > m_clusteringTool
Definition: ClusterizationAlg.h:44
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::RawDataCollection
typename RDOContainer::base_value_type RawDataCollection
Definition: ClusterizationAlg.h:23
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::Cache_BackendUpdateHandleKey
typename Cache::Handles< BaseClusterType >::BackendUpdateHandleKey Cache_BackendUpdateHandleKey
Definition: ClusterizationAlg.h:30
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::Cache_WriteHandleKey
typename Cache::Handles< BaseClusterType >::WriteHandleKey Cache_WriteHandleKey
Definition: ClusterizationAlg.h:32
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::RDOContainer
typename IClusteringTool::RDOContainer RDOContainer
Definition: ClusterizationAlg.h:22
ActsTrk::ClusterizationAlg::m_clusterContainerKey
SG::WriteHandleKey< ClusterContainer > m_clusterContainerKey
Definition: ClusterizationAlg.h:59
ActsTrk::ClusterizationAlg::m_rdoContainerKey
SG::ReadHandleKey< RDOContainer > m_rdoContainerKey
Definition: ClusterizationAlg.h:53
ActsTrk::ClusterizationAlg::m_expectedClustersPerRDO
Gaudi::Property< int > m_expectedClustersPerRDO
Definition: ClusterizationAlg.h:70
SG::ReadHandleKey< RDOContainer >
ActsTrk::ClusterizationAlg::ClusterizationAlg
ClusterizationAlg(const std::string &name, ISvcLocator *pSvcLocator)
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::BaseClusterType
typename ClusterContainer::base_value_type BaseClusterType
Definition: ClusterizationAlg.h:27
ActsTrk::ClusterizationAlg::ATLAS_THREAD_SAFE
std::array< std::atomic< unsigned int >, kNStat > m_stat ATLAS_THREAD_SAFE
Definition: ClusterizationAlg.h:85
ActsTrk::ClusterizationAlg::~ClusterizationAlg
virtual ~ClusterizationAlg()=default
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ActsTrk::ClusterizationAlg::m_regionSelector
ToolHandle< IRegSelTool > m_regionSelector
Definition: ClusterizationAlg.h:50
ActsTrk::ClusterizationAlg::kNRdo
@ kNRdo
Definition: ClusterizationAlg.h:80
ActsTrk::ClusterizationAlg::m_ClusterCacheBackend
Cache_BackendUpdateHandleKey m_ClusterCacheBackend
Definition: ClusterizationAlg.h:63
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::Cache_IDCLock
typename Cache::Handles< BaseClusterType >::IDC::IDC_WriteHandle Cache_IDCLock
Definition: ClusterizationAlg.h:35
GenericMonitoringTool.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::EStat
EStat
Definition: ClusterizationAlg.h:79
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::ClusterizationAlg::m_idHelper
const IDHelper * m_idHelper
Definition: ClusterizationAlg.h:76
IdentifiableContainerMT::IDC_WriteHandle
Definition: IdentifiableContainerMT.h:34
ActsTrk::ClusterizationAlg::finalize
virtual StatusCode finalize() override
ActsTrk::ClusterizationAlg::initialize
virtual StatusCode initialize() override
ActsTrk::ClusterizationAlg::m_ClusterCache
Cache_WriteHandleKey m_ClusterCache
Definition: ClusterizationAlg.h:62
ActsTrk::ClusterizationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::Cache_WriteHandle
typename Cache::Handles< BaseClusterType >::WriteHandle Cache_WriteHandle
Definition: ClusterizationAlg.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Cache.h
SG::UpdateHandle
Definition: UpdateHandle.h:94
ActsTrk::ClusterizationAlg
Definition: ClusterizationAlg.h:20
ClusterizationAlg.icc
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::ClusterAuxContainer
typename IClusteringTool::ClusterAuxContainer ClusterAuxContainer
Definition: ClusterizationAlg.h:25
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::Cache_IDC
typename Cache::Handles< BaseClusterType >::IDC Cache_IDC
Definition: ClusterizationAlg.h:34
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
IdentifiableContainerMT
Definition: IdentifiableContainerMT.h:30
ActsTrk::ClusterizationAlg::kNStat
@ kNStat
Definition: ClusterizationAlg.h:82
ActsTrk::ClusterizationAlg::m_idHelperName
Gaudi::Property< std::string > m_idHelperName
Definition: ClusterizationAlg.h:73
TrigRoiDescriptorCollection.h
ActsTrk::ClusterizationAlg< IPixelClusteringTool, false >::Cache_BackendUpdateHandle
typename Cache::Handles< BaseClusterType >::BackendUpdateHandle Cache_BackendUpdateHandle
Definition: ClusterizationAlg.h:31
ActsTrk::ClusterizationAlg::m_roiCollectionKey
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
Definition: ClusterizationAlg.h:56