ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::HgtdClusteringTool Class Reference

#include <HgtdClusteringTool.h>

Inheritance diagram for ActsTrk::HgtdClusteringTool:
Collaboration diagram for ActsTrk::HgtdClusteringTool:

Public Types

using Cluster = IHGTDClusteringTool::Cluster
using ClusterCollection = IHGTDClusteringTool::ClusterCollection

Public Member Functions

 HgtdClusteringTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
virtual std::any createEventDataCache (xAOD::HGTDClusterContainer &cont, std::size_t nClusterRDOs) const override
virtual StatusCode clusterize (const EventContext &ctx, const RawDataCollection &RDOs, std::vector< ClusterCollection > &collection) const override
virtual StatusCode clusterize (const EventContext &ctx, const HGTD_ALTIROC_RDO_Collection &RDOs, std::vector< ClusterCollection > &collection) const override
virtual StatusCode makeClusters (const EventContext &ctx, const ClusterCollection &clusters, xAOD::HGTDClusterContainer &container, size_t &icluster, std::any &cache) const override

Private Member Functions

StatusCode makeCluster (const EventContext &, const typename HgtdClusteringTool::Cluster &cluster, xAOD::HGTDCluster &xaodcluster, HgtdAuxDataCache *cache) const

Private Attributes

const HGTD_DetectorManagerm_hgtd_det_mgr {nullptr}
ToolHandle< HGTD_TdcCalibrationToolm_hgtd_tdc_calib_tool
BooleanProperty m_use_altiroc_rdo

Detailed Description

Definition at line 18 of file HgtdClusteringTool.h.

Member Typedef Documentation

◆ Cluster

◆ ClusterCollection

Constructor & Destructor Documentation

◆ HgtdClusteringTool()

ActsTrk::HgtdClusteringTool::HgtdClusteringTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 11 of file HgtdClusteringTool.cxx.

14 : base_class(type, name, parent)
15 {}

Member Function Documentation

◆ clusterize() [1/2]

StatusCode ActsTrk::HgtdClusteringTool::clusterize ( const EventContext & ctx,
const HGTD_ALTIROC_RDO_Collection & RDOs,
std::vector< ClusterCollection > & collection ) const
overridevirtual

Definition at line 117 of file HgtdClusteringTool.cxx.

120 {
121 ATH_MSG_DEBUG("Clustering hits...");
122 collection.emplace_back();
123 ClusterCollection &clusters=collection.back();
124 clusters.reserve(RDOs.size());
125
126 for (std::size_t i(0), n(RDOs.size()); i < n; ++i) {
127 const auto* rdo = RDOs[i];
128 Identifier rdo_id = rdo->identify();
129 clusters.emplace_back();
130 clusters.back().ids.push_back(rdo_id.get_compact());
131 const InDetDD::HGTD_DetectorElement* element = m_hgtd_det_mgr->getDetectorElement(rdo_id);
132 clusters.back().times.push_back(m_hgtd_tdc_calib_tool->TOA2Time(element, rdo->getToA()));
133 ATH_MSG_DEBUG("Recovered Time of Arrival: " << m_hgtd_tdc_calib_tool->TOA2Time(element, rdo->getToA()));
134 clusters.back().tots.push_back(rdo->getToT());
135 }
136 return StatusCode::SUCCESS;
137 }
#define ATH_MSG_DEBUG(x)
const HGTD_DetectorManager * m_hgtd_det_mgr
ToolHandle< HGTD_TdcCalibrationTool > m_hgtd_tdc_calib_tool
IHGTDClusteringTool::ClusterCollection ClusterCollection
size_type size() const noexcept
Returns the number of elements in the collection.
const Identifier & identify() const
value_type get_compact() const
Get the compact id.

◆ clusterize() [2/2]

StatusCode ActsTrk::HgtdClusteringTool::clusterize ( const EventContext & ctx,
const RawDataCollection & RDOs,
std::vector< ClusterCollection > & collection ) const
overridevirtual

Definition at line 31 of file HgtdClusteringTool.cxx.

34 {
35 ATH_MSG_DEBUG("Clustering hits...");
36 collection.emplace_back();
37 ClusterCollection &clusters=collection.back();
38 clusters.reserve(RDOs.size());
39 for (std::size_t i(0), n(RDOs.size()); i < n; ++i) {
40 const auto* rdo = RDOs[i];
41 Identifier rdo_id = rdo->identify();
42 clusters.emplace_back();
43 clusters.back().ids.push_back(rdo_id.get_compact());
44 clusters.back().times.push_back(rdo->getTOA());
45 clusters.back().tots.push_back(rdo->getTOT());
46 }
47 return StatusCode::SUCCESS;
48 }

◆ createEventDataCache()

std::any ActsTrk::HgtdClusteringTool::createEventDataCache ( xAOD::HGTDClusterContainer & cont,
std::size_t nClusterRDOs ) const
overridevirtual

Definition at line 27 of file HgtdClusteringTool.cxx.

27 {
28 return HgtdAuxDataCache(cont,nClusterRDOs);
29 }

◆ initialize()

StatusCode ActsTrk::HgtdClusteringTool::initialize ( )
overridevirtual

Definition at line 17 of file HgtdClusteringTool.cxx.

18 {
19 ATH_MSG_INFO("Initializing HgtdClusteringTool...");
20
21 ATH_CHECK(detStore()->retrieve(m_hgtd_det_mgr, "HGTD"));
22 ATH_CHECK(m_hgtd_tdc_calib_tool.retrieve(EnableTool{m_use_altiroc_rdo.value()}));
23
24 return StatusCode::SUCCESS;
25 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)

◆ makeCluster()

StatusCode ActsTrk::HgtdClusteringTool::makeCluster ( const EventContext & ,
const typename HgtdClusteringTool::Cluster & cluster,
xAOD::HGTDCluster & xaodcluster,
HgtdAuxDataCache * cache ) const
private

Definition at line 68 of file HgtdClusteringTool.cxx.

72 {
73 unsigned int icluster=xaodcluster.index();
74 unsigned int n_rdos = auxDataCache->rdoList.getBeginIndex(icluster);
75 assert(icluster==0 || n_rdos == auxDataCache->totList.getBeginIndex(icluster));
76 assert( n_rdos+cluster.ids.size() <= auxDataCache->rdoList.nObjects() );
77 assert( cluster.tots.size() == cluster.ids.size());
78 assert( cluster.times.size() == cluster.ids.size());
79 assert( cluster.ids.size() == 1);
80 for (size_t rdo_i = 0; rdo_i < cluster.ids.size(); ++rdo_i) {
81 Identifier rdo_id( cluster.ids[rdo_i]);
82 // @TODO get detector element only once by caller aka. makeClusters
83 const InDetDD::HGTD_DetectorElement* element = m_hgtd_det_mgr->getDetectorElement(rdo_id);
84
85 InDetDD::SiCellId si_cell_id = element->cellIdFromIdentifier(rdo_id);
86
87 InDetDD::SiLocalPosition si_pos = element->design().localPositionOfCell(si_cell_id);
88
89
90 Eigen::Matrix<float, 3, 1> loc_pos(si_pos.xPhi(), si_pos.xEta(),cluster.times[rdo_i]);
91 Eigen::Matrix<float, 3, 3> cov_matrix= Eigen::Matrix<float, 3, 3>::Zero();
92
93 float xWidth = 1.3;
94 float yWidth = 1.3;
95 cov_matrix(0,0) = xWidth * xWidth / 12; // i.e. Cov XX
96 cov_matrix(1,1) = yWidth * yWidth / 12; // i.e. Cov YY
97 float time_of_arrival_err = 0.035;
98 cov_matrix(2,2) = time_of_arrival_err * time_of_arrival_err; // i.e. Cov TT
99
100 auxDataCache->rdoList.setValue(n_rdos,rdo_id.get_compact());
101 auxDataCache->totList.setValue(n_rdos,cluster.tots[rdo_i]);
102 ++n_rdos;
103 // this will set the position and covariance to the last and only RDO
104 IdentifierHash id_hash = element->identifyHash();
105 xaodcluster.setMeasurement<3>(id_hash,loc_pos,cov_matrix);
106 }
107
108
109 // Fill
110 xaodcluster.setIdentifier(cluster.ids.front());
111 auxDataCache->rdoList.updateEndIndex(icluster,n_rdos);
112 auxDataCache->totList.updateEndIndex(icluster,n_rdos);
113
114 return StatusCode::SUCCESS;
115 }
SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
const HGTD_ModuleDesign & design() const override final
access to the local description:
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
readout or diode id -> position.
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.

◆ makeClusters()

StatusCode ActsTrk::HgtdClusteringTool::makeClusters ( const EventContext & ctx,
const ClusterCollection & clusters,
xAOD::HGTDClusterContainer & container,
size_t & icluster,
std::any & cache ) const
overridevirtual

Definition at line 50 of file HgtdClusteringTool.cxx.

55 {
56 HgtdAuxDataCache* auxDataCache = std::any_cast<HgtdAuxDataCache> (&cache);
57 if (!auxDataCache) throw std::bad_any_cast();
58 assert( icluster+clusters.size() <= container.size() );
59 for (std::size_t i(0); i<clusters.size(); ++i) {
60 const HgtdClusteringTool::Cluster& cluster = clusters[i];
61 assert(icluster+i == container[icluster+i]->index());
62 ATH_CHECK(makeCluster(ctx, cluster, *container[icluster+i],auxDataCache));
63 }
64
65 return StatusCode::SUCCESS;
66 }
IHGTDClusteringTool::Cluster Cluster
StatusCode makeCluster(const EventContext &, const typename HgtdClusteringTool::Cluster &cluster, xAOD::HGTDCluster &xaodcluster, HgtdAuxDataCache *cache) const
str index
Definition DeMoScan.py:362
const SG::AuxVectorData * container() const
Return the container holding this element.

Member Data Documentation

◆ m_hgtd_det_mgr

const HGTD_DetectorManager* ActsTrk::HgtdClusteringTool::m_hgtd_det_mgr {nullptr}
private

Definition at line 51 of file HgtdClusteringTool.h.

51{nullptr};

◆ m_hgtd_tdc_calib_tool

ToolHandle<HGTD_TdcCalibrationTool> ActsTrk::HgtdClusteringTool::m_hgtd_tdc_calib_tool
private
Initial value:
{this,
"HGTD_TdcCalibrationTool","HGTD_TdcCalibrationTool",
"Tool that that access TOA TDC calibration and retrieves time of arrival"}

Definition at line 52 of file HgtdClusteringTool.h.

52 {this,
53 "HGTD_TdcCalibrationTool","HGTD_TdcCalibrationTool",
54 "Tool that that access TOA TDC calibration and retrieves time of arrival"};

◆ m_use_altiroc_rdo

BooleanProperty ActsTrk::HgtdClusteringTool::m_use_altiroc_rdo
private
Initial value:
{this, "useALTIROC_RDO",
false, "Use Altiroc RDO instead of standard"}

Definition at line 56 of file HgtdClusteringTool.h.

56 {this, "useALTIROC_RDO",
57 false, "Use Altiroc RDO instead of standard"};

The documentation for this class was generated from the following files: