6#include <Acts/Clusterization/Clusterization.hpp>
14#include <unordered_set>
17using CLHEP::micrometer;
24 static inline int getCellRow(
const typename PixelClusteringTool::Cell& cell) {
return cell.ROW; }
25 static inline int getCellColumn(
const typename PixelClusteringTool::Cell& cell) {
return cell.COL; }
33 const PixelClusteringTool::Cell& cell)
35 cl.ids.push_back(cell.ID);
36 cl.tots.push_back(cell.TOT);
37 if (cell.LVL1 < cl.lvl1min)
38 cl.lvl1min = cell.LVL1;
59 return StatusCode::SUCCESS;
63 const std::string&
type,
const std::string& name,
const IInterface* parent)
64 : base_class(
type,name,parent)
73 const double lorentz_shift,
81 std::vector<float> chargeList;
82 if (calibData) chargeList.reserve(cluster.ids.size());
98 for (
size_t i = 0; i < cluster.ids.size(); i++) {
110 int tot = cluster.tots.at(i);
113 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
121 std::uint32_t feValue = design.
getFE(si_param);
126 return StatusCode::FAILURE;
134 chargeList.push_back(
charge);
143 charge = tot/8.0*(8000.0-1200.0)+1200.0;
145 chargeList.push_back(
charge);
153 rowmax_diode = si_param;
157 rowmin_diode = si_param;
161 colmax_diode = si_param;
165 colmin_diode = si_param;
187 const int colWidth = colmax - colmin + 1;
188 const int rowWidth = rowmax - rowmin + 1;
190 double etaWidth = colmax_diode.
xEtaMax() - colmin_diode.
xEtaMin();
191 double phiWidth = rowmax_diode.
xPhiMax() - rowmin_diode.
xPhiMin();
198 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
199 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
200 double R [3] = {T(0,3),T(1,3),T(2,3)};
203 Amg::Vector3D globalPos(M[0]*Ax[0]+M[1]*Ay[0]+R[0],M[0]*Ax[1]+M[1]*Ay[1]+R[1],M[0]*Ax[2]+M[1]*Ay[2]+R[2]);
206 float width0, width1;
213 width0 = phiWidth / rowWidth;
214 width1 = etaWidth / colWidth;
219 Eigen::Matrix<float,2,1> localPosition(locpos.x(), locpos.y());
220 Eigen::Matrix<float,2,2> localCovariance = Eigen::Matrix<float,2,2>::Zero();
221 localCovariance(0, 0) = width0 * width0 / 12.0f;
222 localCovariance(1, 1) = width1 * width1 / 12.0f;
224 clusterVars.identifierHash[icluster] = moduleHash;
226 xAOD::MatrixMap<2>(clusterVars.localCovarianceDim2[icluster].data()) = localCovariance;
227 clusterVars.identifier[icluster] = cluster.ids.front();
228 clusterVars.rdoList[icluster] = std::move(cluster.ids);
229 xAOD::VectorMap<3>(clusterVars.globalPosition[icluster].data()) = globalPos.cast<
float>();
230 clusterVars.totList[icluster] = std::move(cluster.tots);
231 clusterVars.lvl1a[icluster] = cluster.lvl1min;
232 clusterVars.channelsInPhi[icluster] = rowWidth;
233 clusterVars.channelsInEta[icluster] = colWidth;
234 clusterVars.widthInEta[icluster] = etaWidth;
236 return StatusCode::SUCCESS;
241 const RawDataCollection& RDOs,
244 Acts::Ccl::ClusteringData&
data,
245 std::vector<ClusterCollection>& collection)
const
248 collection.emplace_back();
249 if ( not pixelDetElStatus.
isGood(idHash) ) {
253 return StatusCode::SUCCESS;
257 CellCollection cells =
unpackRDOs(RDOs, pixelDetElStatus, element);
259 Acts::Ccl::createClusters<CellCollection, ClusterCollection, 2>
260 (
data, cells, collection.back(), Acts::Ccl::DefaultConnect<Cell, 2>(
m_addCorners));
262 return StatusCode::SUCCESS;
278 typename ClusterContainer::iterator )
const
284 calibData = calibDataHandle.
cptr();
288 return StatusCode::FAILURE;
302 auto* clusterVars = std::any_cast<xAOD::PixelCluster::ClusterVars> (&vars);
303 if (!clusterVars)
throw std::bad_any_cast();
316 return StatusCode::SUCCESS;
327 CellCollection cells;
331 for (
const auto *
const rdo : RDOs) {
333 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
337 std::uint32_t fe = design.
getFE(si_param);
341 if (not pixelDetElStatus.
isChipGood(idHash, fe)) {
345 const int lvl1 = rdo->getLVL1A();
346 const int tot = rdo->getToT();
348 cells.emplace_back(
m_pixelID->phi_index(rdoID),
355 std::optional<Identifier> gangedID =
isGanged(rdoID, element);
356 if (gangedID.has_value()) {
357 cells.emplace_back(
m_pixelID->phi_index(*gangedID),
361 gangedID->get_compact());
370inline std::optional<Identifier>
#define ATH_CHECK
Evaluate an expression and check for errors.
double charge(const T &p)
char data[hepevt_bytes_allocation_ATLAS]
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
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)
PixelDiodeTree::DiodeProxyWithPosition diodeProxyFromIdxCachePosition(const std::array< PixelDiodeTree::IndexType, 2 > &idx) const
PixelReadoutTechnology getReadoutTechnology() const
PixelDiodeTree::DiodeProxy diodeProxyFromIdx(const std::array< PixelDiodeTree::IndexType, 2 > &idx) const
static InDetDD::PixelDiodeType getDiodeType(const PixelDiodeTree::DiodeProxy &diode_proxy)
static unsigned int getFE(const PixelDiodeTree::DiodeProxy &diode_proxy)
Identifier for the strip or pixel cell.
Class to hold geometrical description of a silicon detector element.
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
virtual Identifier identifierFromCellId(const SiCellId &cellId) const override final
Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie s...
SiCellId connectedCell(const SiCellId cellId, int number) const
Get the cell ids sharing the readout for this cell.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
int numberOfConnectedCells(const SiCellId cellId) const
Test if readout cell has more than one diode associated with it.
Trk::Surface & surface()
Element Surface.
bool isChipGood(IdentifierHash hash, unsigned int chip) const
bool isGood(IdentifierHash hash) const
CalibrationStrategy getCalibrationStrategy(unsigned int moduleHash) const
float getCharge(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float ToT) const
Manage lookup of vectors of auxiliary data.
const_pointer_type cptr()
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
static int getCellRow(const typename PixelClusteringTool::Cell &cell)
static void clusterAddCell(PixelClusteringTool::Cluster &cl, const PixelClusteringTool::Cell &cell)
static int getCellColumn(const typename PixelClusteringTool::Cell &cell)
static void clusterReserve(PixelClusteringTool::Cluster &cl, std::size_t n)
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Eigen::Map< MeasVector< N > > VectorMap
Eigen::Map< MeasMatrix< N > > MatrixMap
A diode proxy which caches the position of a diode.
double xPhiMax() const
for backward compatibility, return the position of the lower edge of the diode in local-y(phi,...
double xEtaMin() const
for backward compatibility, return the position of the lower edge of the diode in local-y(eta,...
double xPhiMin() const
for backward compatibility, return the position of the lower edge of the diode in local-x(phi,...
const Vector2D & position() const
get the cached position of this diode
double xEtaMax() const
for backward compatibility, return the position of the upper edge of the diode in local-y(eta,...
Helper class to access parameters of a diode.