ATLAS Offline Software
Loading...
Searching...
No Matches
SinglePadClusterTool.cxx
Go to the documentation of this file.
1
10
12
14
15namespace HGTD {
16
18 const std::string& name,
19 const IInterface* parent)
20 : base_class(type, name, parent) {}
21
23
24 ATH_CHECK(AlgTool::initialize());
25
26 ATH_CHECK(m_cluster_maker.retrieve());
27
28 ATH_CHECK(detStore()->retrieve(m_hgtd_det_mgr, "HGTD"));
29
30 return StatusCode::SUCCESS;
31}
32
33std::unique_ptr<HGTD_ClusterCollection>
35 DataPool<HGTD_Cluster>* dataItemsPool) const {
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();
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}
119
120} // namespace HGTD
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
a typed memory pool that saves time spent allocation small object.
Definition DataPool.h:63
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
virtual std::unique_ptr< HGTD_ClusterCollection > clusterize(const HGTD_RDO_Collection &rdo_coll, DataPool< HGTD_Cluster > *dataItemsPool) const override final
virtual StatusCode initialize() override final
SinglePadClusterTool(const std::string &type, const std::string &name, const IInterface *parent)
ToolHandle< HGTD_ClusterMakerTool > m_cluster_maker
const Identifier & identify() const
const IdentifierHash & identifierHash() const
This is a "hash" representation of an Identifier.
Class to hold geometrical description of an HGTD detector element.
SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
const HGTD_ModuleDesign & design() const override final
access to the local description:
Class used to describe the design of a module (diode segmentation and readout scheme)
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
readout or diode id -> position.
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
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
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts