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

Interface class for tool providing summary of status of an SCT detector element. More...

#include <SCT_ConditionsSummaryTool.h>

Inheritance diagram for SCT_ConditionsSummaryTool:
Collaboration diagram for SCT_ConditionsSummaryTool:

Public Member Functions

 SCT_ConditionsSummaryTool (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor.
virtual ~SCT_ConditionsSummaryTool ()=default
virtual StatusCode initialize () override
 Tool init.
virtual bool isActive (const Identifier &elementId, const InDetConditions::Hierarchy h, const EventContext &ctx) const override
virtual bool isActive (const IdentifierHash &elementHash, const EventContext &ctx) const override
virtual bool isActive (const IdentifierHash &elementHash, const Identifier &elementId, const EventContext &ctx) const override
virtual double activeFraction (const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd, const EventContext &ctx) const override
virtual bool isGood (const Identifier &elementId, const InDetConditions::Hierarchy h, const EventContext &ctx) const override
virtual bool isGood (const IdentifierHash &elementHash, const EventContext &ctx) const override
virtual bool isGood (const IdentifierHash &elementHash, const Identifier &elementId, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override
virtual double goodFraction (const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd, const EventContext &ctx) const override
virtual std::unique_ptr< InDet::SiDetectorElementStatusgetDetectorElementStatus (const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
virtual bool hasBSError (const IdentifierHash &elementHash, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override
virtual bool hasBSError (const IdentifierHash &elementHash, Identifier elementId, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override
virtual uint64_t getBSErrorWord (const IdentifierHash &moduleHash, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override
virtual uint64_t getBSErrorWord (const IdentifierHash &moduleHash, const int index, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override
virtual IDCCacheEntry * getCacheEntryOut (const EventContext &ctx) const override

Private Member Functions

std::unique_ptr< InDet::SiDetectorElementStatuscreateDetectorElementStatus (const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const

Private Attributes

ToolHandleArray< ISCT_ConditionsToolm_toolHandles {this, "ConditionsTools", {},""}
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_SCTDetEleCollKey {this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}
SG::ReadHandleKey< InDet::SiDetectorElementStatusm_SCTDetElStatusEventKey {this, "SCTDetElStatusEventDataBaseKey", "", "Optional event data key of an input SiDetectorElementStatus on which the newly created object will be based."}
SG::ReadCondHandleKey< InDet::SiDetectorElementStatusm_SCTDetElStatusCondKey {this, "SCTDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."}
const SCT_IDm_id_sct {nullptr}
 Handle to SCT ID helper.
bool m_noReports {true}

Detailed Description

Interface class for tool providing summary of status of an SCT detector element.

Definition at line 38 of file SCT_ConditionsSummaryTool.h.

Constructor & Destructor Documentation

◆ SCT_ConditionsSummaryTool()

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

Tool constructor.

Definition at line 19 of file SCT_ConditionsSummaryTool.cxx.

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

◆ ~SCT_ConditionsSummaryTool()

virtual SCT_ConditionsSummaryTool::~SCT_ConditionsSummaryTool ( )
virtualdefault

Member Function Documentation

◆ activeFraction()

double SCT_ConditionsSummaryTool::activeFraction ( const IdentifierHash & elementHash,
const Identifier & idStart,
const Identifier & idEnd,
const EventContext & ctx ) const
overridevirtual

Definition at line 45 of file SCT_ConditionsSummaryTool.cxx.

45 {
46 return goodFraction(elementHash, idStart, idEnd, ctx);
47}
virtual double goodFraction(const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd, const EventContext &ctx) const override

◆ createDetectorElementStatus()

std::unique_ptr< InDet::SiDetectorElementStatus > SCT_ConditionsSummaryTool::createDetectorElementStatus ( const EventContext & ctx,
SG::WriteCondHandle< InDet::SiDetectorElementStatus > * whandle ) const
private

Definition at line 98 of file SCT_ConditionsSummaryTool.cxx.

99 {
100 std::string tool_name (name());
101 (void) tool_name;
102 if (!m_SCTDetElStatusCondKey.empty()) {
103 SG::ReadCondHandle<InDet::SiDetectorElementStatus> input_element_status{m_SCTDetElStatusCondKey, ctx};
104 if (whandle) {
105 whandle->addDependency (input_element_status);
106 }
107 return std::make_unique<InDet::SCT_DetectorElementStatus>(*castToDerived(input_element_status.cptr()));
108 }
109 else if (!m_SCTDetElStatusEventKey.empty()) {
110 SG::ReadHandle<InDet::SiDetectorElementStatus> input_element_status{m_SCTDetElStatusEventKey, ctx};
111 std::string key (m_SCTDetElStatusEventKey.key());
112 (void) key;
113 return std::make_unique<InDet::SCT_DetectorElementStatus>(*castToDerived(input_element_status.cptr()));
114 }
115 else {
116 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> sctDetEleHandle(m_SCTDetEleCollKey, ctx);
117 if (whandle) {
118 whandle->addDependency (sctDetEleHandle);
119 }
120 const InDetDD::SiDetectorElementCollection* elements(*sctDetEleHandle);
121 return std::make_unique<InDet::SCT_DetectorElementStatus>(*elements);
122 }
123}
SG::ReadCondHandleKey< InDet::SiDetectorElementStatus > m_SCTDetElStatusCondKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_SCTDetElStatusEventKey
const_pointer_type cptr()
const_pointer_type cptr()
Dereference the pointer.
void addDependency(const EventIDRange &range)

◆ getBSErrorWord() [1/2]

virtual uint64_t SCT_ConditionsSummaryTool::getBSErrorWord ( const IdentifierHash & moduleHash,
const EventContext & ctx,
const IDCCacheEntry * cacheEntry = nullptr ) const
overridevirtual

◆ getBSErrorWord() [2/2]

virtual uint64_t SCT_ConditionsSummaryTool::getBSErrorWord ( const IdentifierHash & moduleHash,
const int index,
const EventContext & ctx,
const IDCCacheEntry * cacheEntry = nullptr ) const
overridevirtual

◆ getCacheEntryOut()

IInDetConditionsTool::IDCCacheEntry * SCT_ConditionsSummaryTool::getCacheEntryOut ( const EventContext & ctx) const
overridevirtual

Definition at line 162 of file SCT_ConditionsSummaryTool.cxx.

162 {
163 IDCCacheEntry* vector{nullptr};
164 return vector;
165}

◆ getDetectorElementStatus()

std::unique_ptr< InDet::SiDetectorElementStatus > SCT_ConditionsSummaryTool::getDetectorElementStatus ( const EventContext & ctx,
SG::WriteCondHandle< InDet::SiDetectorElementStatus > * whandle ) const
overridevirtual

Definition at line 126 of file SCT_ConditionsSummaryTool.cxx.

127 {
128 std::unique_ptr<InDet::SiDetectorElementStatus>
129 element_status( createDetectorElementStatus(ctx, whandle) );
130 if (not m_noReports) {
131 for (const ToolHandle<ISCT_ConditionsTool>& tool: m_toolHandles) {
132 // @TODO also check if it can report about chips ?
133 if ((tool->canReportAbout(InDetConditions::SCT_SIDE) or
134 tool->canReportAbout(InDetConditions::SCT_MODULE) or
135 tool->canReportAbout(InDetConditions::SCT_STRIP))) {
136 tool->getDetectorElementStatus(ctx,*element_status,whandle);
137 }
138 }
139 }
140 if (element_status->getElementStatus().empty()) {
141 element_status->getElementStatus().resize( element_status->getDetectorElements().size(), true);
142 }
143 if (element_status->getElementChipStatus().empty()) {
144 element_status->getElementChipStatus().resize( element_status->getDetectorElements().size(), 0xffff);
145 }
146 if (element_status->getBadCells().empty()) {
147 element_status->getBadCells().resize( element_status->getDetectorElements().size());
148 }
149 return element_status;
150}
ToolHandleArray< ISCT_ConditionsTool > m_toolHandles
std::unique_ptr< InDet::SiDetectorElementStatus > createDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const

◆ goodFraction()

double SCT_ConditionsSummaryTool::goodFraction ( const IdentifierHash & elementHash,
const Identifier & idStart,
const Identifier & idEnd,
const EventContext & ctx ) const
overridevirtual

Definition at line 168 of file SCT_ConditionsSummaryTool.cxx.

168 {
169 double result{1.0};
170 ATH_MSG_WARNING("goodFraction is a deprecated function always returning 1.0 ");
171 return result;
172}
#define ATH_MSG_WARNING(x)

◆ hasBSError() [1/2]

virtual bool SCT_ConditionsSummaryTool::hasBSError ( const IdentifierHash & elementHash,
const EventContext & ctx,
const IDCCacheEntry * cacheEntry = nullptr ) const
overridevirtual

◆ hasBSError() [2/2]

virtual bool SCT_ConditionsSummaryTool::hasBSError ( const IdentifierHash & elementHash,
Identifier elementId,
const EventContext & ctx,
const IDCCacheEntry * cacheEntry = nullptr ) const
overridevirtual

◆ initialize()

StatusCode SCT_ConditionsSummaryTool::initialize ( )
overridevirtual

Tool init.

Definition at line 26 of file SCT_ConditionsSummaryTool.cxx.

26 {
27 StatusCode sc{m_toolHandles.retrieve()};
28 if (sc.isFailure()) {
29 ATH_MSG_ERROR("Retrieval of ToolHandleArray<ISCT_ConditionsTool> failed.");
30 return sc;
31 }
32 ATH_CHECK( m_SCTDetEleCollKey.initialize() );
33 if (!m_SCTDetElStatusEventKey.empty() && !m_SCTDetElStatusCondKey.empty()) {
34 ATH_MSG_FATAL("The event data (SCTDetElStatusEventDataBaseKey) and cond data (SCTDetElStatusCondDataBaseKey) keys cannot be set at the same time.");
35 }
38 // Get SCT helper
39 ATH_CHECK(detStore()->retrieve(m_id_sct, "SCT_ID"));
40 m_noReports = m_toolHandles.empty();
41 return sc;
42}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
static Double_t sc
const SCT_ID * m_id_sct
Handle to SCT ID helper.
::StatusCode StatusCode
StatusCode definition for legacy code.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ isActive() [1/3]

bool SCT_ConditionsSummaryTool::isActive ( const Identifier & elementId,
const InDetConditions::Hierarchy h,
const EventContext & ctx ) const
overridevirtual

Definition at line 50 of file SCT_ConditionsSummaryTool.cxx.

50 {
51 return isGood(elementId, h, ctx);
52}
virtual bool isGood(const Identifier &elementId, const InDetConditions::Hierarchy h, const EventContext &ctx) const override

◆ isActive() [2/3]

bool SCT_ConditionsSummaryTool::isActive ( const IdentifierHash & elementHash,
const EventContext & ctx ) const
overridevirtual

Definition at line 55 of file SCT_ConditionsSummaryTool.cxx.

55 {
56 return isGood(elementHash, ctx);
57}

◆ isActive() [3/3]

bool SCT_ConditionsSummaryTool::isActive ( const IdentifierHash & elementHash,
const Identifier & elementId,
const EventContext & ctx ) const
overridevirtual

Definition at line 60 of file SCT_ConditionsSummaryTool.cxx.

60 {
61 return isGood(elementHash, elementId, ctx);
62}

◆ isGood() [1/3]

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

Definition at line 65 of file SCT_ConditionsSummaryTool.cxx.

65 {
66 if (not m_noReports) {
67 for (const ToolHandle<ISCT_ConditionsTool>& tool: m_toolHandles) {
68 if (tool->canReportAbout(h) and (not tool->isGood(elementId, ctx, h))) return false;
69 }
70 }
71 return true;
72}

◆ isGood() [2/3]

bool SCT_ConditionsSummaryTool::isGood ( const IdentifierHash & elementHash,
const EventContext & ctx ) const
overridevirtual

Definition at line 75 of file SCT_ConditionsSummaryTool.cxx.

75 {
76 if (not m_noReports) {
77 for (const ToolHandle<ISCT_ConditionsTool>& tool: m_toolHandles) {
78 if ((tool->canReportAbout(InDetConditions::SCT_SIDE) or
79 tool->canReportAbout(InDetConditions::SCT_MODULE)) and
80 (not tool->isGood(elementHash, ctx))) {
81 return false;
82 }
83 }
84 }
85 return true;
86}

◆ isGood() [3/3]

virtual bool SCT_ConditionsSummaryTool::isGood ( const IdentifierHash & elementHash,
const Identifier & elementId,
const EventContext & ctx,
const IDCCacheEntry * cacheEntry = nullptr ) const
overridevirtual

Member Data Documentation

◆ m_id_sct

const SCT_ID* SCT_ConditionsSummaryTool::m_id_sct {nullptr}
private

Handle to SCT ID helper.

Definition at line 83 of file SCT_ConditionsSummaryTool.h.

83{nullptr};

◆ m_noReports

bool SCT_ConditionsSummaryTool::m_noReports {true}
private

Definition at line 86 of file SCT_ConditionsSummaryTool.h.

86{true};

◆ m_SCTDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> SCT_ConditionsSummaryTool::m_SCTDetEleCollKey {this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}
private

Definition at line 77 of file SCT_ConditionsSummaryTool.h.

78{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};

◆ m_SCTDetElStatusCondKey

SG::ReadCondHandleKey<InDet::SiDetectorElementStatus> SCT_ConditionsSummaryTool::m_SCTDetElStatusCondKey {this, "SCTDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."}
private

Definition at line 81 of file SCT_ConditionsSummaryTool.h.

82{this, "SCTDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."};

◆ m_SCTDetElStatusEventKey

SG::ReadHandleKey<InDet::SiDetectorElementStatus> SCT_ConditionsSummaryTool::m_SCTDetElStatusEventKey {this, "SCTDetElStatusEventDataBaseKey", "", "Optional event data key of an input SiDetectorElementStatus on which the newly created object will be based."}
private

Definition at line 79 of file SCT_ConditionsSummaryTool.h.

80{this, "SCTDetElStatusEventDataBaseKey", "", "Optional event data key of an input SiDetectorElementStatus on which the newly created object will be based."};

◆ m_toolHandles

ToolHandleArray<ISCT_ConditionsTool> SCT_ConditionsSummaryTool::m_toolHandles {this, "ConditionsTools", {},""}
private

Definition at line 75 of file SCT_ConditionsSummaryTool.h.

76{this, "ConditionsTools", {},""};

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