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

#include <PixelActiveDetectorElementStatusTool.h>

Inheritance diagram for PixelActiveDetectorElementStatusTool:
Collaboration diagram for PixelActiveDetectorElementStatusTool:

Public Member Functions

 PixelActiveDetectorElementStatusTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
virtual std::unique_ptr< InDet::SiDetectorElementStatusgetDetectorElementStatus (const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override

Static Public Member Functions

static InterfaceID & interfaceID ()

Protected Member Functions

std::unique_ptr< InDet::SiDetectorElementStatuscreateDetectorElementStatus (const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
 Create a new detector element status element container.

Protected Attributes

const PixelIDm_pixelID {}

Private Attributes

SG::ReadCondHandleKey< PixelDCSStatusDatam_condDCSStatusKey {this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}
Gaudi::Property< std::vector< std::string > > m_isActiveStatus {this, "IsActiveStatus", {},"Pixel module status for which the module is considered active." }
unsigned int m_activeStatusMask {0}
 mask in which each status is represented by a bit and for status values which are cnsidered active the corresponding bit is set;
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_pixelDetEleCollKey {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}
SG::ReadCondHandleKey< InDet::SiDetectorElementStatusm_pixelDetElStatusCondKey {this, "PixelDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."}

Detailed Description

Definition at line 20 of file PixelActiveDetectorElementStatusTool.h.

Constructor & Destructor Documentation

◆ PixelActiveDetectorElementStatusTool()

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

Definition at line 23 of file PixelActiveDetectorElementStatusTool.h.

24 : PixelDetectorElementStatusToolBase(type,name, parent)
25 {}
PixelDetectorElementStatusToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ createDetectorElementStatus()

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

Create a new detector element status element container.

Depending on the properties the container may be a copy of an event data or conditions data element status container.

Definition at line 34 of file PixelDetectorElementStatusToolBase.cxx.

35 {
36 if (!m_pixelDetElStatusCondKey.empty()) {
37 SG::ReadCondHandle<InDet::SiDetectorElementStatus> input_element_status{m_pixelDetElStatusCondKey, ctx};
38 if (whandle) {
39 whandle->addDependency (input_element_status);
40 }
41
42 return std::make_unique<InDet::PixelDetectorElementStatus>(*castToDerived(input_element_status.cptr()));
43 }
44 else {
45 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle(m_pixelDetEleCollKey, ctx);
46 if (not pixelDetEleHandle.isValid() ) {
47 std::stringstream msg;
48 msg << m_pixelDetEleCollKey.fullKey() << " is not available.";
49 throw std::runtime_error(msg.str());
50 }
51 if (whandle) {
52 whandle->addDependency (pixelDetEleHandle);
53 }
54 const InDetDD::SiDetectorElementCollection* elements(*pixelDetEleHandle);
55 return std::make_unique<InDet::PixelDetectorElementStatus>(*elements);
56 }
57}
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusCondKey
const_pointer_type cptr()
void addDependency(const EventIDRange &range)
MsgStream & msg
Definition testRead.cxx:32

◆ getDetectorElementStatus()

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

Definition at line 40 of file PixelActiveDetectorElementStatusTool.cxx.

41 {
42 std::unique_ptr<InDet::SiDetectorElementStatus> element_status( createDetectorElementStatus(ctx, whandle));
43 std::vector<bool> &status=element_status->getElementStatus();
44 if (status.empty()) {
45 status.resize(m_pixelID->wafer_hash_max(),
46 true // default value of PixelDCSStateData is 0
47 );
48 }
49 std::vector<InDet::ChipFlags_t> &chip_status=element_status->getElementChipStatus();
50 if (chip_status.empty()) {
51 chip_status.resize(status.size(),0xffff); // Should set this to the correct number of chips
52 }
53
54 SG::ReadCondHandle<PixelDCSStatusData> dcs_status_handle(m_condDCSStatusKey, ctx);
55 andStatus(dcs_status_handle->moduleStatusMap(), m_activeStatusMask, status);
56 if (whandle) {
57 whandle->addDependency (dcs_status_handle);
58 }
59
60 return element_status;
61}
SG::ReadCondHandleKey< PixelDCSStatusData > m_condDCSStatusKey
unsigned int m_activeStatusMask
mask in which each status is represented by a bit and for status values which are cnsidered active th...
std::unique_ptr< InDet::SiDetectorElementStatus > createDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
Create a new detector element status element container.
status
Definition merge.py:16

◆ initialize()

StatusCode PixelActiveDetectorElementStatusTool::initialize ( )
overridevirtual

Reimplemented from PixelDetectorElementStatusToolBase.

Definition at line 4 of file PixelActiveDetectorElementStatusTool.cxx.

5{
7 ATH_CHECK(m_condDCSStatusKey.initialize());
8
10 for (unsigned int istatus=0; istatus<m_isActiveStatus.size(); istatus++) {
11 unsigned int active_status=0;
12 if (m_isActiveStatus[istatus]=="OK") { active_status = PixelDCSStatusData::DCSModuleStatus::OK; }
13 else if (m_isActiveStatus[istatus]=="WARNING") { active_status = PixelDCSStatusData::DCSModuleStatus::WARNING; }
14 else if (m_isActiveStatus[istatus]=="ERROR") { active_status = PixelDCSStatusData::DCSModuleStatus::ERROR; }
15 else if (m_isActiveStatus[istatus]=="FATAL") { active_status = PixelDCSStatusData::DCSModuleStatus::FATAL; }
16 else if (m_isActiveStatus[istatus]=="NOSTATUS") { active_status = PixelDCSStatusData::DCSModuleStatus::NOSTATUS; }
17 else {
18 ATH_MSG_ERROR("No matching DCS status " << m_isActiveStatus[istatus] << " in DCSModuleStatus");
19 return StatusCode::FAILURE;
20 }
21 if (active_status>31) {
22 ATH_MSG_FATAL("Logic error: status id too large. Cannot be represented by a bit");
23 return StatusCode::FAILURE;
24 }
25 m_activeStatusMask |= (1u<<active_status);
26 }
27 return StatusCode::SUCCESS;
28}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
Gaudi::Property< std::vector< std::string > > m_isActiveStatus

◆ interfaceID()

InterfaceID & PixelActiveDetectorElementStatusTool::interfaceID ( )
inlinestatic

Definition at line 42 of file PixelActiveDetectorElementStatusTool.h.

42 {
43 static InterfaceID IID_PixelActiveDetectorElementStatusTool("PixelActiveDetectorElementStatusTool", 1, 0);
44 return IID_PixelActiveDetectorElementStatusTool;
45}

Member Data Documentation

◆ m_activeStatusMask

unsigned int PixelActiveDetectorElementStatusTool::m_activeStatusMask {0}
private

mask in which each status is represented by a bit and for status values which are cnsidered active the corresponding bit is set;

Definition at line 39 of file PixelActiveDetectorElementStatusTool.h.

39{0};

◆ m_condDCSStatusKey

SG::ReadCondHandleKey<PixelDCSStatusData> PixelActiveDetectorElementStatusTool::m_condDCSStatusKey {this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}
private

Definition at line 34 of file PixelActiveDetectorElementStatusTool.h.

35{this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"};

◆ m_isActiveStatus

Gaudi::Property< std::vector<std::string> > PixelActiveDetectorElementStatusTool::m_isActiveStatus {this, "IsActiveStatus", {},"Pixel module status for which the module is considered active." }
private

Definition at line 36 of file PixelActiveDetectorElementStatusTool.h.

37{this, "IsActiveStatus", {},"Pixel module status for which the module is considered active." };

◆ m_pixelDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> PixelDetectorElementStatusToolBase::m_pixelDetEleCollKey {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}
privateinherited

Definition at line 41 of file PixelDetectorElementStatusToolBase.h.

42{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};

◆ m_pixelDetElStatusCondKey

SG::ReadCondHandleKey<InDet::SiDetectorElementStatus> PixelDetectorElementStatusToolBase::m_pixelDetElStatusCondKey {this, "PixelDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."}
privateinherited

Definition at line 44 of file PixelDetectorElementStatusToolBase.h.

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

◆ m_pixelID

const PixelID* PixelDetectorElementStatusToolBase::m_pixelID {}
protectedinherited

Definition at line 38 of file PixelDetectorElementStatusToolBase.h.

38{};

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