ATLAS Offline Software
Loading...
Searching...
No Matches
PixelFEUtils.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 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
15namespace Pixel {
16
19 template <typename T>
20 inline std::tuple<T,T> sorted_tuple(T a, T b) {
21 return (a<b ? std::make_tuple(a,b) : std::make_tuple(b,a) );
22 }
23
32 inline double getGoodFraction(const InDet::SiDetectorElementStatus &pixelDetElStatus,
33 const InDetDD::PixelModuleDesign &design,
34 const PixelID &pixelID,
35 const IdentifierHash &modulIdHash,
36 const Identifier &startId,
37 const Identifier &endId) {
38 auto [phiStart,phiEnd] = sorted_tuple( pixelID.phi_index(startId), pixelID.phi_index(endId) );
39 auto [etaStart,etaEnd] = sorted_tuple( pixelID.eta_index(startId), pixelID.eta_index(endId) );
40
41 double nTotal = (phiEnd-phiStart+1.0)*(etaEnd-etaStart+1.0);
42
43 unsigned int nGood=0;
44 for (int i=phiStart; i<=phiEnd; i++) {
45 for (int j=etaStart; j<=etaEnd; j++) {
46
47 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
49 InDetDD::PixelDiodeTree::DiodeProxy si_param ( design.diodeProxyFromIdx(diode_idx));
50 std::uint32_t feValue = design.getFE(si_param);
51
52 if (pixelDetElStatus.isChipGood(modulIdHash,feValue)) {++nGood;}
53 }
54 }
55 return nGood/nTotal;
56 }
57
63 inline unsigned int makeReadoutTechnologyBit( InDetDD::PixelReadoutTechnology technology, unsigned int bit_val=1 ) {
64 assert(static_cast<unsigned int>(technology) < 31);
65 return bit_val << static_cast<unsigned int>(technology);
66 }
67
74 const IdentifierHash &moduleIdHash,
77 {
78 const InDetDD::SiDetectorElement *element = elementStatus.getDetectorElement(moduleIdHash);
79 const InDetDD::PixelModuleDesign &p_design = dynamic_cast<const InDetDD::PixelModuleDesign &>(element->design());
80 return ( static_cast<uint64_t>(p_design.getReadoutTechnology()) < 31ul && readOutTechnologyMask & Pixel::makeReadoutTechnologyBit(p_design.getReadoutTechnology()) );
81 }
82
83}
84#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:67
int eta_index(const Identifier &id) const
Definition PixelID.h:645
int phi_index(const Identifier &id) const
Definition PixelID.h:639
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.