ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::PixelDetectorElementStatus Class Reference

Event data to hold the status information for Pixel modules. More...

#include <PixelDetectorElementStatus.h>

Inheritance diagram for InDet::PixelDetectorElementStatus:
Collaboration diagram for InDet::PixelDetectorElementStatus:

Public Member Functions

 PixelDetectorElementStatus (const PixelDetectorElementStatus &si_detector_element_status)=default
 PixelDetectorElementStatus (const InDetDD::SiDetectorElementCollection &detector_elements)
unsigned int numberOfChips (const IdentifierHash &hash) const
const InDetDD::SiDetectorElementgetDetectorElement (const IdentifierHash &hash) const
const InDetDD::SiDetectorElementCollectiongetDetectorElements () const
bool isGood (IdentifierHash hash) const
bool isChipGood (IdentifierHash hash, unsigned int chip) const
bool isCellGood (IdentifierHash hash, unsigned short cell_i) const
SiDetectorElementStatusmerge (const SiDetectorElementStatus &a)
 bitwise AND of module and chip status bits.
const std::vector< bool > & getElementStatus () const
std::vector< bool > & getElementStatus ()
const std::vector< ChipFlags_t > & getElementChipStatus () const
std::vector< ChipFlags_t > & getElementChipStatus ()
const std::vector< std::vector< unsigned short > > & getBadCells () const
std::vector< std::vector< unsigned short > > & getBadCells ()
 Get a non-const bad cells container owned by this instance.

Protected Member Functions

virtual unsigned int numberOfChips (const InDetDD::SiDetectorDesign &design) const override

Private Member Functions

void copyBadCells ()

Static Private Member Functions

static void notOwningBadCells ()

Private Attributes

const InDetDD::SiDetectorElementCollectionm_detectorElements = nullptr
std::vector< bool > m_elementStatus
std::vector< ChipFlags_t > m_elementChipStatus
std::vector< std::vector< unsigned short > > * m_badCells = nullptr
bool m_owner = false

Detailed Description

Event data to hold the status information for Pixel modules.

Definition at line 13 of file PixelDetectorElementStatus.h.

Constructor & Destructor Documentation

◆ PixelDetectorElementStatus() [1/2]

InDet::PixelDetectorElementStatus::PixelDetectorElementStatus ( const PixelDetectorElementStatus & si_detector_element_status)
default

◆ PixelDetectorElementStatus() [2/2]

InDet::PixelDetectorElementStatus::PixelDetectorElementStatus ( const InDetDD::SiDetectorElementCollection & detector_elements)
inline

Definition at line 17 of file PixelDetectorElementStatus.h.

18 : InDet::SiDetectorElementStatus(detector_elements) {}

Member Function Documentation

◆ copyBadCells()

void InDet::SiDetectorElementStatus::copyBadCells ( )
inlineprivateinherited

Definition at line 131 of file SiDetectorElementStatus.h.

131 {
132 m_badCells = new std::vector<std::vector<unsigned short> > (*m_badCells);
133 m_owner=true;
134 }
std::vector< std::vector< unsigned short > > * m_badCells

◆ getBadCells() [1/2]

std::vector< std::vector< unsigned short > > & InDet::SiDetectorElementStatus::getBadCells ( )
inlineinherited

Get a non-const bad cells container owned by this instance.

Will create a copy of the bad cells container if it is not owned by this instance.

Definition at line 125 of file SiDetectorElementStatus.h.

◆ getBadCells() [2/2]

const std::vector< std::vector< unsigned short > > & InDet::SiDetectorElementStatus::getBadCells ( ) const
inlineinherited

Definition at line 120 of file SiDetectorElementStatus.h.

120{ return *m_badCells; }

◆ getDetectorElement()

const InDetDD::SiDetectorElement * InDet::SiDetectorElementStatus::getDetectorElement ( const IdentifierHash & hash) const
inlineinherited

Definition at line 91 of file SiDetectorElementStatus.h.

91 {
92 return m_detectorElements->at(hash.value());
93 }
const InDetDD::SiDetectorElementCollection * m_detectorElements

◆ getDetectorElements()

const InDetDD::SiDetectorElementCollection & InDet::SiDetectorElementStatus::getDetectorElements ( ) const
inlineinherited

Definition at line 94 of file SiDetectorElementStatus.h.

94 {
95 return *m_detectorElements;
96 }

◆ getElementChipStatus() [1/2]

std::vector< ChipFlags_t > & InDet::SiDetectorElementStatus::getElementChipStatus ( )
inlineinherited

Definition at line 119 of file SiDetectorElementStatus.h.

119{ return m_elementChipStatus; }
std::vector< ChipFlags_t > m_elementChipStatus

◆ getElementChipStatus() [2/2]

const std::vector< ChipFlags_t > & InDet::SiDetectorElementStatus::getElementChipStatus ( ) const
inlineinherited

Definition at line 118 of file SiDetectorElementStatus.h.

118{ return m_elementChipStatus; }

◆ getElementStatus() [1/2]

std::vector< bool > & InDet::SiDetectorElementStatus::getElementStatus ( )
inlineinherited

Definition at line 117 of file SiDetectorElementStatus.h.

117{ return m_elementStatus; }

◆ getElementStatus() [2/2]

const std::vector< bool > & InDet::SiDetectorElementStatus::getElementStatus ( ) const
inlineinherited

Definition at line 116 of file SiDetectorElementStatus.h.

116{ return m_elementStatus; }

◆ isCellGood()

bool InDet::SiDetectorElementStatus::isCellGood ( IdentifierHash hash,
unsigned short cell_i ) const
inlineinherited

Definition at line 107 of file SiDetectorElementStatus.h.

107 {
108 const std::vector<unsigned short> &bad_cells= std::as_const(m_badCells)->at(hash);
109 return !std::binary_search(bad_cells.begin(),bad_cells.end(),cell_i);
110 }

◆ isChipGood()

bool InDet::SiDetectorElementStatus::isChipGood ( IdentifierHash hash,
unsigned int chip ) const
inlineinherited

Definition at line 100 of file SiDetectorElementStatus.h.

100 {
101#ifndef NDEBUG
102 assert( m_elementStatus.empty() || (chip < numberOfChips(hash) && ((1<<(numberOfChips(hash)-1) ) <= std::numeric_limits<ChipFlags_t>::max())));
103#endif
104 return m_elementChipStatus.empty() || m_elementChipStatus.at(hash.value()) & (1<<chip);
105 }
unsigned int numberOfChips(const IdentifierHash &hash) const

◆ isGood()

bool InDet::SiDetectorElementStatus::isGood ( IdentifierHash hash) const
inlineinherited

Definition at line 97 of file SiDetectorElementStatus.h.

97 {
98 return m_elementStatus.at(hash.value());
99 }

◆ merge()

SiDetectorElementStatus & InDet::SiDetectorElementStatus::merge ( const SiDetectorElementStatus & a)
inherited

bitwise AND of module and chip status bits.

Definition at line 28 of file SiDetectorElementStatus.cxx.

28 {
29 if ( (!getElementStatus().empty() && !b.getElementStatus().empty() && getElementStatus().size() != b.getElementStatus().size())
30 || (!getElementChipStatus().empty() && !b.getElementChipStatus().empty() && getElementChipStatus().size() != b.getElementChipStatus().size())) {
31 std::stringstream msg;
32 msg << "Status array sizes do not match:"
33 << getElementStatus().size() << " != " << b.getElementStatus().size() << " || "
34 << getElementChipStatus().size() << " != " << b.getElementChipStatus().size();
35 throw std::runtime_error(msg.str());
36 }
37
38 if (!getElementStatus().empty() && !b.getElementStatus().empty()) {
39 for (std::size_t elm_i=0; elm_i < m_elementStatus.size(); ++elm_i) {
40 m_elementStatus[elm_i] = m_elementStatus[elm_i] && b.m_elementStatus[elm_i];
41 }
42 }
43 else if (!b.getElementStatus().empty()) {
44 m_elementStatus = b.m_elementStatus;
45 }
46
47 if (!getElementChipStatus().empty() && !b.getElementChipStatus().empty()) {
48 for (std::size_t elm_i=0; elm_i < m_elementChipStatus.size(); ++elm_i) {
49 m_elementChipStatus[elm_i] &= b.m_elementChipStatus[elm_i];
50 }
51 }
52 else if (!b.getElementChipStatus().empty()) {
53 m_elementChipStatus = b.m_elementChipStatus;
54 }
55 if (&getBadCells() != &b.getBadCells()) {
57 if (!getBadCells().empty() && !b.getBadCells().empty()) {
58 unsigned int element_i=0;
59 for (const std::vector<unsigned short> &bad_module_strips : b.getBadCells()) {
60 std::vector<unsigned short> &dest = (*m_badCells)[element_i];
61 if (dest.empty()) {
62 dest=bad_module_strips;
63 }
64 else {
65 for (unsigned int bad_strip : bad_module_strips) {
66 std::vector<unsigned short>::const_iterator iter = std::lower_bound(dest.begin(),dest.end(),bad_strip);
67 if (iter == dest.end() || *iter != bad_strip) {
68 dest.insert( iter, bad_strip);
69 }
70 }
71 }
72 ++element_i;
73 }
74 }
75 else if (!b.getBadCells().empty()){
76 *m_badCells = b.getBadCells();
77 }
78 }
79 return *this;
80 }
static const Attributes_t empty
const std::vector< bool > & getElementStatus() const
const std::vector< ChipFlags_t > & getElementChipStatus() const
const std::vector< std::vector< unsigned short > > & getBadCells() const
MsgStream & msg
Definition testRead.cxx:32

◆ notOwningBadCells()

void InDet::SiDetectorElementStatus::notOwningBadCells ( )
staticprivateinherited

Definition at line 82 of file SiDetectorElementStatus.cxx.

82{ throw std::logic_error("Bad cells not owned by this instance, cannot return non const bad cell pointer."); }

◆ numberOfChips() [1/2]

virtual unsigned int InDet::PixelDetectorElementStatus::numberOfChips ( const InDetDD::SiDetectorDesign & design) const
inlineoverrideprotectedvirtual

Implements InDet::SiDetectorElementStatus.

Definition at line 20 of file PixelDetectorElementStatus.h.

20 {
21 // @TODO eliminate the dynamic cast when not in debug build
22 const InDetDD::PixelModuleDesign &pixel_design=dynamic_cast<const InDetDD::PixelModuleDesign &>(design);
23 // number of circuits reported for FEI3 is only the number of circuits per half-module
24 return pixel_design.numberOfCircuits() * (pixel_design.getReadoutTechnology() == InDetDD::PixelReadoutTechnology::FEI3 ? 2 : 1);
25 }
PixelReadoutTechnology getReadoutTechnology() const
int numberOfCircuits() const
Total number of circuits:

◆ numberOfChips() [2/2]

unsigned int InDet::SiDetectorElementStatus::numberOfChips ( const IdentifierHash & hash) const
inlineinherited

Definition at line 88 of file SiDetectorElementStatus.h.

88 {
89 return numberOfChips(getDetectorElement(hash)->design());
90 }
const InDetDD::SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const

Member Data Documentation

◆ m_badCells

std::vector<std::vector<unsigned short> >* InDet::SiDetectorElementStatus::m_badCells = nullptr
privateinherited

Definition at line 139 of file SiDetectorElementStatus.h.

◆ m_detectorElements

const InDetDD::SiDetectorElementCollection* InDet::SiDetectorElementStatus::m_detectorElements = nullptr
privateinherited

Definition at line 136 of file SiDetectorElementStatus.h.

◆ m_elementChipStatus

std::vector<ChipFlags_t> InDet::SiDetectorElementStatus::m_elementChipStatus
privateinherited

Definition at line 138 of file SiDetectorElementStatus.h.

◆ m_elementStatus

std::vector<bool> InDet::SiDetectorElementStatus::m_elementStatus
privateinherited

Definition at line 137 of file SiDetectorElementStatus.h.

◆ m_owner

bool InDet::SiDetectorElementStatus::m_owner = false
privateinherited

Definition at line 140 of file SiDetectorElementStatus.h.


The documentation for this class was generated from the following file: