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

Service allowing one to manually declare detector elements as 'bad' in the joboptions file. More...

#include <SCT_RODVetoTool.h>

Inheritance diagram for SCT_RODVetoTool:
Collaboration diagram for SCT_RODVetoTool:

Public Member Functions

 SCT_RODVetoTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~SCT_RODVetoTool ()=default
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual bool canReportAbout (InDetConditions::Hierarchy h) const override
 Can the service report about the given component? (chip, module...)
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
 is it good?, using wafer hash
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

Private Member Functions

const IdentifierSetgetCondData (const EventContext &ctx) const

Private Attributes

SG::ReadCondHandleKey< IdentifierSetm_badModuleIds {this, "BadModuleIds", "BadSCTModuleIds_RODVeto", "Read key for bad module identifiers"}
const SCT_IDm_pHelper {nullptr}

Friends

class SCT_RODVetoTool_test
 Allow the test class access to all methods.

Detailed Description

Service allowing one to manually declare detector elements as 'bad' in the joboptions file.

Definition at line 37 of file SCT_RODVetoTool.h.

Constructor & Destructor Documentation

◆ SCT_RODVetoTool()

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

Definition at line 29 of file SCT_RODVetoTool.cxx.

29 :
30 base_class(type, name, parent)
31{
32}

◆ ~SCT_RODVetoTool()

virtual SCT_RODVetoTool::~SCT_RODVetoTool ( )
virtualdefault

Member Function Documentation

◆ canReportAbout()

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

Can the service report about the given component? (chip, module...)

Definition at line 50 of file SCT_RODVetoTool.cxx.

◆ finalize()

StatusCode SCT_RODVetoTool::finalize ( )
overridevirtual

Definition at line 45 of file SCT_RODVetoTool.cxx.

45 {
46 return StatusCode::SUCCESS;
47}

◆ getCondData()

const IdentifierSet * SCT_RODVetoTool::getCondData ( const EventContext & ctx) const
private

Definition at line 124 of file SCT_RODVetoTool.cxx.

124 {
125 SG::ReadCondHandle<IdentifierSet> condData{m_badModuleIds, ctx};
126 if (not condData.isValid()) {
127 ATH_MSG_ERROR("Failed to get " << m_badModuleIds.key());
128 return nullptr;
129 }
130 return condData.cptr();
131}
#define ATH_MSG_ERROR(x)
SG::ReadCondHandleKey< IdentifierSet > m_badModuleIds
const_pointer_type cptr()

◆ getDetectorElementStatus()

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

Definition at line 92 of file SCT_RODVetoTool.cxx.

93 {
94 SG::ReadCondHandle<IdentifierSet> condDataHandle{m_badModuleIds, ctx};
95 if (not condDataHandle.isValid() || !condDataHandle.cptr()) {
96 ATH_MSG_ERROR("Failed to get " << m_badModuleIds.key());
97 return;
98 }
99 if (whandle) {
100 whandle->addDependency (condDataHandle);
101 }
102 const IdentifierSet* badIds{ condDataHandle.cptr() };
103 if (badIds==nullptr) {
104 ATH_MSG_ERROR("IdentifierSet cannot be retrieved in isGood. true is returned.");
105 return;
106 }
107 std::vector<bool> &status = element_status.getElementStatus();
108 if (status.empty()) {
109 status.resize(m_pHelper->wafer_hash_max(),true);
110 }
111 for (const Identifier &module_id: *badIds) {
112 for (int side_i=0; side_i<2; ++side_i) {
113 Identifier wafer_id( m_pHelper->wafer_id( m_pHelper->barrel_ec(module_id),
114 m_pHelper->layer_disk(module_id),
115 m_pHelper->phi_module(module_id),
116 m_pHelper->eta_module(module_id),
117 side_i));
118 status.at( m_pHelper->wafer_hash(wafer_id) ) = false;
119 }
120 }
121}
std::set< Identifier > IdentifierSet
IdentifierSet is std::set of Identifier and used in SCT_RODVetoCondAlg and SCT_RODVetoTool.
const std::vector< bool > & getElementStatus() const
const SCT_ID * m_pHelper
void addDependency(const EventIDRange &range)
status
Definition merge.py:16

◆ initialize()

StatusCode SCT_RODVetoTool::initialize ( )
overridevirtual

Definition at line 36 of file SCT_RODVetoTool.cxx.

36 {
37 ATH_CHECK(detStore()->retrieve(m_pHelper, "SCT_ID"));
38 ATH_CHECK(m_badModuleIds.initialize());
39
40 return StatusCode::SUCCESS;
41}
#define ATH_CHECK
Evaluate an expression and check for errors.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ isGood() [1/4]

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

Definition at line 57 of file SCT_RODVetoTool.cxx.

57 {
58 if (not canReportAbout(h)) return true;
59 const IdentifierSet* badIds{getCondData(ctx)};
60 if (badIds==nullptr) {
61 ATH_MSG_ERROR("IdentifierSet cannot be retrieved in isGood. true is returned.");
62 return true;
63 }
64 const Identifier waferId{m_pHelper->wafer_id(elementId)};
65 const Identifier moduleId{m_pHelper->module_id(waferId)};
66 bool result{badIds->find(moduleId) == badIds->end()};
67 return result;
68}
const IdentifierSet * getCondData(const EventContext &ctx) const
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (chip, module...)

◆ isGood() [2/4]

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

Is the detector element good?

Definition at line 71 of file SCT_RODVetoTool.cxx.

71 {
72 const EventContext& ctx{Gaudi::Hive::currentContext()};
73
74 return isGood(elementId, ctx, h);
75}
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?

◆ isGood() [3/4]

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

is it good?, using wafer hash

Definition at line 85 of file SCT_RODVetoTool.cxx.

85 {
86 const EventContext& ctx{Gaudi::Hive::currentContext()};
87
88 return isGood(hashId, ctx);
89}

◆ isGood() [4/4]

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

Definition at line 78 of file SCT_RODVetoTool.cxx.

78 {
79 Identifier elementId{m_pHelper->wafer_id(hashId)};
80 Identifier moduleId{m_pHelper->module_id(elementId)};
81 return isGood(moduleId, ctx, InDetConditions::SCT_MODULE);
82}

◆ SCT_RODVetoTool_test

friend class SCT_RODVetoTool_test
friend

Allow the test class access to all methods.

Definition at line 39 of file SCT_RODVetoTool.h.

Member Data Documentation

◆ m_badModuleIds

SG::ReadCondHandleKey<IdentifierSet> SCT_RODVetoTool::m_badModuleIds {this, "BadModuleIds", "BadSCTModuleIds_RODVeto", "Read key for bad module identifiers"}
private

Definition at line 69 of file SCT_RODVetoTool.h.

69{this, "BadModuleIds", "BadSCTModuleIds_RODVeto", "Read key for bad module identifiers"};

◆ m_pHelper

const SCT_ID* SCT_RODVetoTool::m_pHelper {nullptr}
private

Definition at line 71 of file SCT_RODVetoTool.h.

71{nullptr};

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