ATLAS Offline Software
Loading...
Searching...
No Matches
PixelFEUtils.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 PIXELFEUTILS_H
5#define PIXELFEUTILS_H
6
10#include <algorithm>
11#include <tuple>
12#include <limits>
13#include <cassert>
14#include <array>
15#include <cstdint>
16
17namespace Pixel {
18
21 template <typename T>
22 inline std::tuple<T,T> sorted_tuple(T a, T b) {
23 return (a<b ? std::make_tuple(a,b) : std::make_tuple(b,a) );
24 }
25
34 inline double getGoodFraction(const InDet::SiDetectorElementStatus &pixelDetElStatus,
35 const InDetDD::PixelModuleDesign &design,
36 const PixelID &pixelID,
37 const IdentifierHash &modulIdHash,
38 const Identifier &startId,
39 const Identifier &endId) {
40 auto [phiStart,phiEnd] = sorted_tuple( pixelID.phi_index(startId), pixelID.phi_index(endId) );
41 auto [etaStart,etaEnd] = sorted_tuple( pixelID.eta_index(startId), pixelID.eta_index(endId) );
42
43 double nTotal = (phiEnd-phiStart+1.0)*(etaEnd-etaStart+1.0);
44
45 unsigned int nGood=0;
46 for (int i=phiStart; i<=phiEnd; i++) {
47 for (int j=etaStart; j<=etaEnd; j++) {
48
49 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
51 InDetDD::PixelDiodeTree::DiodeProxy si_param ( design.diodeProxyFromIdx(diode_idx));
52 std::uint32_t feValue = design.getFE(si_param);
53
54 if (pixelDetElStatus.isChipGood(modulIdHash,feValue)) {++nGood;}
55 }
56 }
57 return nGood/nTotal;
58 }
59
65 inline unsigned int makeReadoutTechnologyBit( InDetDD::PixelReadoutTechnology technology, unsigned int bit_val=1 ) {
66 assert(static_cast<unsigned int>(technology) < 31); //technology can be -1
67 //shift amount ( = technology) is checked in dbg build
68 //coverity[BAD_SHIFT]
69 return bit_val << static_cast<unsigned int>(technology);
70 }
71
78 const IdentifierHash &moduleIdHash,
81 {
82 const InDetDD::SiDetectorElement *element = elementStatus.getDetectorElement(moduleIdHash);
83 const InDetDD::PixelModuleDesign &p_design = dynamic_cast<const InDetDD::PixelModuleDesign &>(element->design());
84 return ( static_cast<uint64_t>(p_design.getReadoutTechnology()) < 31ul && readOutTechnologyMask & Pixel::makeReadoutTechnologyBit(p_design.getReadoutTechnology()) );
85 }
86
87}
88#endif
static Double_t a
This is an Identifier helper class for the Pixel subdetector.
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).
PixelReadoutTechnology getReadoutTechnology() const
PixelDiodeTree::DiodeProxy diodeProxyFromIdx(const std::array< PixelDiodeTree::IndexType, 2 > &idx) const
static unsigned int getFE(const PixelDiodeTree::DiodeProxy &diode_proxy)
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
bool isChipGood(IdentifierHash hash, unsigned int chip) const
const InDetDD::SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
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
int phi_index(const Identifier &id) const
Definition PixelID.h:634
bool matchingReadoutTechnology(const InDet::SiDetectorElementStatus &elementStatus, const IdentifierHash &moduleIdHash, unsigned int readOutTechnologyMask=(Pixel::makeReadoutTechnologyBit(InDetDD::PixelReadoutTechnology::FEI4)|(Pixel::makeReadoutTechnologyBit(InDetDD::PixelReadoutTechnology::FEI3))))
Check whether the readout technology of the specified module is contained in the given readout techno...
double getGoodFraction(const InDet::SiDetectorElementStatus &pixelDetElStatus, const InDetDD::PixelModuleDesign &design, const PixelID &pixelID, const IdentifierHash &modulIdHash, const Identifier &startId, const Identifier &endId)
Get The fraction of good chips the pixel of a pixel array is connected to.
unsigned int makeReadoutTechnologyBit(InDetDD::PixelReadoutTechnology technology, unsigned int bit_val=1)
Create a word with a bit representing the given readout technology to the given value.
std::tuple< T, T > sorted_tuple(T a, T b)
Create a tuple of the given values in increasing order.
Helper class to access parameters of a diode.