20using CLHEP::micrometer;
37 inline std::optional<std::array<std::int16_t,2> >
38 getGangedCoordinates(
const std::array<std::int16_t,2> &coordinates,
45 return std::array<std::int16_t,2>{
static_cast<std::int16_t
>(gangedCellID.
phiIndex()),
46 static_cast<std::int16_t
>(gangedCellID.
etaIndex())};
50 template <
typename T1,
typename T2>
51 T1 check_integer_cast(T2
a) {
52 assert( std::in_range<T1>(
a) );
53 return static_cast<T1>(
a);
78 return StatusCode::SUCCESS;
82 const std::string&
type,
const std::string& name,
const IInterface* parent)
83 : base_class(
type,name,parent)
87std::pair<unsigned int, unsigned int>
89 const std::vector<IdentifierHash> &listOfIds,
95 unsigned int n_hits = RDOs.
size();
96 if constexpr(GANGED) {
99 if (isFEI3(*element)) {
101 if (isGanged(rdo->identify(), *element)) {
109 unsigned int n_hits=0u;
110 if (listOfIds.empty()) {
113 n_hits += getNHits(*RDOs, detector_elements);
118 if (not
id.is_valid())
continue;
121 n_hits += getNHits(*RDOs, detector_elements);
129 return {n_hits,n_hits};
132std::pair<unsigned int, unsigned int>
134 const std::vector<IdentifierHash> &listOfIds,
153 const double lorentzShift,
178 std::optional<Identifier::value_type> first_rdo_id;
179 int cluster_lvl1min = std::numeric_limits<int>::max();
182 for (CellProxy cellProxy : cluster) {
185 Identifier rdo_id =
m_pixelID->pixel_id(module_id, cellProxy.coordinates()[0], cellProxy.coordinates()[1]);
186 if (!first_rdo_id.has_value()) {
196 assert(cellProxy.srcIndex() < rdos.
size());
198 cluster_lvl1min = std::min(cluster_lvl1min, rdo->
getLVL1A());
199 const int tot = rdo->
getToT();
202 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
204 cellProxy.coordinates()[1]);
210 std::uint32_t feValue = design.
getFE(si_param);
216 return StatusCode::FAILURE;
232 charge = tot/8.0*(8000.0-1200.0)+1200.0;
245 rowmax_diode = si_param;
249 rowmin_diode = si_param;
253 colmax_diode = si_param;
257 colmin_diode = si_param;
279 const int colWidth = colmax - colmin + 1;
280 const int rowWidth = rowmax - rowmin + 1;
282 double etaWidth = colmax_diode.
xEtaMax() - colmin_diode.
xEtaMin();
283 double phiWidth = rowmax_diode.
xPhiMax() - rowmin_diode.
xPhiMin();
290 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
291 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
292 double R [3] = {T(0,3),T(1,3),T(2,3)};
295 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]);
298 float width0, width1;
305 width0 = phiWidth / rowWidth;
306 width1 = etaWidth / colWidth;
311 Eigen::Matrix<float,2,1> localPosition(locpos.x(), locpos.y());
312 Eigen::Matrix<float,2,2> localCovariance = Eigen::Matrix<float,2,2>::Zero();
313 localCovariance(0, 0) = width0 * width0 / 12.0f;
314 localCovariance(1, 1) = width1 * width1 / 12.0f;
316 clusterVars.identifierHash[icluster] = idHash;
318 xAOD::MatrixMap<2>(clusterVars.localCovarianceDim2[icluster].data()) = localCovariance;
319 assert( first_rdo_id.has_value());
320 clusterVars.identifier[icluster] = *first_rdo_id;
322 xAOD::VectorMap<3>(clusterVars.globalPosition[icluster].data()) = globalPos.cast<
float>();
325 clusterVars.lvl1a[icluster] = cluster_lvl1min;
326 clusterVars.channelsInPhi[icluster] = rowWidth;
327 clusterVars.channelsInEta[icluster] = colWidth;
328 clusterVars.widthInEta[icluster] = etaWidth;
330 return StatusCode::SUCCESS;
335 const RawDataCollection& RDOs,
342 if ( pixelDetElStatus.
isGood(idHash) ) {
344 std::span<IPixelClusteringTool::CellContainer::Cell>
345 cellRange =
unpackRDOs(RDOs, pixelDetElStatus, element, cellContainer);
347 static constexpr unsigned int SORT_BY_LOCAL_X=0u;
349 CL::clusterize<SORT_BY_LOCAL_X, std::uint16_t>(cellRange,
350 CL::defaultConnectionHelper<CL::EConnectionType::CommonEdgeOrCorner>(cellRange));
353 [&cellContainer](std::span<IPixelClusteringTool::CellContainer::Cell> &,
354 unsigned int idx_begin,
355 unsigned int idx_end) {
363 return StatusCode::SUCCESS;
368 [[maybe_unused]] std::size_t nClusterRDOs)
const
376 const RDOContainer &rdoContainer,
378 unsigned int imodule,
380 unsigned int icluster,
382 std::any& cache)
const
388 calibData = calibDataHandle.
cptr();
392 return StatusCode::FAILURE;
407 auto* clusterVars = std::any_cast<xAOD::PixelCluster::ClusterVars> (&cache);
408 if (!clusterVars)
throw std::bad_any_cast();
411 if (!rdos)
return StatusCode::FAILURE;
416 CellContainerProxy cellContainerProxy(&cellContainer);
417 ModuleProxy moduleProxy(cellContainerProxy[imodule]);
431 return StatusCode::SUCCESS;
434std::span<IPixelClusteringTool::CellContainer::Cell>
447 unsigned int rdo_i=0;
448 for (
const auto *
const rdo : RDOs) {
451 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
455 std::uint32_t fe = design.
getFE(si_param);
460 std::array<std::int16_t,2> coordinates{check_integer_cast<int16_t>(diode_idx[0]),
461 check_integer_cast<int16_t>(diode_idx[1])};
464 if ( check_ganged ) {
465 std::optional<std::array<std::int16_t,2> > gangedCoordinates = getGangedCoordinates(coordinates, element);
466 if (gangedCoordinates.has_value()) {
#define ATH_CHECK
Evaluate an expression and check for errors.
double charge(const T &p)
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
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.
int phiIndex() const
Get phi index. Equivalent to strip().
int etaIndex() const
Get eta index.
Class to hold the SiDetectorElement objects to be put in the detector store.
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):
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.
virtual Identifier identify() const override final
identifier of this detector element (inline)
Trk::Surface & surface()
Element Surface.
virtual IdentifierHash identifyHash() const override final
bool isChipGood(IdentifierHash hash, unsigned int chip) const
bool isGood(IdentifierHash hash) const
unsigned int identifyHash() const
CalibrationStrategy getCalibrationStrategy(unsigned int moduleHash) const
float getCharge(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float ToT) const
virtual int getToT() const =0
virtual int getLVL1A() const =0
const_pointer_type cptr()
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
void updateEndIndex(unsigned int obj_i, unsigned int elm_i)
unsigned int getBeginIndex(unsigned int obj_i) const
void setValue(unsigned int elm_i, T &&value)
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
void for_each_cluster(cell_collection_t &cells, func_t func)
call the given function for each cluster of a label sorted cell collection.
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())
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
Eigen::Map< MeasVector< N > > VectorMap
Eigen::Map< MeasMatrix< N > > MatrixMap
IdentifierHash identifyHash() const
ClusterRange range() const
std::span< Cell > moduleCellSpan()
void registerNewCluster(index_t cell_begin_idx, index_t cell_end_idx)
void emplace_back_cell(const std::array< coordinates_t, NDIM > &the_coordinates, index_t src_index)
void registerClustersForNewModule(const ClusterRange &a_range)
ModuleRangeGuard startNewModule(unsigned int id_hash)
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.
xAOD::xAODInDetMeasurement::Utilities::JaggedVecEltCache< float > chargeList
xAOD::xAODInDetMeasurement::Utilities::JaggedVecEltCache< int > totList
xAOD::xAODInDetMeasurement::Utilities::JaggedVecEltCache< Identifier::value_type > rdoList