ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
PixelConditionsTools
src
PixelByteStreamErrorDetectorElementStatusTool.cxx
Go to the documentation of this file.
1
#include "
PixelByteStreamErrorDetectorElementStatusTool.h
"
2
#include "
PixelReadoutGeometry/PixelModuleDesign.h
"
3
#include "
PixelReadoutGeometry/PixelFEUtils.h
"
4
#include "
PixelConditionsData/PixelByteStreamErrors.h
"
5
6
StatusCode
PixelByteStreamErrorDetectorElementStatusTool::initialize
()
7
{
8
ATH_CHECK
(
PixelDetectorElementStatusToolBase::initialize
() );
9
10
bool
useByteStream = (
m_useByteStreamFEI4
||
m_useByteStreamFEI3
||
m_useByteStreamRD53
);
11
ATH_CHECK
(
m_BSErrContReadKey
.initialize(useByteStream && !
m_BSErrContReadKey
.empty()));
12
13
static_assert
(
static_cast<
unsigned
int
>
(
InDetDD::PixelReadoutTechnology::FEI4
) < 32u) ;
14
static_assert
(
static_cast<
unsigned
int
>
(
InDetDD::PixelReadoutTechnology::FEI3
) < 32u) ;
15
static_assert
(
static_cast<
unsigned
int
>
(
InDetDD::PixelReadoutTechnology::RD53
) < 32u) ;
16
m_readoutTechnologyMask
=
Pixel::makeReadoutTechnologyBit
(
InDetDD::PixelReadoutTechnology::FEI4
, 1 &&
m_useByteStreamFEI4
)
17
|
Pixel::makeReadoutTechnologyBit
(
InDetDD::PixelReadoutTechnology::FEI3
, 1 &&
m_useByteStreamFEI3
)
18
|
Pixel::makeReadoutTechnologyBit
(
InDetDD::PixelReadoutTechnology::RD53
, 1 &&
m_useByteStreamRD53
);
19
20
return
StatusCode::SUCCESS;
21
}
22
23
namespace
{
24
inline
constexpr
bool
isBSError(uint64_t
error
, uint64_t max_error, uint64_t mask) {
25
return
error
<max_error && (
error
& mask);
26
}
27
28
}
29
30
std::unique_ptr<InDet::SiDetectorElementStatus>
31
PixelByteStreamErrorDetectorElementStatusTool::getDetectorElementStatus
(
const
EventContext& ctx,
32
SG::WriteCondHandle<InDet::SiDetectorElementStatus>
* whandle)
const
{
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"
);
45
whandle->
addDependency
(
IDetectorElementStatusTool::getInvalidRange
());
46
}
47
48
if
(
m_readoutTechnologyMask
) {
49
SG::ReadHandle<IDCInDetBSErrContainer>
idcErrCont(
m_BSErrContReadKey
, ctx);
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
57
constexpr
uint64_t error_mask =
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::TruncatedROB
)
58
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MaskedROB
)
59
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::Preamble
)
60
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::TimeOut
)
61
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::LVL1ID
)
62
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::BCID
)
63
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::Trailer
)
64
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCLVL1IDEoECheck
)
65
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCBCIDEoECheck
)
66
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCLVL1IDCheck
)
67
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCEoEOverflow
)
68
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCHitOverflow
);
69
70
constexpr
uint64_t chip_error_mask =
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::Preamble
)
71
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::TimeOut
)
72
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::LVL1ID
)
73
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::BCID
)
74
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::Trailer
)
75
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCLVL1IDEoECheck
)
76
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCBCIDEoECheck
)
77
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCLVL1IDCheck
)
78
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCEoEOverflow
)
79
|
PixelByteStreamErrors::makeError
(
PixelByteStreamErrors::MCCHitOverflow
);
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
IDCInDetBSErrContainer_Cache
IdentifiableValueCache< IDCInDetBSErrContainer::ErrorCode > IDCInDetBSErrContainer_Cache
Definition
IDCInDetBSErrContainer.h:27
PixelByteStreamErrorDetectorElementStatusTool.h
PixelByteStreamErrors.h
PixelFEUtils.h
PixelModuleDesign.h
IDetectorElementStatusTool::getInvalidRange
static EventIDRange getInvalidRange()
Definition
IDetectorElementStatusTool.h:33
IdentifiableValueCache::retrieve
T retrieve(size_t i)
Retrieve the Value stored in that hash.
Definition
IdentifiableValueCache.h:49
InDetDD::PixelModuleDesign
Class used to describe the design of a module (diode segmentation and readout scheme).
Definition
PixelModuleDesign.h:45
InDetDD::PixelModuleDesign::getReadoutTechnology
PixelReadoutTechnology getReadoutTechnology() const
Definition
PixelModuleDesign.h:391
InDetDD::PixelModuleDesign::numberOfCircuits
int numberOfCircuits() const
Total number of circuits:
Definition
PixelModuleDesign.h:306
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamFEI4
Gaudi::Property< bool > m_useByteStreamFEI4
Definition
PixelByteStreamErrorDetectorElementStatusTool.h:32
PixelByteStreamErrorDetectorElementStatusTool::m_activeOnly
Gaudi::Property< bool > m_activeOnly
Definition
PixelByteStreamErrorDetectorElementStatusTool.h:41
PixelByteStreamErrorDetectorElementStatusTool::m_readoutTechnologyMask
unsigned int m_readoutTechnologyMask
Mask where each bit represents a readout technology;.
Definition
PixelByteStreamErrorDetectorElementStatusTool.h:43
PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamRD53
Gaudi::Property< bool > m_useByteStreamRD53
Definition
PixelByteStreamErrorDetectorElementStatusTool.h:38
PixelByteStreamErrorDetectorElementStatusTool::getDetectorElementStatus
virtual std::unique_ptr< InDet::SiDetectorElementStatus > getDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
Definition
PixelByteStreamErrorDetectorElementStatusTool.cxx:31
PixelByteStreamErrorDetectorElementStatusTool::m_BSErrContReadKey
SG::ReadHandleKey< IDCInDetBSErrContainer > m_BSErrContReadKey
Definition
PixelByteStreamErrorDetectorElementStatusTool.h:29
PixelByteStreamErrorDetectorElementStatusTool::initialize
virtual StatusCode initialize() override
Definition
PixelByteStreamErrorDetectorElementStatusTool.cxx:6
PixelByteStreamErrorDetectorElementStatusTool::m_useByteStreamFEI3
Gaudi::Property< bool > m_useByteStreamFEI3
Definition
PixelByteStreamErrorDetectorElementStatusTool.h:35
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::initialize
virtual StatusCode initialize() override
Definition
PixelDetectorElementStatusToolBase.cxx:15
PixelDetectorElementStatusToolBase::m_pixelID
const PixelID * m_pixelID
Definition
PixelDetectorElementStatusToolBase.h:38
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
InDetDD::PixelReadoutTechnology
PixelReadoutTechnology
Definition
PixelReadoutDefinitions.h:37
InDetDD::PixelReadoutTechnology::RD53
@ RD53
Definition
PixelReadoutDefinitions.h:41
InDetDD::PixelReadoutTechnology::FEI4
@ FEI4
Definition
PixelReadoutDefinitions.h:40
InDetDD::PixelReadoutTechnology::FEI3
@ FEI3
Definition
PixelReadoutDefinitions.h:39
PixelByteStreamErrors::makeError
constexpr IDCInDetBSErrContainer::ErrorCode makeError(PixelErrorsEnum errType)
helper to be used in clients to fetch error information
Definition
PixelByteStreamErrors.h:21
PixelByteStreamErrors::MaskedROB
@ MaskedROB
Definition
PixelByteStreamErrors.h:14
PixelByteStreamErrors::TimeOut
@ TimeOut
Definition
PixelByteStreamErrors.h:13
PixelByteStreamErrors::Preamble
@ Preamble
Definition
PixelByteStreamErrors.h:13
PixelByteStreamErrors::MCCLVL1IDEoECheck
@ MCCLVL1IDEoECheck
Definition
PixelByteStreamErrors.h:15
PixelByteStreamErrors::MCCLVL1IDCheck
@ MCCLVL1IDCheck
Definition
PixelByteStreamErrors.h:15
PixelByteStreamErrors::MCCEoEOverflow
@ MCCEoEOverflow
Definition
PixelByteStreamErrors.h:15
PixelByteStreamErrors::LVL1ID
@ LVL1ID
Definition
PixelByteStreamErrors.h:13
PixelByteStreamErrors::BCID
@ BCID
Definition
PixelByteStreamErrors.h:13
PixelByteStreamErrors::MCCHitOverflow
@ MCCHitOverflow
Definition
PixelByteStreamErrors.h:15
PixelByteStreamErrors::MCCBCIDEoECheck
@ MCCBCIDEoECheck
Definition
PixelByteStreamErrors.h:15
PixelByteStreamErrors::TruncatedROB
@ TruncatedROB
Definition
PixelByteStreamErrors.h:14
PixelByteStreamErrors::Trailer
@ Trailer
Definition
PixelByteStreamErrors.h:13
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:65
error
Definition
IImpactPoint3dEstimator.h:72
Generated on
for ATLAS Offline Software by
1.17.0