ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SCT_TdaqEnabledTool Class Reference

#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) 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
 is it good?, using wafer hash More...
 
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  {
114  return condData.retrieve();
115 }

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

◆ 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 
31  ATH_CHECK(detStore()->retrieve(m_pHelper,"SCT_ID"));
32  // Read Cond Handle Key
34 
35  return StatusCode::SUCCESS;
36 }

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

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

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.

◆ m_pHelper

const SCT_ID* SCT_TdaqEnabledTool::m_pHelper {nullptr}
private

Definition at line 57 of file SCT_TdaqEnabledTool.h.

◆ m_useDatabase

bool SCT_TdaqEnabledTool::m_useDatabase {true}
private

Definition at line 58 of file SCT_TdaqEnabledTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDet::SiDetectorElementStatus::getElementStatus
const std::vector< bool > & getElementStatus() const
Definition: SiDetectorElementStatus.h:116
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SCT_TdaqEnabledTool::isGood
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
Definition: SCT_TdaqEnabledTool.cxx:58
SCT_TdaqEnabledCondData::isGood
bool isGood(const IdentifierHash &hashId) const
Check if a module is good.
Definition: SCT_TdaqEnabledCondData.cxx:74
SCT_TdaqEnabledTool::m_condKey
SG::ReadCondHandleKey< SCT_TdaqEnabledCondData > m_condKey
Definition: SCT_TdaqEnabledTool.h:60
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SCT_TdaqEnabledTool::m_pHelper
const SCT_ID * m_pHelper
Definition: SCT_TdaqEnabledTool.h:57
SCT_TdaqEnabledTool::m_useDatabase
bool m_useDatabase
Definition: SCT_TdaqEnabledTool.h:58
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDetConditions::SCT_MODULE
@ SCT_MODULE
Definition: InDetHierarchy.h:14
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_TdaqEnabledCondData
Class for data object used in SCT_TdaqEnabledCondAlg and SCT_TdaqEnabledTool.
Definition: SCT_TdaqEnabledCondData.h:27
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
SCT_TdaqEnabledTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (TdaqEnabledSvc can answer questions about a module...
Definition: SCT_TdaqEnabledTool.cxx:45
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
merge.status
status
Definition: merge.py:17
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
InDetConditions::SCT_SIDE
@ SCT_SIDE
Definition: InDetHierarchy.h:14
InDetConditions::DEFAULT
@ DEFAULT
Definition: InDetHierarchy.h:14
SCT_TdaqEnabledTool::getCondData
const SCT_TdaqEnabledCondData * getCondData(const EventContext &ctx) const
Definition: SCT_TdaqEnabledTool.cxx:112
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275