ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
PixelByteStreamErrorDetectorElementStatusTool Class Reference

Tool to extend pixel detector element status data by the status extracted from the bytestream error container. More...

#include <PixelByteStreamErrorDetectorElementStatusTool.h>

Inheritance diagram for PixelByteStreamErrorDetectorElementStatusTool:
Collaboration diagram for PixelByteStreamErrorDetectorElementStatusTool:

Public Member Functions

 PixelByteStreamErrorDetectorElementStatusTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual std::unique_ptr< InDet::SiDetectorElementStatusgetDetectorElementStatus (const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
 

Static Public Member Functions

static InterfaceID & interfaceID ()
 

Protected Member Functions

std::unique_ptr< InDet::SiDetectorElementStatuscreateDetectorElementStatus (const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
 Create a new detector element status element container. More...
 

Protected Attributes

const PixelIDm_pixelID {}
 

Private Attributes

SG::ReadHandleKey< IDCInDetBSErrContainerm_BSErrContReadKey {this, "PixelByteStreamErrs", "PixelByteStreamErrs", "PixelByteStreamErrs container key"}
 
Gaudi::Property< bool > m_useByteStreamFEI4 {this, "UseByteStreamFEI4", false, "Switch of the ByteStream error for FEI4"}
 
Gaudi::Property< bool > m_useByteStreamFEI3 {this, "UseByteStreamFEI3", false, "Switch of the ByteStream error for FEI3"}
 
Gaudi::Property< bool > m_useByteStreamRD53 {this, "UseByteStreamRD53", false, "Switch of the ByteStream error for RD53"}
 
Gaudi::Property< bool > m_activeOnly {this, "ActiveOnly", false, "Module and chip status will only reflect whether the modules or chips are active not necessarily whether the signals are good."}
 
unsigned int m_readoutTechnologyMask {}
 Mask where each bit represents a readout technology;. More...
 
ServiceHandle< InDetDD::IPixelReadoutManagerm_pixelReadout {this, "PixelReadoutManager", "PixelReadoutManager", "Pixel readout manager" }
 
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_pixelDetEleCollKey {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}
 
SG::ReadCondHandleKey< InDet::SiDetectorElementStatusm_pixelDetElStatusCondKey {this, "PixelDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."}
 

Detailed Description

Tool to extend pixel detector element status data by the status extracted from the bytestream error container.

The input to the tool can only be conditions data, the output will have an invalid IOV. Thus, can only be event data.

Definition at line 14 of file PixelByteStreamErrorDetectorElementStatusTool.h.

Constructor & Destructor Documentation

◆ PixelByteStreamErrorDetectorElementStatusTool()

PixelByteStreamErrorDetectorElementStatusTool::PixelByteStreamErrorDetectorElementStatusTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)
inline

Member Function Documentation

◆ createDetectorElementStatus()

std::unique_ptr< InDet::SiDetectorElementStatus > PixelDetectorElementStatusToolBase::createDetectorElementStatus ( const EventContext &  ctx,
SG::WriteCondHandle< InDet::SiDetectorElementStatus > *  whandle 
) const
protectedinherited

Create a new detector element status element container.

Depending on the properties the container may be a copy of an event data or conditions data element status container.

Definition at line 34 of file PixelDetectorElementStatusToolBase.cxx.

35  {
38  if (whandle) {
39  whandle->addDependency (input_element_status);
40  }
41 
42  return std::make_unique<InDet::PixelDetectorElementStatus>(*castToDerived(input_element_status.cptr()));
43  }
44  else {
46  if (not pixelDetEleHandle.isValid() ) {
47  std::stringstream msg;
48  msg << m_pixelDetEleCollKey.fullKey() << " is not available.";
49  throw std::runtime_error(msg.str());
50  }
51  if (whandle) {
52  whandle->addDependency (pixelDetEleHandle);
53  }
54  const InDetDD::SiDetectorElementCollection* elements(*pixelDetEleHandle);
55  return std::make_unique<InDet::PixelDetectorElementStatus>(*elements);
56  }
57 }

◆ getDetectorElementStatus()

std::unique_ptr< InDet::SiDetectorElementStatus > PixelByteStreamErrorDetectorElementStatusTool::getDetectorElementStatus ( const EventContext &  ctx,
SG::WriteCondHandle< InDet::SiDetectorElementStatus > *  whandle 
) const
overridevirtual

Definition at line 31 of file PixelByteStreamErrorDetectorElementStatusTool.cxx.

32  {
33  std::unique_ptr<InDet::SiDetectorElementStatus> element_status( createDetectorElementStatus(ctx, whandle));
34  std::vector<bool> &status=element_status->getElementStatus();
35  if (status.empty()) {
36  status.resize(m_pixelID->wafer_hash_max(),true );
37  }
38  std::vector<InDet::ChipFlags_t> &chip_status=element_status->getElementChipStatus();
39  if (chip_status.empty()) {
40  chip_status.resize(status.size(),0xffff);
41  }
42 
43  if (whandle) {
44  ATH_MSG_ERROR("PixelByteStreamErrorDetectorStatusTool is not for use with conditions objects");
46  }
47 
50  if (!idcErrCont.isValid()) {
51  ATH_MSG_ERROR("Did not get bytestream error container with key " << m_BSErrContReadKey);
52  }
53  else {
54 
55  const IDCInDetBSErrContainer_Cache *idcCachePtr = idcErrCont->cache();
56 
69 
80 
81  // The index array is defined in PixelRawDataProviderTool::SizeOfIDCInDetBSErrContainer()
82  // Here, 52736 is a separator beween error flags and isActive flags.
83  const bool active_only = m_activeOnly;
84  unsigned int element_offset_i = (active_only ? 52736 : 0);
85 
86  unsigned int element_i=0;
87  unsigned int maxHash = m_pixelID->wafer_hash_max();
88 
89  constexpr uint64_t missingErrorInfo{std::numeric_limits<uint64_t>::max()-3000000000};
90 
91  for (const InDetDD::SiDetectorElement *element : element_status->getDetectorElements()) {
92  const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design());
93  InDetDD::PixelReadoutTechnology readout_technology = p_design->getReadoutTechnology();
94  unsigned int readout_technology_flags = m_readoutTechnologyMask & Pixel::makeReadoutTechnologyBit(readout_technology);
95 
96  // set to false if has one of the considered errors and the readout technology is considered.
97  status.at(element_i) = status.at(element_i) && not ( readout_technology_flags
98  && ( !active_only
99  ? isBSError(static_cast<uint64_t>(idcCachePtr->retrieve(element_i)), missingErrorInfo, error_mask)
100  : idcCachePtr->retrieve(element_i+element_offset_i)!=1 ));
101 
102  // compute the status for the individual front-ends
103  if (status[element_i]) {
104  unsigned int number_of_chips = readout_technology == InDetDD::PixelReadoutTechnology::FEI3 ? 2*p_design->numberOfCircuits() : p_design->numberOfCircuits();
105  InDet::ChipFlags_t chip_mask = status[element_i] ? (1ul<<number_of_chips)-1ul : 0;
106  assert( chip_mask != 0 );
107  InDet::ChipFlags_t bs_status_flags = active_only ? chip_mask : 0;
108  if (!active_only) {
109  for (unsigned int chip_i =0; chip_i < number_of_chips; ++chip_i) {
110  // get bytestream error for chip
111  unsigned int indexFE = (1+chip_i)*maxHash + element_i; // (FE_channel+1)*2048 + moduleHash
112  InDet::ChipFlags_t chip_flag =not ( readout_technology_flags
113  && (isBSError(static_cast<uint64_t>(idcCachePtr->retrieve(indexFE)), missingErrorInfo, chip_error_mask)));
114  bs_status_flags |= (chip_flag << chip_i);
115  }
116  }
117  chip_status[element_i] &= (bs_status_flags & chip_mask);
118  }
119  else {
120  chip_status[element_i] = 0;
121  }
122  ++element_i;
123  }
124  }
125  }
126 
127  return element_status;
128 }

◆ initialize()

StatusCode PixelByteStreamErrorDetectorElementStatusTool::initialize ( )
overridevirtual

◆ interfaceID()

InterfaceID & PixelByteStreamErrorDetectorElementStatusTool::interfaceID ( )
inlinestatic

Definition at line 46 of file PixelByteStreamErrorDetectorElementStatusTool.h.

46  {
47  static InterfaceID IID_PixelByteStreamErrorDetectorElementStatusTool("PixelByteStreamErrorDetectorElementStatusTool", 1, 0);
48  return IID_PixelByteStreamErrorDetectorElementStatusTool;
49 }

Member Data Documentation

◆ m_activeOnly

Gaudi::Property< bool> PixelByteStreamErrorDetectorElementStatusTool::m_activeOnly {this, "ActiveOnly", false, "Module and chip status will only reflect whether the modules or chips are active not necessarily whether the signals are good."}
private

◆ m_BSErrContReadKey

SG::ReadHandleKey<IDCInDetBSErrContainer> PixelByteStreamErrorDetectorElementStatusTool::m_BSErrContReadKey {this, "PixelByteStreamErrs", "PixelByteStreamErrs", "PixelByteStreamErrs container key"}
private

◆ m_pixelDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> PixelDetectorElementStatusToolBase::m_pixelDetEleCollKey {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}
privateinherited

Definition at line 45 of file PixelDetectorElementStatusToolBase.h.

◆ m_pixelDetElStatusCondKey

SG::ReadCondHandleKey<InDet::SiDetectorElementStatus> PixelDetectorElementStatusToolBase::m_pixelDetElStatusCondKey {this, "PixelDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."}
privateinherited

Definition at line 48 of file PixelDetectorElementStatusToolBase.h.

◆ m_pixelID

const PixelID* PixelDetectorElementStatusToolBase::m_pixelID {}
protectedinherited

Definition at line 39 of file PixelDetectorElementStatusToolBase.h.

◆ m_pixelReadout

ServiceHandle<InDetDD::IPixelReadoutManager> PixelDetectorElementStatusToolBase::m_pixelReadout {this, "PixelReadoutManager", "PixelReadoutManager", "Pixel readout manager" }
privateinherited

Definition at line 42 of file PixelDetectorElementStatusToolBase.h.

◆ m_readoutTechnologyMask

unsigned int PixelByteStreamErrorDetectorElementStatusTool::m_readoutTechnologyMask {}
private

Mask where each bit represents a readout technology;.

Definition at line 43 of file PixelByteStreamErrorDetectorElementStatusTool.h.

◆ m_useByteStreamFEI3

Gaudi::Property<bool> PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamFEI3 {this, "UseByteStreamFEI3", false, "Switch of the ByteStream error for FEI3"}
private

◆ m_useByteStreamFEI4

Gaudi::Property<bool> PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamFEI4 {this, "UseByteStreamFEI4", false, "Switch of the ByteStream error for FEI4"}
private

◆ m_useByteStreamRD53

Gaudi::Property<bool> PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamRD53 {this, "UseByteStreamRD53", false, "Switch of the ByteStream error for RD53"}
private

The documentation for this class was generated from the following files:
InDetDD::PixelReadoutTechnology
PixelReadoutTechnology
Definition: PixelReadoutDefinitions.h:34
PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamFEI4
Gaudi::Property< bool > m_useByteStreamFEI4
Definition: PixelByteStreamErrorDetectorElementStatusTool.h:32
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
PixelByteStreamErrorDetectorElementStatusTool::m_readoutTechnologyMask
unsigned int m_readoutTechnologyMask
Mask where each bit represents a readout technology;.
Definition: PixelByteStreamErrorDetectorElementStatusTool.h:43
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
PixelDetectorElementStatusToolBase::m_pixelID
const PixelID * m_pixelID
Definition: PixelDetectorElementStatusToolBase.h:39
PixelByteStreamErrorDetectorElementStatusTool::m_BSErrContReadKey
SG::ReadHandleKey< IDCInDetBSErrContainer > m_BSErrContReadKey
Definition: PixelByteStreamErrorDetectorElementStatusTool.h:29
Pixel::makeReadoutTechnologyBit
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.
Definition: PixelFEUtils.h:60
PixelByteStreamErrorDetectorElementStatusTool::m_activeOnly
Gaudi::Property< bool > m_activeOnly
Definition: PixelByteStreamErrorDetectorElementStatusTool.h:41
PixelByteStreamErrors::MCCBCIDEoECheck
@ MCCBCIDEoECheck
Definition: PixelByteStreamErrors.h:15
InDetDD::PixelReadoutTechnology::FEI3
@ FEI3
PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamRD53
Gaudi::Property< bool > m_useByteStreamRD53
Definition: PixelByteStreamErrorDetectorElementStatusTool.h:38
PixelByteStreamErrors::makeError
constexpr IDCInDetBSErrContainer::ErrorCode makeError(PixelErrorsEnum errType)
helper to be used in clients to fetch error information
Definition: PixelByteStreamErrors.h:21
PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamFEI3
Gaudi::Property< bool > m_useByteStreamFEI3
Definition: PixelByteStreamErrorDetectorElementStatusTool.h:35
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
PixelDetectorElementStatusToolBase::PixelDetectorElementStatusToolBase
PixelDetectorElementStatusToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PixelDetectorElementStatusToolBase.cxx:8
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
PixelByteStreamErrors::TimeOut
@ TimeOut
Definition: PixelByteStreamErrors.h:13
IdentifiableValueCache::retrieve
T retrieve(size_t i)
Retrieve the Value stored in that hash.
Definition: IdentifiableValueCache.h:49
InDetDD::PixelReadoutTechnology::RD53
@ RD53
PixelByteStreamErrors::BCID
@ BCID
Definition: PixelByteStreamErrors.h:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
PixelByteStreamErrors::Preamble
@ Preamble
Definition: PixelByteStreamErrors.h:13
IDetectorElementStatusTool::getInvalidRange
static EventIDRange getInvalidRange()
Definition: IDetectorElementStatusTool.h:33
InDetDD::PixelModuleDesign::numberOfCircuits
int numberOfCircuits() const
Total number of circuits:
Definition: PixelModuleDesign.h:315
PixelByteStreamErrors::MCCLVL1IDEoECheck
@ MCCLVL1IDEoECheck
Definition: PixelByteStreamErrors.h:15
PixelDetectorElementStatusToolBase::createDetectorElementStatus
std::unique_ptr< InDet::SiDetectorElementStatus > createDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
Create a new detector element status element container.
Definition: PixelDetectorElementStatusToolBase.cxx:34
PixelDetectorElementStatusToolBase::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: PixelDetectorElementStatusToolBase.h:46
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
detail::ul
unsigned long ul
Definition: PrimitiveHelpers.h:46
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
PixelByteStreamErrors::MaskedROB
@ MaskedROB
Definition: PixelByteStreamErrors.h:14
PixelByteStreamErrors::MCCHitOverflow
@ MCCHitOverflow
Definition: PixelByteStreamErrors.h:15
PixelByteStreamErrors::MCCLVL1IDCheck
@ MCCLVL1IDCheck
Definition: PixelByteStreamErrors.h:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PixelByteStreamErrors::MCCEoEOverflow
@ MCCEoEOverflow
Definition: PixelByteStreamErrors.h:15
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
PixelID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: PixelID.cxx:831
InDetDD::PixelReadoutTechnology::FEI4
@ FEI4
InDetDD::PixelModuleDesign::getReadoutTechnology
PixelReadoutTechnology getReadoutTechnology() const
Definition: PixelModuleDesign.h:386
PixelDetectorElementStatusToolBase::m_pixelDetElStatusCondKey
SG::ReadCondHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusCondKey
Definition: PixelDetectorElementStatusToolBase.h:49
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDet::ChipFlags_t
unsigned short ChipFlags_t
Definition: SiDetectorElementStatus.h:60
merge.status
status
Definition: merge.py:17
IdentifiableValueCache
This class is to provide an event wide MT container for concurrent storing of basic types,...
Definition: IdentifiableValueCache.h:19
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
PixelByteStreamErrors::TruncatedROB
@ TruncatedROB
Definition: PixelByteStreamErrors.h:14
PixelByteStreamErrors::Trailer
@ Trailer
Definition: PixelByteStreamErrors.h:13
PixelDetectorElementStatusToolBase::initialize
virtual StatusCode initialize() override
Definition: PixelDetectorElementStatusToolBase.cxx:15
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275
PixelByteStreamErrors::LVL1ID
@ LVL1ID
Definition: PixelByteStreamErrors.h:13