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

#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...) 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 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. More...
 

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.

50  {
51  return ((h==InDetConditions::DEFAULT) or
54 }

◆ 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  {
126  if (not condData.isValid()) {
127  ATH_MSG_ERROR("Failed to get " << m_badModuleIds.key());
128  return nullptr;
129  }
130  return condData.cptr();
131 }

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

◆ 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"));
39 
40  return StatusCode::SUCCESS;
41 }

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

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

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

Friends And Related Function Documentation

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

◆ m_pHelper

const SCT_ID* SCT_RODVetoTool::m_pHelper {nullptr}
private

Definition at line 71 of file SCT_RODVetoTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
IdentifierSet
std::set< Identifier > IdentifierSet
IdentifierSet is std::set of Identifier and used in SCT_RODVetoCondAlg and SCT_RODVetoTool....
Definition: IdentifierSet.h:18
InDet::SiDetectorElementStatus::getElementStatus
const std::vector< bool > & getElementStatus() const
Definition: SiDetectorElementStatus.h:116
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SCT_RODVetoTool::getCondData
const IdentifierSet * getCondData(const EventContext &ctx) const
Definition: SCT_RODVetoTool.cxx:124
SCT_RODVetoTool::m_pHelper
const SCT_ID * m_pHelper
Definition: SCT_RODVetoTool.h:71
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SCT_RODVetoTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (chip, module...)
Definition: SCT_RODVetoTool.cxx:50
SCT_ID::module_id
Identifier module_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: SCT_ID.h:416
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_RODVetoTool::m_badModuleIds
SG::ReadCondHandleKey< IdentifierSet > m_badModuleIds
Definition: SCT_RODVetoTool.h:69
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_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
merge.status
status
Definition: merge.py:17
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
InDetConditions::SCT_SIDE
@ SCT_SIDE
Definition: InDetHierarchy.h:14
InDetConditions::DEFAULT
@ DEFAULT
Definition: InDetHierarchy.h:14
SCT_RODVetoTool::isGood
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::DEFAULT) const override
Is the detector element good?
Definition: SCT_RODVetoTool.cxx:71
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275
Identifier
Definition: IdentifierFieldParser.cxx:14