ATLAS Offline Software
Loading...
Searching...
No Matches
PixelRDOCollectionAdapter.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
4#ifndef ACTSTRK_PIXELRDOCOLLECTIONADAPTER_H
5#define ACTSTRK_PIXELRDOCOLLECTIONADAPTER_H
6
11
13
14#include <cassert>
15#include <utility>
16
17namespace ActsTrk {
18
19 // RDO adapter for the PhaseIIPixelRawDataContainer
20 template <>
23 public:
27 // test whether this object can be dereferenced to return the representation of a single module.
28 // @note always true for this container
29 static constexpr bool isValid() { return true ; }
30 operator bool() const { return isValid();}
31
32 // dereferencing will return a representation of one module.
36 // return a pointer to the representation of one module.
40 // check whether the RDO collection represented by this object is empty.
41 bool empty() const {
42 return m_RDOs.empty();
43 }
44 // result represents the module of the given id_hash when dereferenced.
45 // @note must only be dereferenced if isValid is true.
46 static std::optional<RDOCollectionAdapter> make(const PhaseIIPixelRawDataContainer &rdo_container,const IdentifierHash &id_hash) {
47 auto rdo_container_proxy = PhaseII::makeRawDataCollectionProxy(rdo_container);
48 if (id_hash < rdo_container_proxy.size()) { return RDOCollectionAdapter(rdo_container_proxy[id_hash]); }
49 else { return std::optional<RDOCollectionAdapter>{}; }
50 }
51
52 // result represents an iterable range where each element represents one module
54 range(const PhaseIIPixelRawDataContainer &rdo_container) {
55 return PhaseII::makeRawDataCollectionProxy(rdo_container);
56 }
57
58 };
59
60
61 // helper class to adapt different RDOs to have the same interface
62 template <typename T_RDOContainer> class RDOAdapter;
63
64 // RDO adapter for the PixelRDO_Container.
65 // The underlying elements are of type PixelRDORawData.
66 template <>
69 public:
70 RDOAdapter(const PixelRDORawData *rdo) : m_rdo(rdo) {}
71
72 // compute the pixel identifier from the cell coordinates.
73 template <typename T_CellProxy>
74 Identifier computeIdentifier(const PixelID &pixelID, const Identifier &module_id, const T_CellProxy &cell_proxy) {
75 return pixelID.pixel_id(module_id, cell_proxy.coordinates()[0], cell_proxy.coordinates()[1]);
76 }
77
78 // get the level1 accept information.
79 int getLVL1A() const {
80 return m_rdo->getLVL1A();
81 }
82 // get the time-over-threshold which is a measure of the collected charge.
83 int getToT() const {
84 return m_rdo->getToT();
85 }
86 // get the pixel coordinates
87 // @return return the pixel coordinates in a format that can be passed to the PixelModuleDesign.
88 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> coordinates(const PixelID &pixelID) const {
89 const Identifier& rdoId = m_rdo->identify();
91 pixelID.eta_index(rdoId));
92 }
93 // test whether the pixel is a "ganged" pixel.
94 // Where ganged means that multiple pixels of the sensor are connected to the same readout channel.
95 // Thus ganged pixels get the same coordinates assigned by the hardware.
96 bool isGanged(const InDetDD::PixelModuleDesign& design, const PixelID &pixelID) const {
97 const Identifier& rdoId = m_rdo->identify();
98 InDetDD::SiCellId cellId(pixelID.phi_index(rdoId),
99 pixelID.eta_index(rdoId));
100 InDetDD::SiReadoutCellId readoutId = design.readoutIdOfCell(cellId);
101 return ( design.numberOfConnectedCells( readoutId ) > 1 );
102 }
103 };
104
105
106 // RDO adapter for the PhaseIIPixelRawDataContainer.
107 // The underlying elements are proxy objects representing a single RDO
108 template <>
111 public:
116 // compute the pixel identifier from the cell coordinates.
117 template <typename T_CellProxy>
118 Identifier computeIdentifier(const PixelID &pixelID, const Identifier &module_id, const T_CellProxy &) {
119 return pixelID.pixel_id(module_id, m_rdoProxy.coordinates()[0], m_rdoProxy.coordinates()[1]);
120 }
121 // get the level1 accept information.
122 int getLVL1A() const {
123 return m_rdoProxy.getLVL1A();
124 }
125 // get the time-over-threshold which is a measure of the collected charge.
126 int getToT() const {
127 return m_rdoProxy.getToT();
128 }
129 // Return the "index" which identifies the element this proxy refers to
130 index_t index() const {
131 return m_rdoProxy.index();
132 }
133 // get the pixel coordinates
134 // @return return the pixel coordinates in a format that can be passed to the PixelModuleDesign.
135 const std::array<std::int16_t,2> &coordinates(const PixelID &) const {
136 return m_rdoProxy.coordinates();
137 }
138 // test whether the pixel is a "ganged" pixel.
139 // Where ganged means that multiple pixels of the sensor are connected to the same readout channel.
140 // Thus ganged pixels get the same coordinates assigned by the hardware.
141 bool isGanged(const InDetDD::PixelModuleDesign& design, const PixelID &) const {
142 assert( std::in_range<int>(m_rdoProxy.coordinates()[0]) );
143 assert( std::in_range<int>(m_rdoProxy.coordinates()[1]) );
144 InDetDD::SiCellId cellId(m_rdoProxy.coordinates()[0],
145 m_rdoProxy.coordinates()[1]);
146 InDetDD::SiReadoutCellId readoutId = design.readoutIdOfCell(cellId);
147 return ( design.numberOfConnectedCells( readoutId ) > 1 );
148 }
149 };
150}
151#endif
PhaseII::PixelRawDataTypeTraits< PhaseII::AccessPolicy::Mutable >::ContainerCollection PhaseIIPixelRawDataContainer
InDetRawDataContainer< InDetRawDataCollection< PixelRDORawData > > PixelRDO_Container
typename PhaseII::PixelRawDataTypeTraits<>::RawDataProxy::index_t index_t
bool isGanged(const InDetDD::PixelModuleDesign &design, const PixelID &) const
const std::array< std::int16_t, 2 > & coordinates(const PixelID &) const
RDOAdapter(PhaseII::PixelRawDataTypeTraits<>::RawDataProxy &&rdo_proxy)
Identifier computeIdentifier(const PixelID &pixelID, const Identifier &module_id, const T_CellProxy &)
PhaseII::PixelRawDataTypeTraits ::RawDataProxy m_rdoProxy
Identifier computeIdentifier(const PixelID &pixelID, const Identifier &module_id, const T_CellProxy &cell_proxy)
bool isGanged(const InDetDD::PixelModuleDesign &design, const PixelID &pixelID) const
std::array< InDetDD::PixelDiodeTree::CellIndexType, 2 > coordinates(const PixelID &pixelID) const
static std::optional< RDOCollectionAdapter > make(const PhaseIIPixelRawDataContainer &rdo_container, const IdentifierHash &id_hash)
RDOCollectionAdapter(PhaseII::PixelRawDataTypeTraits<>::RawDataContainerProxy &&RDOs)
const PhaseII::PixelRawDataTypeTraits ::RawDataContainerProxy & operator*() const
const PhaseII::PixelRawDataTypeTraits ::RawDataContainerProxy * operator->() const
static PhaseII::RawDataTypeTraits< constPhaseII::PixelRawDataContainer >::ContainerCollectionProxy range(const PhaseIIPixelRawDataContainer &rdo_container)
PhaseII::PixelRawDataTypeTraits ::RawDataContainerProxy m_RDOs
RDOCollectionAdapter(const typename T_RDOContainer::base_value_type *RDOs)
This is a "hash" representation of an Identifier.
static constexpr std::array< PixelDiodeTree::CellIndexType, 2 > makeCellIndex(T local_x_idx, T local_y_idx)
Create a 2D cell index from the indices in local-x (phi, row) and local-y (eta, column) direction.
Class used to describe the design of a module (diode segmentation and readout scheme).
virtual int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
readout id -> id of connected diodes
virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
diode id -> readout id
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
Identifier for the strip or pixel readout cell.
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:69
int eta_index(const Identifier &id) const
Definition PixelID.h:640
Identifier pixel_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int phi_index, int eta_index) const
For an individual pixel.
Definition PixelID.h:423
int phi_index(const Identifier &id) const
Definition PixelID.h:634
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
RawDataTypeTraits< typename Utils::ContainerAccessHelper< PixelRawDataContainer, accessPolicy >::ContainerType > PixelRawDataTypeTraits
auto makeRawDataCollectionProxy(const T_RawDataContainerCollection &collection)
Create the top level container proxy for an RDO container collection (read only).
STL namespace.
typename RawData::details::traits< ContainerNonConst >::template RawDataProxy< accessPolicy > RawDataProxy
PhaseII::RawDataContainerProxy< typename Utils::ContainerAccessHelper< T_RawDataContainer, accessPolicy >::ContainerType, RawDataProxy > RawDataContainerProxy
PhaseII::ContainerCollectionProxy< typename Utils::ContainerAccessHelper< ContainerCollection, accessPolicy >::ContainerType, RawDataProxy > ContainerCollectionProxy