ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD::SinglePadClusterTool Class Reference

#include <SinglePadClusterTool.h>

Inheritance diagram for HGTD::SinglePadClusterTool:
Collaboration diagram for HGTD::SinglePadClusterTool:

Public Member Functions

 SinglePadClusterTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override final
virtual std::unique_ptr< HGTD_ClusterCollectionclusterize (const HGTD_RDO_Collection &rdo_coll, DataPool< HGTD_Cluster > *dataItemsPool) const override final

Private Attributes

ToolHandle< HGTD_ClusterMakerToolm_cluster_maker {this, "ClusterMakerTool", "HGTD_ClusterMakerTool", "Tool for creating HGTD_Cluster objects"}
const HGTD_DetectorManagerm_hgtd_det_mgr {nullptr}

Detailed Description

Definition at line 28 of file SinglePadClusterTool.h.

Constructor & Destructor Documentation

◆ SinglePadClusterTool()

HGTD::SinglePadClusterTool::SinglePadClusterTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 17 of file SinglePadClusterTool.cxx.

20 : base_class(type, name, parent) {}

Member Function Documentation

◆ clusterize()

std::unique_ptr< HGTD_ClusterCollection > HGTD::SinglePadClusterTool::clusterize ( const HGTD_RDO_Collection & rdo_coll,
DataPool< HGTD_Cluster > * dataItemsPool ) const
finaloverridevirtual

Definition at line 34 of file SinglePadClusterTool.cxx.

35 {
36
37 Identifier identifier = rdo_coll.identify();
38 IdentifierHash id_hash = rdo_coll.identifierHash();
39
40 std::unique_ptr<HGTD_ClusterCollection> cluster_collection =
41 std::make_unique<HGTD_ClusterCollection>(id_hash);
42
43 if(dataItemsPool){
44 cluster_collection->clear(SG::VIEW_ELEMENTS);
45 }
46
47 cluster_collection->setIdentifier(identifier);
48 cluster_collection->reserve(rdo_coll.size());
49
50 const InDetDD::HGTD_DetectorElement* element =
51 m_hgtd_det_mgr->getDetectorElement(identifier);
52
53 for (const auto *const rdo : rdo_coll) {
54
55 Identifier rdo_id = rdo->identify();
56 ATH_MSG_DEBUG("Using RDO: " << rdo_id);
57
58 // get the local position from the detector design
59 InDetDD::SiCellId si_cell_id = element->cellIdFromIdentifier(rdo_id);
60 const InDetDD::HGTD_ModuleDesign& det_design = element->design();
61 InDetDD::SiLocalPosition si_pos =
62 det_design.localPositionOfCell(si_cell_id);
63 Amg::Vector2D loc_pos(si_pos.xPhi(), si_pos.xEta());
64 ATH_MSG_DEBUG("Local position: x=" << loc_pos.x() << " y=" << loc_pos.y());
65
66 // a cluster consists only of the pad itself
67 std::vector<Identifier> rdo_list = {rdo_id};
68
69 // From SiWidth header:
70 // Constructor with parameters: <col, row> in units of RDOs (so should be
71 // int),
72 // <phiR width in mm, Z width in mm>
73 // NOTE: without a clustering of the pads, the width of each "cluster" is 1
74 // in col and row direction
75 int col_width = 1;
76 int row_width = 1;
77 //FIXME there is a bug in the detector design! should not be hardcoded here
78 // double eta_width = det_design.etaPitch();
79 // double phi_width = det_design.phiPitch();
80 double eta_width = 1.3;
81 double phi_width = 1.3;
82 ATH_MSG_DEBUG("eta_width=" << eta_width << " phi_width=" << phi_width);
83
84 InDet::SiWidth si_width(Amg::Vector2D(col_width, row_width),
85 Amg::Vector2D(phi_width, eta_width));
86
87 // retrieve the time of arrival
88 float time_of_arrival = rdo->getTOA();
89
90 // this would hold the vector of all cluster components. Only size 1 if RDO
91 // gets transformed to cluster directly
92 std::vector<int> time_over_threshold = {static_cast<int>(rdo->getTOT())};
93
94 HGTD_Cluster* cluster = nullptr;
95 if (dataItemsPool) {
96 // data Item pool owns the element. The collection
97 // is view. Just move assign to it.
98 cluster = dataItemsPool->nextElementPtr();
99 } else {
100 // collection will own the element release
101 cluster = new HGTD_Cluster();
102 }
103 (*cluster) = m_cluster_maker->createCluster(
104 rdo_id,
105 loc_pos,
106 std::move(rdo_list),
107 si_width,
108 element,
109 time_of_arrival,
110 std::move(time_over_threshold));
111
112 cluster->setHashAndIndex(cluster_collection->identifyHash(),
113 cluster_collection->size());
114
115 cluster_collection->push_back(cluster);
116 }
117 return cluster_collection;
118}
#define ATH_MSG_DEBUG(x)
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
size_type size() const noexcept
Returns the number of elements in the collection.
const HGTD_DetectorManager * m_hgtd_det_mgr
ToolHandle< HGTD_ClusterMakerTool > m_cluster_maker
const Identifier & identify() const
const IdentifierHash & identifierHash() const
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:
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
Eigen::Matrix< double, 2, 1 > Vector2D
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts

◆ initialize()

StatusCode HGTD::SinglePadClusterTool::initialize ( )
finaloverridevirtual

Definition at line 22 of file SinglePadClusterTool.cxx.

22 {
23
24 ATH_CHECK(AlgTool::initialize());
25
26 ATH_CHECK(m_cluster_maker.retrieve());
27
29
30 return StatusCode::SUCCESS;
31}
#define ATH_CHECK
Evaluate an expression and check for errors.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

Member Data Documentation

◆ m_cluster_maker

ToolHandle<HGTD_ClusterMakerTool> HGTD::SinglePadClusterTool::m_cluster_maker {this, "ClusterMakerTool", "HGTD_ClusterMakerTool", "Tool for creating HGTD_Cluster objects"}
private

Definition at line 41 of file SinglePadClusterTool.h.

41{this, "ClusterMakerTool", "HGTD_ClusterMakerTool", "Tool for creating HGTD_Cluster objects"};

◆ m_hgtd_det_mgr

const HGTD_DetectorManager* HGTD::SinglePadClusterTool::m_hgtd_det_mgr {nullptr}
private

Definition at line 42 of file SinglePadClusterTool.h.

42{nullptr};

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