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

#include <HgtdTimedClusteringTool.h>

Inheritance diagram for ActsTrk::HgtdTimedClusteringTool:
Collaboration diagram for ActsTrk::HgtdTimedClusteringTool:

Public Types

using Cell = Hgtd::UnpackedHgtdRDO
using CellCollection = std::vector<Cell>
using Cluster = IHGTDClusteringTool::Cluster
using ClusterCollection = IHGTDClusteringTool::ClusterCollection

Public Member Functions

 HgtdTimedClusteringTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () 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 std::any createEventDataCache (xAOD::HGTDClusterContainer &cont, std::size_t nClusterRDOs) 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 &ctx, const typename HgtdTimedClusteringTool::Cluster &cluster, xAOD::HGTDCluster &xaodcluster, HgtdAuxDataCache *cache) const

Private Attributes

const HGTD_DetectorManagerm_hgtd_det_mgr {nullptr}
const HGTD_IDm_hgtd_id {nullptr}
ToolHandle< HGTD_TdcCalibrationToolm_hgtd_tdc_calib_tool
BooleanProperty m_use_altiroc_rdo {this, "useALTIROC_RDO", false, "Use Altiroc RDO instead of standard"}
Gaudi::Property< double > m_timeTollerance {this, "TimeTollerance", 0.035 * Acts::UnitConstants::ns}
Gaudi::Property< bool > m_addCorners {this, "AddCorners", true}

Detailed Description

Definition at line 35 of file HgtdTimedClusteringTool.h.

Member Typedef Documentation

◆ Cell

◆ CellCollection

Definition at line 40 of file HgtdTimedClusteringTool.h.

◆ Cluster

◆ ClusterCollection

Constructor & Destructor Documentation

◆ HgtdTimedClusteringTool()

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

Definition at line 32 of file HgtdTimedClusteringTool.cxx.

35 : base_class(type, name, parent)
36 {}

Member Function Documentation

◆ clusterize() [1/2]

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

Definition at line 157 of file HgtdTimedClusteringTool.cxx.

160{
161 collection.emplace_back();
162 ClusterCollection &clusters=collection.back();
163 // best guess about number of expected clusters is one cluster per RDO
164 clusters.reserve(RDOs.size());
165 // Unpack RDOs (would need a proper function here)
167 cells.reserve(RDOs.size());
168 for (const HGTD_ALTIROC_RDO* rdo : RDOs) {
169 Identifier id = rdo->identify();
170
171 const InDetDD::HGTD_DetectorElement* element = m_hgtd_det_mgr->getDetectorElement(id);
172 uint8_t time_of_flight = m_hgtd_tdc_calib_tool->TOA2Time(element, rdo->getToA());
173
174 ATH_MSG_DEBUG("Recovered Time of Arrival: " << time_of_flight);
175
176 cells.emplace_back(-1,
177 m_hgtd_id->phi_index(id),
178 m_hgtd_id->eta_index(id),
179 time_of_flight,
180 rdo->getToT(),
181 id);
182 }
183
184 ATH_MSG_DEBUG("Clustering on " << RDOs.size() << " RDOs using time information");
185 Acts::Ccl::ClusteringData data;
186 Acts::Ccl::createClusters<CellCollection, ClusterCollection, 2>
187 (data, cells, clusters, Acts::Ccl::TimedConnect<Cell, 2ul>(m_timeTollerance.value(), m_addCorners.value()));
188 ATH_MSG_DEBUG(" \\_ " << clusters.size() << " clusters reconstructed");
189 return StatusCode::SUCCESS;
190}
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const HGTD_DetectorManager * m_hgtd_det_mgr
ToolHandle< HGTD_TdcCalibrationTool > m_hgtd_tdc_calib_tool
Gaudi::Property< double > m_timeTollerance
IHGTDClusteringTool::ClusterCollection ClusterCollection
size_type size() const noexcept
Returns the number of elements in the collection.

◆ clusterize() [2/2]

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

Definition at line 55 of file HgtdTimedClusteringTool.cxx.

58 {
59 collection.emplace_back();
60 ClusterCollection &clusters=collection.back();
61 // best guess about number of expected clusters is one cluster per RDO
62 clusters.reserve(RDOs.size());
63 // Unpack RDOs (would need a proper function here)
65 cells.reserve(RDOs.size());
66 for (const HGTD_RDO* rdo : RDOs) {
67 Identifier id = rdo->identify();
68 cells.emplace_back(-1,
69 m_hgtd_id->phi_index(id),
70 m_hgtd_id->eta_index(id),
71 rdo->getTOA(),
72 rdo->getTOT(),
73 id);
74 }
75
76 ATH_MSG_DEBUG("Clustering on " << RDOs.size() << " RDOs using time information");
77 Acts::Ccl::ClusteringData data;
78 Acts::Ccl::createClusters<CellCollection, ClusterCollection, 2>
79 (data, cells, clusters, Acts::Ccl::TimedConnect<Cell, 2ul>(m_timeTollerance.value(), m_addCorners.value()));
80 ATH_MSG_DEBUG(" \\_ " << clusters.size() << " clusters reconstructed");
81 return StatusCode::SUCCESS;
82 }

◆ createEventDataCache()

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

Definition at line 51 of file HgtdTimedClusteringTool.cxx.

51 {
52 return HgtdAuxDataCache(cont,nClusterRDOs);
53 }

◆ initialize()

StatusCode ActsTrk::HgtdTimedClusteringTool::initialize ( )
overridevirtual

Definition at line 38 of file HgtdTimedClusteringTool.cxx.

39 {
40 ATH_MSG_DEBUG("Initializing " << name() << "...");
41
42 ATH_CHECK(detStore()->retrieve(m_hgtd_det_mgr, "HGTD"));
43 ATH_CHECK(detStore()->retrieve(m_hgtd_id, "HGTD_ID"));
44 ATH_CHECK(m_hgtd_tdc_calib_tool.retrieve(EnableTool{m_use_altiroc_rdo.value()}));
45
47
48 return StatusCode::SUCCESS;
49 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ makeCluster()

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

Definition at line 102 of file HgtdTimedClusteringTool.cxx.

106 {
107 if (cluster.ids.empty()) return StatusCode::SUCCESS;
108
109 InDetDD::SiLocalPosition pos_acc(0,0);
110 double tot_time = 0;
111
112 unsigned int icluster=xaodcluster.index();
113 unsigned int n_rdos = auxDataCache->rdoList.getBeginIndex(icluster);
114 assert(icluster==0 || n_rdos == auxDataCache->totList.getBeginIndex(icluster));
115 assert( n_rdos+cluster.ids.size() <= auxDataCache->rdoList.nObjects() );
116 assert( cluster.tots.size() == cluster.ids.size());
117 for (size_t i = 0; i < cluster.ids.size(); i++) {
118 Identifier rdo_id(cluster.ids[i]);
119 // @TODO get detector only once, all clusters should belong to the same detector element
120 const InDetDD::HGTD_DetectorElement* element = m_hgtd_det_mgr->getDetectorElement(rdo_id);
121 InDetDD::SiCellId si_cell_id = element->cellIdFromIdentifier(rdo_id);
122 InDetDD::SiLocalPosition si_pos = element->design().localPositionOfCell(si_cell_id);
123
124 auxDataCache->rdoList.setValue(n_rdos,rdo_id.get_compact());
125 auxDataCache->totList.setValue(n_rdos,cluster.tots[i]);
126 ++n_rdos;
127
128 pos_acc += si_pos;
129 tot_time += cluster.times[i];
130 }
131
132 pos_acc /= cluster.ids.size();
133 tot_time /= cluster.ids.size();
134
135 // Create the cluster
136 Eigen::Matrix<float, 3, 1> loc_pos(pos_acc.xPhi(), pos_acc.xEta(), tot_time);
137 Eigen::Matrix<float, 3, 3> cov_matrix= Eigen::Matrix<float, 3, 3>::Zero();
138
139 constexpr float xWidth = 1.3;
140 constexpr float yWidth = 1.3;
141 cov_matrix(0,0) = xWidth * xWidth / 12 / cluster.ids.size(); // i.e. Cov XX
142 cov_matrix(1,1) = yWidth * yWidth / 12 / cluster.ids.size(); // i.e. Cov YY
143 constexpr float time_of_arrival_err = 0.035;
144 cov_matrix(2,2) = time_of_arrival_err * time_of_arrival_err / cluster.ids.size(); // i.e. Cov TT
145 // @TODO get detector element only once by caller aka. makeClusters
146 IdentifierHash id_hash = m_hgtd_det_mgr->getDetectorElement(Identifier(cluster.ids.front()))->identifyHash();
147
148 // Fill
149 xaodcluster.setMeasurement<3>(id_hash,loc_pos,cov_matrix);
150 xaodcluster.setIdentifier(cluster.ids.front());
151 auxDataCache->rdoList.updateEndIndex(icluster,n_rdos);
152 auxDataCache->totList.updateEndIndex(icluster,n_rdos);
153
154 return StatusCode::SUCCESS;
155 }
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.
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::HgtdTimedClusteringTool::makeClusters ( const EventContext & ctx,
const ClusterCollection & clusters,
xAOD::HGTDClusterContainer & container,
size_t & icluster,
std::any & cache ) const
overridevirtual

Definition at line 84 of file HgtdTimedClusteringTool.cxx.

89 {
90 HgtdAuxDataCache* auxDataCache = std::any_cast<HgtdAuxDataCache> (&cache);
91 if (!auxDataCache) throw std::bad_any_cast();
92 assert( icluster+clusters.size() <= container.size() );
93 for (std::size_t i(0); i<clusters.size(); ++i) {
94 const typename HgtdTimedClusteringTool::Cluster& cluster = clusters[i];
95 assert(icluster+i == container[icluster+i]->index());
96 ATH_CHECK(makeCluster(ctx, cluster, *container[icluster+i],auxDataCache));
97 }
98
99 return StatusCode::SUCCESS;
100 }
IHGTDClusteringTool::Cluster Cluster
StatusCode makeCluster(const EventContext &ctx, const typename HgtdTimedClusteringTool::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_addCorners

Gaudi::Property<bool> ActsTrk::HgtdTimedClusteringTool::m_addCorners {this, "AddCorners", true}
private

Definition at line 85 of file HgtdTimedClusteringTool.h.

85{this, "AddCorners", true};

◆ m_hgtd_det_mgr

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

Definition at line 76 of file HgtdTimedClusteringTool.h.

76{nullptr};

◆ m_hgtd_id

const HGTD_ID* ActsTrk::HgtdTimedClusteringTool::m_hgtd_id {nullptr}
private

Definition at line 77 of file HgtdTimedClusteringTool.h.

77{nullptr};

◆ m_hgtd_tdc_calib_tool

ToolHandle<HGTD_TdcCalibrationTool> ActsTrk::HgtdTimedClusteringTool::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 78 of file HgtdTimedClusteringTool.h.

78 {this,
79 "HGTD_TdcCalibrationTool","HGTD_TdcCalibrationTool",
80 "Tool that that access TOA TDC calibration and retrieves time of arrival"};

◆ m_timeTollerance

Gaudi::Property<double> ActsTrk::HgtdTimedClusteringTool::m_timeTollerance {this, "TimeTollerance", 0.035 * Acts::UnitConstants::ns}
private

Definition at line 84 of file HgtdTimedClusteringTool.h.

84{this, "TimeTollerance", 0.035 * Acts::UnitConstants::ns};

◆ m_use_altiroc_rdo

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

Definition at line 82 of file HgtdTimedClusteringTool.h.

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

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