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 28 of file SCT_RODVetoTool.cxx.

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

◆ ~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 49 of file SCT_RODVetoTool.cxx.

◆ finalize()

StatusCode SCT_RODVetoTool::finalize ( )
overridevirtual

Definition at line 44 of file SCT_RODVetoTool.cxx.

44 {
45 return StatusCode::SUCCESS;
46}

◆ getCondData()

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

Definition at line 123 of file SCT_RODVetoTool.cxx.

123 {
124 SG::ReadCondHandle<IdentifierSet> condData{m_badModuleIds, ctx};
125 if (not condData.isValid()) {
126 ATH_MSG_ERROR("Failed to get " << m_badModuleIds.key());
127 return nullptr;
128 }
129 return condData.cptr();
130}
#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 91 of file SCT_RODVetoTool.cxx.

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

35 {
36 ATH_CHECK(detStore()->retrieve(m_pHelper, "SCT_ID"));
37 ATH_CHECK(m_badModuleIds.initialize());
38
39 return StatusCode::SUCCESS;
40}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ isGood() [1/4]

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

Definition at line 56 of file SCT_RODVetoTool.cxx.

56 {
57 if (not canReportAbout(h)) return true;
58 const IdentifierSet* badIds{getCondData(ctx)};
59 if (badIds==nullptr) {
60 ATH_MSG_ERROR("IdentifierSet cannot be retrieved in isGood. true is returned.");
61 return true;
62 }
63 const Identifier waferId{m_pHelper->wafer_id(elementId)};
64 const Identifier moduleId{m_pHelper->module_id(waferId)};
65 bool result{badIds->find(moduleId) == badIds->end()};
66 return result;
67}
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 70 of file SCT_RODVetoTool.cxx.

70 {
71 const EventContext& ctx{Gaudi::Hive::currentContext()};
72
73 return isGood(elementId, ctx, h);
74}
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 84 of file SCT_RODVetoTool.cxx.

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

◆ isGood() [4/4]

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

Definition at line 77 of file SCT_RODVetoTool.cxx.

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

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