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, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
 Is the detector element good?
virtual bool isGood (const Identifier &elementId, const EventContext &ctx, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
virtual bool isGood (const IdentifierHash &hashId) const override
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 override
 Get the reason why the wafer is bad (by Identifier)
virtual const std::string & details (const Identifier &id, const EventContext &ctx) const override
virtual const std::string & details (const IdentifierHash &id) const override
 Get the reason why the wafer is bad (by IdentifierHash)
virtual const std::string & details (const IdentifierHash &id, const EventContext &ctx) const override
virtual int numBadIds () const override
 Get number flagged as bad (per event)
virtual int numBadIds (const EventContext &ctx) const override
virtual const IDCInDetBSErrContainergetBadIds () const override
 Get IdentifierHashs ofwafers flagged as bad + reason (per event)
virtual const IDCInDetBSErrContainergetBadIds (const EventContext &ctx) const override

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/4]

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

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

Definition at line 150 of file SCT_FlaggedConditionTool.cxx.

150 {
151 const EventContext& ctx{Gaudi::Hive::currentContext()};
152 return details(Id, ctx);
153}
virtual const std::string & details(const Identifier &id) const override
Get the reason why the wafer is bad (by Identifier)

◆ details() [2/4]

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

Definition at line 145 of file SCT_FlaggedConditionTool.cxx.

145 {
146 const IdentifierHash hashId{m_sctID->wafer_hash(Id)};
147 return details(hashId, ctx);
148}
const SCT_ID * m_sctID
ID helper for SCT.

◆ details() [3/4]

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

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

Definition at line 138 of file SCT_FlaggedConditionTool.cxx.

138 {
139 const EventContext& ctx{Gaudi::Hive::currentContext()};
140 return details(hashId, ctx);
141}

◆ details() [4/4]

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

Definition at line 112 of file SCT_FlaggedConditionTool.cxx.

112 {
113 static const std::string nullString;
114
115 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
116 if (badIds==nullptr) {
118 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (details)");
121 ATH_MSG_WARNING("Disabling this type of messages from " << name());
122 }
123 }
124 return nullString;
125 }
126
127 if (badIds->present(hashId)) {
128 const IDCInDetBSErrContainer::ErrorCode value{badIds->retrieve(hashId)};
129 if (value>0) {
130 for (size_t error{0}; error<SCT_FlaggedCondEnum::NUM_ERROR_TYPES; error++) {
131 if (value & (1 << error)) return SCT_FlaggedCondEnum::ErrorTypeDescription[error];
132 }
133 }
134 }
135 return nullString;
136}
#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() [1/2]

const IDCInDetBSErrContainer * SCT_FlaggedConditionTool::getBadIds ( ) const
overridevirtual

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

Definition at line 180 of file SCT_FlaggedConditionTool.cxx.

180 {
181 const EventContext& ctx{Gaudi::Hive::currentContext()};
182 return getBadIds(ctx);
183}
virtual const IDCInDetBSErrContainer * getBadIds() const override
Get IdentifierHashs ofwafers flagged as bad + reason (per event)

◆ getBadIds() [2/2]

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

Definition at line 176 of file SCT_FlaggedConditionTool.cxx.

176 {
177 return getCondData(ctx);
178}

◆ getCondData()

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

Definition at line 185 of file SCT_FlaggedConditionTool.cxx.

185 {
186 SG::ReadHandle<IDCInDetBSErrContainer> condData{m_badIds, ctx};
187 if (not condData.isValid()) {
189 ATH_MSG_WARNING("Failed to get " << m_badIds.key());
192 ATH_MSG_WARNING("Disabling this type of messages from " << name());
193 }
194 }
195 return nullptr;
196 }
197 return condData.cptr();
198}
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 74 of file SCT_FlaggedConditionTool.cxx.

75 {
76 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
77 if (whandle) {
78 ATH_MSG_ERROR("SCT_FlaggedConditionTool is not for conditions objects");
80 }
81 std::vector<bool> &status = element_status.getElementStatus();
82 if (badIds==nullptr) {
84 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (isGood)");
87 ATH_MSG_WARNING("Disabling this type of messages from " << name());
88 }
89 }
90 status.clear();
91 status.resize(m_sctID->wafer_hash_max(),false);
92 return;
93 }
94 if (status.empty()) {
95 status.resize(m_sctID->wafer_hash_max(),true);
96 }
97
98 for (size_t hash : badIds->getMask()) {
99 status.at(hash)=false;
100 }
101}
#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)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ isGood() [1/4]

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

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, 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/4]

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

Is the detector element good?

Definition at line 51 of file SCT_FlaggedConditionTool.cxx.

51 {
52 const EventContext& ctx{Gaudi::Hive::currentContext()};
53
54 return isGood(elementId, ctx, h);
55}

◆ isGood() [3/4]

bool SCT_FlaggedConditionTool::isGood ( const IdentifierHash & hashId) const
overridevirtual

Definition at line 104 of file SCT_FlaggedConditionTool.cxx.

104 {
105 const EventContext& ctx{Gaudi::Hive::currentContext()};
106
107 return isGood(hashId, ctx);
108}

◆ isGood() [4/4]

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

Definition at line 58 of file SCT_FlaggedConditionTool.cxx.

58 {
59 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
60 if (badIds==nullptr) {
62 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (isGood)");
65 ATH_MSG_WARNING("Disabling this type of messages from " << name());
66 }
67 }
68 return false;
69 }
70
71 return (not badIds->present(hashId));
72}

◆ numBadIds() [1/2]

int SCT_FlaggedConditionTool::numBadIds ( ) const
overridevirtual

Get number flagged as bad (per event)

Definition at line 171 of file SCT_FlaggedConditionTool.cxx.

171 {
172 const EventContext& ctx{Gaudi::Hive::currentContext()};
173 return numBadIds(ctx);
174}
virtual int numBadIds() const override
Get number flagged as bad (per event)

◆ numBadIds() [2/2]

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

Definition at line 155 of file SCT_FlaggedConditionTool.cxx.

155 {
156 const IDCInDetBSErrContainer* badIds{getCondData(ctx)};
157 if (badIds==nullptr) {
159 ATH_MSG_WARNING(m_badIds.key() << " cannot be retrieved. (numBadIds)");
162 ATH_MSG_WARNING("Disabling this type of messages from " << name());
163 }
164 }
165 return -1;
166 }
167
168 return static_cast<int>(badIds->numberSet());
169}
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 73 of file SCT_FlaggedConditionTool.h.

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

◆ m_maxNumWarnForFailures

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

Definition at line 75 of file SCT_FlaggedConditionTool.h.

75{this, "MaxNumWarnForFailures", 5};

◆ m_numWarnForFailures

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

Definition at line 76 of file SCT_FlaggedConditionTool.h.

76{0};

◆ m_sctID

const SCT_ID* SCT_FlaggedConditionTool::m_sctID {nullptr}
private

ID helper for SCT.

Definition at line 78 of file SCT_FlaggedConditionTool.h.

78{nullptr};

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