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

The tool to get Tile channel and ADC status. More...

#include <TileBadChanTool.h>

Inheritance diagram for TileBadChanTool:
Collaboration diagram for TileBadChanTool:

Public Member Functions

 TileBadChanTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TileBadChanTool ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual CaloBadChannel caloStatus (const EventContext &ctx, Identifier cell_id) const override
const TileBchStatus & getAdcStatus (IdentifierHash hash_id, unsigned int adc) const
virtual const TileBchStatus & getAdcStatus (const HWIdentifier &adc_id, const EventContext &ctx) const override
 Return Tile ADC status.
virtual const TileBchStatus & getAdcStatus (unsigned int drawerIdx, unsigned int channel, unsigned int adc, const EventContext &ctx) const override
 Return Tile ADC status.
const TileBchStatus & getChannelStatus (IdentifierHash hash_id) const
virtual const TileBchStatus & getChannelStatus (const HWIdentifier &channel_id, const EventContext &ctx) const override
 Return Tile channel status.
virtual const TileBchStatus & getChannelStatus (unsigned int drawerIdx, unsigned int channel, const EventContext &ctx) const override
 Return Tile channel status.
virtual uint32_t encodeStatus (const TileBchStatus &status) const override
virtual const std::vector< float > & getTripsProbabilities (unsigned int ros, const EventContext &ctx) const override
 Return trips probabilities for all Tile drawers.
virtual bool isDrawerMasked (unsigned int frag_id, const EventContext &ctx) const override
 Check if Tile drawer is masked completely.

Private Member Functions

TileBadChanTool & operator= (const TileBadChanTool &)

Private Attributes

SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
 Name of TileBadChannels in condition store.
const TileDetDescrManager * m_tileMgr {nullptr}
const TileHWID * m_tileHWID {nullptr}
TileBchStatus m_defaultStatus {}
std::vector< float > m_defaultTripsProbs = std::vector<float>(TileCalibUtils::MAX_DRAWER, 0.0F)
std::vector< unsigned int > m_roses
std::vector< unsigned int > m_drawers

Detailed Description

The tool to get Tile channel and ADC status.

Definition at line 37 of file TileBadChanTool.h.

Constructor & Destructor Documentation

◆ TileBadChanTool()

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

Definition at line 27 of file TileBadChanTool.cxx.

28 : base_class(type, name, parent)
29{
30}

◆ ~TileBadChanTool()

TileBadChanTool::~TileBadChanTool ( )
virtual

Definition at line 34 of file TileBadChanTool.cxx.

34 {
35
36}

Member Function Documentation

◆ caloStatus()

CaloBadChannel TileBadChanTool::caloStatus ( const EventContext & ctx,
Identifier cell_id ) const
overridevirtual

Definition at line 80 of file TileBadChanTool.cxx.

81{
82
84
85 //=== get the TileHWIDs of the two channels connected to the caloCellnxs id
86 const CaloDetDescrElement* elem = m_tileMgr->get_cell_element(cell_id);
87
88 if (!elem) {
89 //=== this should never happen
90 ATH_MSG_ERROR( "CaloMgr returns NULL CaloDetDescrElement" );
91 std::abort();
92 }
93
94 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey,ctx);
95
96 IdentifierHash hash1_id(elem->onl1());
97 IdentifierHash hash2_id(elem->onl2());
98
99 //=== status of 1. connected channel
100 TileBchStatus channel1_status = (hash1_id != TileHWID::NOT_VALID_HASH) ?
101 badChannels->getChannelStatus(m_tileHWID->channel_id(hash1_id)) : m_defaultStatus;
102
103 //=== status of 2. connected channel
104 TileBchStatus channel2_status = (hash2_id != TileHWID::NOT_VALID_HASH) ?
105 badChannels->getChannelStatus(m_tileHWID->channel_id(hash2_id)) : m_defaultStatus;
106
107 //=== set cell status depending on channel status
108 if (channel1_status.isBad() && channel2_status.isBad()) {
110 } else if (channel1_status.isAffected() || channel2_status.isAffected()) {
112 }
113
114 return CaloBadChannel(res);
115}
#define ATH_MSG_ERROR(x,...)
std::pair< std::vector< unsigned int >, bool > res
unsigned int BitWord
static void setBit(ProblemType pb, BitWord &word, bool value=true)
Sets the bit corresponding to "pb" inside the word passed as second argument to "value".
const TileHWID * m_tileHWID
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
TileBchStatus m_defaultStatus
const TileDetDescrManager * m_tileMgr
bool isAffected() const
bool isBad() const
@ NOT_VALID_HASH
Definition TileHWID.h:314

◆ encodeStatus()

uint32_t TileBadChanTool::encodeStatus ( const TileBchStatus & status) const
overridevirtual

Definition at line 195 of file TileBadChanTool.cxx.

195 {
196 return TileBadChannels::encodeStatus(status);
197}
static uint32_t encodeStatus(const TileBchStatus &status)

◆ finalize()

StatusCode TileBadChanTool::finalize ( )
overridevirtual

Definition at line 70 of file TileBadChanTool.cxx.

70 {
71
72 ATH_MSG_DEBUG( "finalize called" );
73 return StatusCode::SUCCESS;
74
75}
#define ATH_MSG_DEBUG(x,...)

◆ getAdcStatus() [1/3]

const TileBchStatus & TileBadChanTool::getAdcStatus ( const HWIdentifier & adc_id,
const EventContext & ctx ) const
overridevirtual

Return Tile ADC status.

Parameters
adc_idTile hardware (online) ADC identifier
ctxevent context
Returns
Tile ADC status

Definition at line 120 of file TileBadChanTool.cxx.

120 {
121
122 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
123 return badChannels->getAdcStatus(adc_id);
124
125}

◆ getAdcStatus() [2/3]

const TileBchStatus & TileBadChanTool::getAdcStatus ( IdentifierHash hash_id,
unsigned int adc ) const

Definition at line 130 of file TileBadChanTool.cxx.

130 {
131
132 if (hash_id != TileHWID::NOT_VALID_HASH) {
133 HWIdentifier adc_id = m_tileHWID->adc_id(hash_id, adc);
134
135 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey);
136 return badChannels->getAdcStatus(adc_id);
137 } else {
138 return m_defaultStatus;
139 }
140
141}

◆ getAdcStatus() [3/3]

const TileBchStatus & TileBadChanTool::getAdcStatus ( unsigned int drawerIdx,
unsigned int channel,
unsigned int adc,
const EventContext & ctx ) const
overridevirtual

Return Tile ADC status.

Parameters
drawerIdxTile drawer index in range [0..275]
channelTile channel number in range [0..47]
adcTile ADC number
ctxevent context
Returns
Tile ADC status

Definition at line 184 of file TileBadChanTool.cxx.

184 {
185
186 HWIdentifier adc_id = m_tileHWID->adc_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel, adc);
187
188 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
189 return badChannels->getAdcStatus(adc_id);
190
191}
std::vector< unsigned int > m_roses
std::vector< unsigned int > m_drawers

◆ getChannelStatus() [1/3]

const TileBchStatus & TileBadChanTool::getChannelStatus ( const HWIdentifier & channel_id,
const EventContext & ctx ) const
overridevirtual

Return Tile channel status.

Parameters
channel_idTile hardware (online) channel identifier
ctxevent context
Returns
Tile channel status

Definition at line 162 of file TileBadChanTool.cxx.

162 {
163
164 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
165 return badChannels->getChannelStatus(channel_id);
166
167}

◆ getChannelStatus() [2/3]

const TileBchStatus & TileBadChanTool::getChannelStatus ( IdentifierHash hash_id) const

Definition at line 146 of file TileBadChanTool.cxx.

146 {
147
148 if (hash_id != TileHWID::NOT_VALID_HASH) {
149 HWIdentifier channel_id = m_tileHWID->channel_id(hash_id);
150
151 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey);
152 return badChannels->getChannelStatus(channel_id);
153 } else {
154 return m_defaultStatus;
155 }
156
157}

◆ getChannelStatus() [3/3]

const TileBchStatus & TileBadChanTool::getChannelStatus ( unsigned int drawerIdx,
unsigned int channel,
const EventContext & ctx ) const
overridevirtual

Return Tile channel status.

Parameters
drawerIdxTile drawer index in range [0..275]
channelTile channel number in range [0..47]
ctxevent context
Returns
Tile channel status

Definition at line 172 of file TileBadChanTool.cxx.

172 {
173
174 HWIdentifier channel_id = m_tileHWID->channel_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel);
175
176 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
177 return badChannels->getChannelStatus(channel_id);
178
179}

◆ getTripsProbabilities()

const std::vector< float > & TileBadChanTool::getTripsProbabilities ( unsigned int ros,
const EventContext & ctx ) const
overridevirtual

Return trips probabilities for all Tile drawers.

Parameters
ctxevent context
Returns
Trip probabilites for all Tile drawers

Definition at line 199 of file TileBadChanTool.cxx.

199 {
200
201 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
202
203 const std::vector<std::vector<float>>& tripsProbs = badChannels->getTripsProbabilities();
204
205 if (!tripsProbs.empty()) {
206 return tripsProbs.at(ros - 1);
207 }
208
209 return m_defaultTripsProbs;
210}
std::vector< float > m_defaultTripsProbs

◆ initialize()

StatusCode TileBadChanTool::initialize ( )
overridevirtual

Definition at line 41 of file TileBadChanTool.cxx.

41 {
42 ATH_MSG_DEBUG( "in initialize()" );
43
44 //=== Initialize bad channels key
45 ATH_CHECK( m_badChannelsKey.initialize() );
46
47 //=== TileDetDescrManager
48 ATH_CHECK( detStore()->retrieve(m_tileMgr) );
49
50 //=== TileDetDescrManager
51 ATH_CHECK( detStore()->retrieve(m_tileHWID) );
52
55
56 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
57 for (unsigned int drawer = 0; drawer < TileCalibUtils::getMaxDrawer(ros); ++drawer) {
58 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
59 m_roses[drawerIdx] = ros;
60 m_drawers[drawerIdx] = drawer;
61 }
62 }
63
64
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
static const unsigned int MAX_DRAWERIDX
Maximal drawer index.
static const unsigned int MAX_ROS
Number of ROSs.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.

◆ isDrawerMasked()

bool TileBadChanTool::isDrawerMasked ( unsigned int frag_id,
const EventContext & ctx ) const
overridevirtual

Check if Tile drawer is masked completely.

Parameters
frag_idTile frag identifier
ctxevent context
Returns
True if Tile drawer is masked comletely

Definition at line 212 of file TileBadChanTool.cxx.

212 {
213
214 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
215 const std::vector<int>& maskedDrawers = badChannels->getMaskedDrawers();
216
217 return std::binary_search (maskedDrawers.begin(),
218 maskedDrawers.end(),
219 frag_id);
220}

◆ operator=()

TileBadChanTool & TileBadChanTool::operator= ( const TileBadChanTool & )
private

Member Data Documentation

◆ m_badChannelsKey

SG::ReadCondHandleKey<TileBadChannels> TileBadChanTool::m_badChannelsKey
private
Initial value:
{this,
"TileBadChannels", "TileBadChannels", "Input Tile bad channel status"}

Name of TileBadChannels in condition store.

Definition at line 107 of file TileBadChanTool.h.

107 {this,
108 "TileBadChannels", "TileBadChannels", "Input Tile bad channel status"};

◆ m_defaultStatus

TileBchStatus TileBadChanTool::m_defaultStatus {}
private

Definition at line 113 of file TileBadChanTool.h.

113{};

◆ m_defaultTripsProbs

std::vector<float> TileBadChanTool::m_defaultTripsProbs = std::vector<float>(TileCalibUtils::MAX_DRAWER, 0.0F)
private

Definition at line 118 of file TileBadChanTool.h.

◆ m_drawers

std::vector<unsigned int> TileBadChanTool::m_drawers
private

Definition at line 121 of file TileBadChanTool.h.

◆ m_roses

std::vector<unsigned int> TileBadChanTool::m_roses
private

Definition at line 120 of file TileBadChanTool.h.

◆ m_tileHWID

const TileHWID* TileBadChanTool::m_tileHWID {nullptr}
private

Definition at line 112 of file TileBadChanTool.h.

112{nullptr};

◆ m_tileMgr

const TileDetDescrManager* TileBadChanTool::m_tileMgr {nullptr}
private

Definition at line 110 of file TileBadChanTool.h.

110{nullptr};

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