ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_FlaggedConditionTool Class Reference

#include <SCT_FlaggedConditionTool.h>

Inheritance diagram for SCT_FlaggedConditionTool:
Collaboration diagram for SCT_FlaggedConditionTool:

Public Member Functions

 SCT_FlaggedConditionTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~SCT_FlaggedConditionTool ()=default
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual bool canReportAbout (InDetConditions::Hierarchy h) const override
 Can the tool report about the given component?
virtual bool isGood (const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
 Is the detector element good?
virtual bool isGood (const IdentifierHash &hashId, const EventContext &ctx) const override
virtual void getDetectorElementStatus (const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
virtual const std::string & details (const Identifier &id, const EventContext &ctx) const override
 Get the reason why the wafer is bad (by Identifier).
virtual const std::string & details (const IdentifierHash &id, const EventContext &ctx) const override
 Get the reason why the wafer is bad (by IdentifierHash).
virtual int numBadIds (const EventContext &ctx) const override
 Get number flagged as bad (per event).
virtual const IDCInDetBSErrContainergetBadIds (const EventContext &ctx) const override
 Get IdentifierHashs ofwafers flagged as bad + reason (per event).

Private Member Functions

const IDCInDetBSErrContainergetCondData (const EventContext &ctx) const

Private Attributes

SG::ReadHandleKey< IDCInDetBSErrContainerm_badIds {this, "SCT_FlaggedCondData", "SCT_FlaggedCondData", "SCT flagged conditions data"}
UnsignedIntegerProperty m_maxNumWarnForFailures {this, "MaxNumWarnForFailures", 5}
std::atomic_uint m_numWarnForFailures {0}
const SCT_IDm_sctID {nullptr}
 ID helper for SCT.

Detailed Description

Definition at line 33 of file SCT_FlaggedConditionTool.h.

Constructor & Destructor Documentation

◆ SCT_FlaggedConditionTool()

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

Definition at line 14 of file SCT_FlaggedConditionTool.cxx.

14 :
15 base_class(type, name, parent)
16{
17}

◆ ~SCT_FlaggedConditionTool()

virtual SCT_FlaggedConditionTool::~SCT_FlaggedConditionTool ( )
virtualdefault

Member Function Documentation

◆ canReportAbout()

bool SCT_FlaggedConditionTool::canReportAbout ( InDetConditions::Hierarchy h) const
overridevirtual

Can the tool report about the given component?

(chip, module...)

Definition at line 40 of file SCT_FlaggedConditionTool.cxx.

◆ details() [1/2]

const std::string & SCT_FlaggedConditionTool::details ( const Identifier & id,
const EventContext & ctx ) const
overridevirtual

Get the reason why the wafer is bad (by Identifier).

Definition at line 127 of file SCT_FlaggedConditionTool.cxx.

127 {
128 const IdentifierHash hashId{m_sctID->wafer_hash(Id)};
129 return details(hashId, ctx);
130}
virtual const std::string & details(const Identifier &id, const EventContext &ctx) const override
Get the reason why the wafer is bad (by Identifier).
const SCT_ID * m_sctID
ID helper for SCT.

◆ details() [2/2]

const std::string & SCT_FlaggedConditionTool::details ( const IdentifierHash & id,
const EventContext & ctx ) const
overridevirtual

Get the reason why the wafer is bad (by IdentifierHash).

Definition at line 99 of file SCT_FlaggedConditionTool.cxx.

99 {
100 static const std::string nullString;
101
102 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
103 if (badIds==nullptr) {
105 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (details)");
108 ATH_MSG_WARNING("Disabling this type of messages from " << name());
109 }
110 }
111 return nullString;
112 }
113
114 if (badIds->present(hashId)) {
115 const IDCInDetBSErrContainer::ErrorCode value{badIds->retrieve(hashId)};
116 if (value>0) {
117 for (size_t error{0}; error<SCT_FlaggedCondEnum::NUM_ERROR_TYPES; error++) {
118 if (value & (1 << error)) return SCT_FlaggedCondEnum::ErrorTypeDescription[error];
119 }
120 }
121 }
122 return nullString;
123}
#define ATH_MSG_WARNING(x)
bool present(size_t i) const
Is the value for this has set and also accepted in the mask.
T retrieve(size_t i) const
Retrieve the value of the hash, if accessible according to the mask.
SG::ReadHandleKey< IDCInDetBSErrContainer > m_badIds
UnsignedIntegerProperty m_maxNumWarnForFailures
const IDCInDetBSErrContainer * getCondData(const EventContext &ctx) const
static const std::vector< std::string > ErrorTypeDescription

◆ finalize()

StatusCode SCT_FlaggedConditionTool::finalize ( )
overridevirtual

Definition at line 35 of file SCT_FlaggedConditionTool.cxx.

35 {
36 return StatusCode::SUCCESS;
37}

◆ getBadIds()

const IDCInDetBSErrContainer * SCT_FlaggedConditionTool::getBadIds ( const EventContext & ctx) const
overridevirtual

Get IdentifierHashs ofwafers flagged as bad + reason (per event).

Definition at line 148 of file SCT_FlaggedConditionTool.cxx.

148 {
149 return getCondData(ctx);
150}

◆ getCondData()

const IDCInDetBSErrContainer * SCT_FlaggedConditionTool::getCondData ( const EventContext & ctx) const
private

Definition at line 152 of file SCT_FlaggedConditionTool.cxx.

152 {
153 SG::ReadHandle<IDCInDetBSErrContainer> condData{m_badIds, ctx};
154 if (not condData.isValid()) {
156 ATH_MSG_WARNING("Failed to get " << m_badIds.key());
159 ATH_MSG_WARNING("Disabling this type of messages from " << name());
160 }
161 }
162 return nullptr;
163 }
164 return condData.cptr();
165}
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.

◆ getDetectorElementStatus()

void SCT_FlaggedConditionTool::getDetectorElementStatus ( const EventContext & ctx,
InDet::SiDetectorElementStatus & element_status,
SG::WriteCondHandle< InDet::SiDetectorElementStatus > * whandle ) const
overridevirtual

Definition at line 68 of file SCT_FlaggedConditionTool.cxx.

69 {
70 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
71 if (whandle) {
72 ATH_MSG_ERROR("SCT_FlaggedConditionTool is not for conditions objects");
74 }
75 std::vector<bool> &status = element_status.getElementStatus();
76 if (badIds==nullptr) {
78 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (isGood)");
81 ATH_MSG_WARNING("Disabling this type of messages from " << name());
82 }
83 }
84 status.clear();
85 status.resize(m_sctID->wafer_hash_max(),false);
86 return;
87 }
88 if (status.empty()) {
89 status.resize(m_sctID->wafer_hash_max(),true);
90 }
91
92 for (size_t hash : badIds->getMask()) {
93 status.at(hash)=false;
94 }
95}
#define ATH_MSG_ERROR(x)
const std::set< size_t > & getMask() const
const std::vector< bool > & getElementStatus() const
void addDependency(const EventIDRange &range)
status
Definition merge.py:16

◆ initialize()

StatusCode SCT_FlaggedConditionTool::initialize ( )
overridevirtual

Definition at line 20 of file SCT_FlaggedConditionTool.cxx.

20 {
21 ATH_MSG_INFO("SCT_FlaggedConditionTool::initialize()");
22
23 // Retrieve SCT helper
24 if (detStore()->retrieve(m_sctID, "SCT_ID").isFailure()) {
25 ATH_MSG_ERROR("SCT helper failed to retrieve");
26 return StatusCode::FAILURE;
27 }
28
29 ATH_CHECK(m_badIds.initialize());
30
31 return StatusCode::SUCCESS;
32}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)

◆ isGood() [1/2]

bool SCT_FlaggedConditionTool::isGood ( const Identifier & elementId,
const EventContext & ctx,
InDetConditions::Hierarchy h = InDetConditions::DEFAULT ) const
overridevirtual

Is the detector element good?

Definition at line 45 of file SCT_FlaggedConditionTool.cxx.

45 {
46 if (not canReportAbout(h)) return true;
47 const IdentifierHash hashId{m_sctID->wafer_hash(elementId)};
48 return isGood(hashId, ctx);
49}
virtual bool isGood(const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the tool report about the given component?

◆ isGood() [2/2]

bool SCT_FlaggedConditionTool::isGood ( const IdentifierHash & hashId,
const EventContext & ctx ) const
overridevirtual

Definition at line 52 of file SCT_FlaggedConditionTool.cxx.

52 {
53 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
54 if (badIds==nullptr) {
56 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (isGood)");
59 ATH_MSG_WARNING("Disabling this type of messages from " << name());
60 }
61 }
62 return false;
63 }
64
65 return (not badIds->present(hashId));
66}

◆ numBadIds()

int SCT_FlaggedConditionTool::numBadIds ( const EventContext & ctx) const
overridevirtual

Get number flagged as bad (per event).

Definition at line 132 of file SCT_FlaggedConditionTool.cxx.

132 {
133 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
134 if (badIds==nullptr) {
136 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (numBadIds)");
139 ATH_MSG_WARNING("Disabling this type of messages from " << name());
140 }
141 }
142 return -1;
143 }
144
145 return static_cast<int>(badIds->numberSet());
146}
size_t numberSet() const
Return the number of entries set and accessible according to the mask.

Member Data Documentation

◆ m_badIds

SG::ReadHandleKey<IDCInDetBSErrContainer> SCT_FlaggedConditionTool::m_badIds {this, "SCT_FlaggedCondData", "SCT_FlaggedCondData", "SCT flagged conditions data"}
private

Definition at line 67 of file SCT_FlaggedConditionTool.h.

67{this, "SCT_FlaggedCondData", "SCT_FlaggedCondData", "SCT flagged conditions data"};

◆ m_maxNumWarnForFailures

UnsignedIntegerProperty SCT_FlaggedConditionTool::m_maxNumWarnForFailures {this, "MaxNumWarnForFailures", 5}
private

Definition at line 69 of file SCT_FlaggedConditionTool.h.

69{this, "MaxNumWarnForFailures", 5};

◆ m_numWarnForFailures

std::atomic_uint SCT_FlaggedConditionTool::m_numWarnForFailures {0}
mutableprivate

Definition at line 70 of file SCT_FlaggedConditionTool.h.

70{0};

◆ m_sctID

const SCT_ID* SCT_FlaggedConditionTool::m_sctID {nullptr}
private

ID helper for SCT.

Definition at line 72 of file SCT_FlaggedConditionTool.h.

72{nullptr};

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