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

#include <HgtdTimedClusteringTool.h>

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

Classes

struct  Cluster

Public Types

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

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, ClusterContainer &container) const override
virtual StatusCode clusterize (const EventContext &ctx, const HGTD_ALTIROC_RDO_Collection &RDOs, ClusterContainer &container) const override

Private Member Functions

StatusCode makeCluster (const EventContext &ctx, const typename HgtdTimedClusteringTool::Cluster &cluster, xAOD::HGTDCluster &xaodcluster) 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 34 of file HgtdTimedClusteringTool.h.

Member Typedef Documentation

◆ Cell

◆ CellCollection

Definition at line 44 of file HgtdTimedClusteringTool.h.

◆ ClusterCollection

Constructor & Destructor Documentation

◆ HgtdTimedClusteringTool()

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

Definition at line 31 of file HgtdTimedClusteringTool.cxx.

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

Member Function Documentation

◆ clusterize() [1/2]

StatusCode ActsTrk::HgtdTimedClusteringTool::clusterize ( const EventContext & ctx,
const HGTD_ALTIROC_RDO_Collection & RDOs,
ClusterContainer & container ) const
overridevirtual

Definition at line 135 of file HgtdTimedClusteringTool.cxx.

138{
139 // Unpack RDOs (would need a proper function here)
141 cells.reserve(RDOs.size());
142 for (const HGTD_ALTIROC_RDO* rdo : RDOs) {
143 Identifier id = rdo->identify();
144
145 const InDetDD::HGTD_DetectorElement* element = m_hgtd_det_mgr->getDetectorElement(id);
146 uint8_t time_of_flight = m_hgtd_tdc_calib_tool->TOA2Time(element, rdo->getToA());
147
148 ATH_MSG_DEBUG("Recovered Time of Arrival: " << time_of_flight);
149
150 cells.emplace_back(-1,
151 m_hgtd_id->phi_index(id),
152 m_hgtd_id->eta_index(id),
153 time_of_flight,
154 rdo->getToT(),
155 id);
156 }
157
158 ATH_MSG_DEBUG("Clustering on " << RDOs.size() << " RDOs using time information");
159 Acts::Ccl::ClusteringData data;
161 Acts::Ccl::createClusters<CellCollection, ClusterCollection, 2>
162 (data, cells, clusters, Acts::Ccl::TimedConnect<Cell, 2ul>(m_timeTollerance.value(), m_addCorners.value()));
163 ATH_MSG_DEBUG(" \\_ " << clusters.size() << " clusters reconstructed");
164
165 // Fast insertion trick
166 std::size_t previousSizeContainer = container.size();
167 std::vector<xAOD::HGTDCluster*> toAdd;
168 toAdd.reserve(clusters.size());
169 for (std::size_t i(0), n(clusters.size()); i < n; ++i)
170 toAdd.push_back( new xAOD::HGTDCluster() );
171 container.insert(container.end(), toAdd.begin(), toAdd.end());
172
173 for (std::size_t i(0); i<clusters.size(); ++i) {
174 const typename HgtdTimedClusteringTool::Cluster& cluster = clusters[i];
175 ATH_CHECK(makeCluster(ctx, cluster, *container[previousSizeContainer+i]));
176 }
177
178 return StatusCode::SUCCESS;
179}
#define ATH_CHECK
Evaluate an expression and check for errors.
#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
StatusCode makeCluster(const EventContext &ctx, const typename HgtdTimedClusteringTool::Cluster &cluster, xAOD::HGTDCluster &xaodcluster) const
size_type size() const noexcept
Returns the number of elements in the collection.
HGTDCluster_v1 HGTDCluster
Define the version of the pixel cluster class.
Definition HGTDCluster.h:13

◆ clusterize() [2/2]

StatusCode ActsTrk::HgtdTimedClusteringTool::clusterize ( const EventContext & ctx,
const RawDataCollection & RDOs,
ClusterContainer & container ) const
overridevirtual

Definition at line 50 of file HgtdTimedClusteringTool.cxx.

53 {
54 // Unpack RDOs (would need a proper function here)
56 cells.reserve(RDOs.size());
57 for (const HGTD_RDO* rdo : RDOs) {
58 Identifier id = rdo->identify();
59 cells.emplace_back(-1,
60 m_hgtd_id->phi_index(id),
61 m_hgtd_id->eta_index(id),
62 rdo->getTOA(),
63 rdo->getTOT(),
64 id);
65 }
66
67 ATH_MSG_DEBUG("Clustering on " << RDOs.size() << " RDOs using time information");
68 Acts::Ccl::ClusteringData data;
70 Acts::Ccl::createClusters<CellCollection, ClusterCollection, 2>
71 (data, cells, clusters, Acts::Ccl::TimedConnect<Cell, 2ul>(m_timeTollerance.value(), m_addCorners.value()));
72 ATH_MSG_DEBUG(" \\_ " << clusters.size() << " clusters reconstructed");
73
74 // Fast insertion trick
75 std::size_t previousSizeContainer = container.size();
76 std::vector<xAOD::HGTDCluster*> toAdd;
77 toAdd.reserve(clusters.size());
78 for (std::size_t i(0), n(clusters.size()); i < n; ++i)
79 toAdd.push_back( new xAOD::HGTDCluster() );
80 container.insert(container.end(), toAdd.begin(), toAdd.end());
81
82 for (std::size_t i(0); i<clusters.size(); ++i) {
83 const typename HgtdTimedClusteringTool::Cluster& cluster = clusters[i];
84 ATH_CHECK(makeCluster(ctx, cluster, *container[previousSizeContainer+i]));
85 }
86
87 return StatusCode::SUCCESS;
88 }

◆ initialize()

StatusCode ActsTrk::HgtdTimedClusteringTool::initialize ( )
overridevirtual

Definition at line 37 of file HgtdTimedClusteringTool.cxx.

38 {
39 ATH_MSG_DEBUG("Initializing " << name() << "...");
40
42 ATH_CHECK(detStore()->retrieve(m_hgtd_id, "HGTD_ID"));
43 ATH_CHECK(m_hgtd_tdc_calib_tool.retrieve(EnableTool{m_use_altiroc_rdo.value()}));
44
46
47 return StatusCode::SUCCESS;
48 }
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ makeCluster()

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

Definition at line 90 of file HgtdTimedClusteringTool.cxx.

93 {
94 if (cluster.ids.empty()) return StatusCode::SUCCESS;
95
96 InDetDD::SiLocalPosition pos_acc(0,0);
97 double tot_time = 0;
98
99 for (size_t i = 0; i < cluster.ids.size(); i++) {
100 Identifier rdo_id = cluster.ids[i];
101
102 const InDetDD::HGTD_DetectorElement* element = m_hgtd_det_mgr->getDetectorElement(rdo_id);
103 InDetDD::SiCellId si_cell_id = element->cellIdFromIdentifier(rdo_id);
104 InDetDD::SiLocalPosition si_pos = element->design().localPositionOfCell(si_cell_id);
105
106 pos_acc += si_pos;
107 tot_time += cluster.times[i];
108 }
109
110 pos_acc /= cluster.ids.size();
111 tot_time /= cluster.ids.size();
112
113 // Create the cluster
114 Eigen::Matrix<float, 3, 1> loc_pos(pos_acc.xPhi(), pos_acc.xEta(), tot_time);
115 Eigen::Matrix<float, 3, 3> cov_matrix= Eigen::Matrix<float, 3, 3>::Zero();
116
117 constexpr float xWidth = 1.3;
118 constexpr float yWidth = 1.3;
119 cov_matrix(0,0) = xWidth * xWidth / 12 / cluster.ids.size(); // i.e. Cov XX
120 cov_matrix(1,1) = yWidth * yWidth / 12 / cluster.ids.size(); // i.e. Cov YY
121 constexpr float time_of_arrival_err = 0.035;
122 cov_matrix(2,2) = time_of_arrival_err * time_of_arrival_err / cluster.ids.size(); // i.e. Cov TT
123
124 IdentifierHash id_hash = m_hgtd_det_mgr->getDetectorElement(cluster.ids.front())->identifyHash();
125
126 // Fill
127 xaodcluster.setMeasurement<3>(id_hash,loc_pos,cov_matrix);
128 xaodcluster.setIdentifier(cluster.ids.front().get_compact());
129 xaodcluster.setRDOlist(std::move(cluster.ids));
130 xaodcluster.setToTlist(std::move(cluster.tots));
131
132 return StatusCode::SUCCESS;
133 }
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.
void setToTlist(const std::vector< int > &tots)
Sets the list of ToT of the channels building the cluster.
void setRDOlist(const std::vector< Identifier > &rdolist)
Sets 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.

Member Data Documentation

◆ m_addCorners

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

Definition at line 78 of file HgtdTimedClusteringTool.h.

78{this, "AddCorners", true};

◆ m_hgtd_det_mgr

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

Definition at line 69 of file HgtdTimedClusteringTool.h.

69{nullptr};

◆ m_hgtd_id

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

Definition at line 70 of file HgtdTimedClusteringTool.h.

70{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 71 of file HgtdTimedClusteringTool.h.

71 {this,
72 "HGTD_TdcCalibrationTool","HGTD_TdcCalibrationTool",
73 "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 77 of file HgtdTimedClusteringTool.h.

77{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 75 of file HgtdTimedClusteringTool.h.

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

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