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

Tool that keeps track of Tdaq enabling/disabling of SCT Rods. More...

#include <SCT_TdaqEnabledTool.h>

Inheritance diagram for SCT_TdaqEnabledTool:
Collaboration diagram for SCT_TdaqEnabledTool:

Public Member Functions

 SCT_TdaqEnabledTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~SCT_TdaqEnabledTool ()=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? (TdaqEnabledSvc can answer questions about a module or module side)
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 SCT_TdaqEnabledCondDatagetCondData (const EventContext &ctx) const

Private Attributes

const SCT_IDm_pHelper {nullptr}
bool m_useDatabase {true}
SG::ReadCondHandleKey< SCT_TdaqEnabledCondDatam_condKey {this, "CondKey", "SCT_TdaqEnabledCondData", "Active SCT RODs"}

Detailed Description

Tool that keeps track of Tdaq enabling/disabling of SCT Rods.

Definition at line 32 of file SCT_TdaqEnabledTool.h.

Constructor & Destructor Documentation

◆ SCT_TdaqEnabledTool()

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

Definition at line 20 of file SCT_TdaqEnabledTool.cxx.

20 :
21 base_class(type, name, parent)
22{
23}

◆ ~SCT_TdaqEnabledTool()

virtual SCT_TdaqEnabledTool::~SCT_TdaqEnabledTool ( )
virtualdefault

Member Function Documentation

◆ canReportAbout()

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

Can the service report about the given component? (TdaqEnabledSvc can answer questions about a module or module side)

Definition at line 45 of file SCT_TdaqEnabledTool.cxx.

◆ finalize()

StatusCode SCT_TdaqEnabledTool::finalize ( )
overridevirtual

Definition at line 40 of file SCT_TdaqEnabledTool.cxx.

40 {
41 return StatusCode::SUCCESS;
42}

◆ getCondData()

const SCT_TdaqEnabledCondData * SCT_TdaqEnabledTool::getCondData ( const EventContext & ctx) const
private

Definition at line 112 of file SCT_TdaqEnabledTool.cxx.

112 {
113 SG::ReadCondHandle<SCT_TdaqEnabledCondData> condData{m_condKey, ctx};
114 return condData.retrieve();
115}
SG::ReadCondHandleKey< SCT_TdaqEnabledCondData > m_condKey
const_pointer_type retrieve()

◆ getDetectorElementStatus()

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

Definition at line 79 of file SCT_TdaqEnabledTool.cxx.

80 {
81 SG::ReadCondHandle<SCT_TdaqEnabledCondData> condDataHandle{m_condKey, ctx};
82 if (not condDataHandle.isValid()) {
83 ATH_MSG_ERROR("Invalid cond data handle " << m_condKey.key() );
84 return;
85 }
86 if (whandle) {
87 whandle->addDependency (condDataHandle);
88 }
89 const SCT_TdaqEnabledCondData* condData{condDataHandle.cptr()};
90 if (condData==nullptr) {
91 ATH_MSG_ERROR("Invalid TdaqEnabledCondData. Return true.");
92 return ;
93 }
94 std::vector<bool> &status = element_status.getElementStatus();
95 if (status.empty()) {
96 status.resize(m_pHelper->wafer_hash_max(),true);
97 }
98 if (not condData->isNoneBad()) {
99 std::vector<bool> tdaq_enabled;
100 tdaq_enabled.resize(m_pHelper->wafer_hash_max(),false);
101 for (const IdentifierHash &id_hash : condData->goodIdHashes() ) {
102 tdaq_enabled.at(id_hash.value())=true;
103 }
104 for (unsigned int status_i=0; status_i<status.size(); ++status_i) {
105 status[status_i] = status[status_i] && tdaq_enabled.at(status_i);
106 }
107 }
108
109}
#define ATH_MSG_ERROR(x)
const std::vector< bool > & getElementStatus() const
bool isNoneBad() const
Get noneBad value.
const std::set< IdentifierHash > & goodIdHashes() const
const_pointer_type cptr()
void addDependency(const EventIDRange &range)
status
Definition merge.py:16

◆ initialize()

StatusCode SCT_TdaqEnabledTool::initialize ( )
overridevirtual

Definition at line 27 of file SCT_TdaqEnabledTool.cxx.

27 {
28 const std::string databaseUseString{m_useDatabase?"":"not "};
29 ATH_MSG_INFO(" Database will "<<databaseUseString<<"be used.");
30
32 // Read Cond Handle Key
34
35 return StatusCode::SUCCESS;
36}
#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_TdaqEnabledTool::isGood ( const Identifier & elementId,
const EventContext & ctx,
InDetConditions::Hierarchy h = InDetConditions::DEFAULT ) const
overridevirtual

Definition at line 50 of file SCT_TdaqEnabledTool.cxx.

50 {
51 if (not canReportAbout(h)) return true;
52 //turn to hash, given the identifier
53 const IdentifierHash hashId{m_pHelper->wafer_hash(elementId)};
54 return isGood(hashId, ctx);
55}
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (TdaqEnabledSvc can answer questions about a module...
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?

◆ isGood() [2/4]

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

Is the detector element good?

Definition at line 58 of file SCT_TdaqEnabledTool.cxx.

58 {
59 const EventContext& ctx{Gaudi::Hive::currentContext()};
60
61 return isGood(elementId, ctx, h);
62}

◆ isGood() [3/4]

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

is it good?, using wafer hash

Definition at line 72 of file SCT_TdaqEnabledTool.cxx.

72 {
73 const EventContext& ctx{Gaudi::Hive::currentContext()};
74
75 return isGood(hashId, ctx);
76}

◆ isGood() [4/4]

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

Definition at line 65 of file SCT_TdaqEnabledTool.cxx.

65 {
66 const SCT_TdaqEnabledCondData* condData{getCondData(ctx)};
67 if (condData==nullptr) return false;
68 return condData->isGood(hashId);
69}
bool isGood(const IdentifierHash &hashId) const
Check if a module is good.
const SCT_TdaqEnabledCondData * getCondData(const EventContext &ctx) const

Member Data Documentation

◆ m_condKey

SG::ReadCondHandleKey<SCT_TdaqEnabledCondData> SCT_TdaqEnabledTool::m_condKey {this, "CondKey", "SCT_TdaqEnabledCondData", "Active SCT RODs"}
private

Definition at line 60 of file SCT_TdaqEnabledTool.h.

60{this, "CondKey", "SCT_TdaqEnabledCondData", "Active SCT RODs"};

◆ m_pHelper

const SCT_ID* SCT_TdaqEnabledTool::m_pHelper {nullptr}
private

Definition at line 57 of file SCT_TdaqEnabledTool.h.

57{nullptr};

◆ m_useDatabase

bool SCT_TdaqEnabledTool::m_useDatabase {true}
private

Definition at line 58 of file SCT_TdaqEnabledTool.h.

58{true};

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