ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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? (chip, module...) More...
 
virtual bool isGood (const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
 Is the detector element good? More...
 
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) More...
 
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) More...
 
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) More...
 
virtual int numBadIds (const EventContext &ctx) const override
 
virtual const IDCInDetBSErrContainergetBadIds () const override
 Get IdentifierHashs ofwafers flagged as bad + reason (per event) More...
 
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. More...
 

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.

40  {
42 }

◆ 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 }

◆ 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 }

◆ 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) {
131  if (value & (1 << error)) return SCT_FlaggedCondEnum::ErrorTypeDescription[error];
132  }
133  }
134  }
135  return nullString;
136 }

◆ 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 }

◆ 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  {
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 }

◆ 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 }

◆ 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 
30 
31  return StatusCode::SUCCESS;
32 }

◆ 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 }

◆ 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 }

◆ 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 }

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.

◆ m_maxNumWarnForFailures

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

Definition at line 75 of file SCT_FlaggedConditionTool.h.

◆ m_numWarnForFailures

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

Definition at line 76 of file SCT_FlaggedConditionTool.h.

◆ m_sctID

const SCT_ID* SCT_FlaggedConditionTool::m_sctID {nullptr}
private

ID helper for SCT.

Definition at line 78 of file SCT_FlaggedConditionTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_FlaggedConditionTool::m_sctID
const SCT_ID * m_sctID
ID helper for SCT.
Definition: SCT_FlaggedConditionTool.h:78
InDet::SiDetectorElementStatus::getElementStatus
const std::vector< bool > & getElementStatus() const
Definition: SiDetectorElementStatus.h:116
SCT_FlaggedConditionTool::m_numWarnForFailures
std::atomic_uint m_numWarnForFailures
Definition: SCT_FlaggedConditionTool.h:76
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
IDCInDetBSErrContainer
IDC like storage for BS errors, TODO, customise implementation further so that we store int rather th...
Definition: IDCInDetBSErrContainer.h:19
athena.value
value
Definition: athena.py:124
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SCT_FlaggedConditionTool::isGood
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
Definition: SCT_FlaggedConditionTool.cxx:51
SCT_FlaggedConditionTool::getCondData
const IDCInDetBSErrContainer * getCondData(const EventContext &ctx) const
Definition: SCT_FlaggedConditionTool.cxx:185
SCT_FlaggedConditionTool::m_maxNumWarnForFailures
UnsignedIntegerProperty m_maxNumWarnForFailures
Definition: SCT_FlaggedConditionTool.h:75
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IDetectorElementStatusTool::getInvalidRange
static EventIDRange getInvalidRange()
Definition: IDetectorElementStatusTool.h:33
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
SCT_FlaggedConditionTool::numBadIds
virtual int numBadIds() const override
Get number flagged as bad (per event)
Definition: SCT_FlaggedConditionTool.cxx:171
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
IDCInDetBSErrContainer::ErrorCode
uint64_t ErrorCode
Definition: IDCInDetBSErrContainer.h:21
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: SCT_ID.cxx:636
h
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
SCT_FlaggedConditionTool::details
virtual const std::string & details(const Identifier &id) const override
Get the reason why the wafer is bad (by Identifier)
Definition: SCT_FlaggedConditionTool.cxx:150
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SCT_FlaggedCondEnum::NUM_ERROR_TYPES
@ NUM_ERROR_TYPES
Definition: SCT_FlaggedCondEnum.h:28
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_FlaggedConditionTool::m_badIds
SG::ReadHandleKey< IDCInDetBSErrContainer > m_badIds
Definition: SCT_FlaggedConditionTool.h:73
merge.status
status
Definition: merge.py:17
SCT_FlaggedConditionTool::getBadIds
virtual const IDCInDetBSErrContainer * getBadIds() const override
Get IdentifierHashs ofwafers flagged as bad + reason (per event)
Definition: SCT_FlaggedConditionTool.cxx:180
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
get_generator_info.error
error
Definition: get_generator_info.py:40
InDetConditions::SCT_SIDE
@ SCT_SIDE
Definition: InDetHierarchy.h:14
InDetConditions::DEFAULT
@ DEFAULT
Definition: InDetHierarchy.h:14
error
Definition: IImpactPoint3dEstimator.h:70
SCT_FlaggedConditionTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the tool report about the given component? (chip, module...)
Definition: SCT_FlaggedConditionTool.cxx:40
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275