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 TileBchStatusgetAdcStatus (IdentifierHash hash_id, unsigned int adc) const
virtual const TileBchStatusgetAdcStatus (const HWIdentifier &adc_id, const EventContext &ctx) const override
 Return Tile ADC status.
virtual const TileBchStatusgetAdcStatus (unsigned int drawerIdx, unsigned int channel, unsigned int adc, const EventContext &ctx) const override
 Return Tile ADC status.
const TileBchStatusgetChannelStatus (IdentifierHash hash_id) const
virtual const TileBchStatusgetChannelStatus (const HWIdentifier &channel_id, const EventContext &ctx) const override
 Return Tile channel status.
virtual const TileBchStatusgetChannelStatus (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

TileBadChanTooloperator= (const TileBadChanTool &)

Private Attributes

SG::ReadCondHandleKey< TileBadChannelsm_badChannelsKey
 Name of TileBadChannels in condition store.
const TileDetDescrManagerm_tileMgr
const TileHWIDm_tileHWID
TileBchStatus m_defaultStatus
std::vector< float > m_defaultTripsProbs
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 36 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 , m_tileMgr(nullptr)
30 , m_tileHWID(nullptr)
33{
34
35}
const TileHWID * m_tileHWID
TileBchStatus m_defaultStatus
std::vector< float > m_defaultTripsProbs
const TileDetDescrManager * m_tileMgr
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.

◆ ~TileBadChanTool()

TileBadChanTool::~TileBadChanTool ( )
virtual

Definition at line 39 of file TileBadChanTool.cxx.

39 {
40
41}

Member Function Documentation

◆ caloStatus()

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

Definition at line 85 of file TileBadChanTool.cxx.

86{
87
89
90 //=== get the TileHWIDs of the two channels connected to the caloCellnxs id
91 const CaloDetDescrElement* elem = m_tileMgr->get_cell_element(cell_id);
92
93 if (!elem) {
94 //=== this should never happen
95 ATH_MSG_ERROR( "CaloMgr returns NULL CaloDetDescrElement" );
96 std::abort();
97 }
98
99 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey,ctx);
100
101 IdentifierHash hash1_id(elem->onl1());
102 IdentifierHash hash2_id(elem->onl2());
103
104 //=== status of 1. connected channel
105 TileBchStatus channel1_status = (hash1_id != TileHWID::NOT_VALID_HASH) ?
106 badChannels->getChannelStatus(m_tileHWID->channel_id(hash1_id)) : m_defaultStatus;
107
108 //=== status of 2. connected channel
109 TileBchStatus channel2_status = (hash2_id != TileHWID::NOT_VALID_HASH) ?
110 badChannels->getChannelStatus(m_tileHWID->channel_id(hash2_id)) : m_defaultStatus;
111
112 //=== set cell status depending on channel status
113 if (channel1_status.isBad() && channel2_status.isBad()) {
115 } else if (channel1_status.isAffected() || channel2_status.isAffected()) {
117 }
118
119 return CaloBadChannel(res);
120}
#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".
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
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 200 of file TileBadChanTool.cxx.

200 {
201 return TileBadChannels::encodeStatus(status);
202}
static uint32_t encodeStatus(const TileBchStatus &status)

◆ finalize()

StatusCode TileBadChanTool::finalize ( )
overridevirtual

Definition at line 75 of file TileBadChanTool.cxx.

75 {
76
77 ATH_MSG_DEBUG( "finalize called" );
78 return StatusCode::SUCCESS;
79
80}
#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 125 of file TileBadChanTool.cxx.

125 {
126
127 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
128 return badChannels->getAdcStatus(adc_id);
129
130}

◆ getAdcStatus() [2/3]

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

Definition at line 135 of file TileBadChanTool.cxx.

135 {
136
137 if (hash_id != TileHWID::NOT_VALID_HASH) {
138 HWIdentifier adc_id = m_tileHWID->adc_id(hash_id, adc);
139
140 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey);
141 return badChannels->getAdcStatus(adc_id);
142 } else {
143 return m_defaultStatus;
144 }
145
146}

◆ 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 189 of file TileBadChanTool.cxx.

189 {
190
191 HWIdentifier adc_id = m_tileHWID->adc_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel, adc);
192
193 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
194 return badChannels->getAdcStatus(adc_id);
195
196}
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 167 of file TileBadChanTool.cxx.

167 {
168
169 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
170 return badChannels->getChannelStatus(channel_id);
171
172}

◆ getChannelStatus() [2/3]

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

Definition at line 151 of file TileBadChanTool.cxx.

151 {
152
153 if (hash_id != TileHWID::NOT_VALID_HASH) {
154 HWIdentifier channel_id = m_tileHWID->channel_id(hash_id);
155
156 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey);
157 return badChannels->getChannelStatus(channel_id);
158 } else {
159 return m_defaultStatus;
160 }
161
162}

◆ 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 177 of file TileBadChanTool.cxx.

177 {
178
179 HWIdentifier channel_id = m_tileHWID->channel_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel);
180
181 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
182 return badChannels->getChannelStatus(channel_id);
183
184}

◆ 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 204 of file TileBadChanTool.cxx.

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

◆ initialize()

StatusCode TileBadChanTool::initialize ( )
overridevirtual

Definition at line 46 of file TileBadChanTool.cxx.

46 {
47 ATH_MSG_DEBUG( "in initialize()" );
48
49 //=== Initialize bad channels key
50 ATH_CHECK( m_badChannelsKey.initialize() );
51
52 //=== TileDetDescrManager
53 ATH_CHECK( detStore()->retrieve(m_tileMgr) );
54
55 //=== TileDetDescrManager
56 ATH_CHECK( detStore()->retrieve(m_tileHWID) );
57
60
61 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
62 for (unsigned int drawer = 0; drawer < TileCalibUtils::getMaxDrawer(ros); ++drawer) {
63 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
64 m_roses[drawerIdx] = ros;
65 m_drawers[drawerIdx] = drawer;
66 }
67 }
68
69
70 return StatusCode::SUCCESS;
71}
#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 217 of file TileBadChanTool.cxx.

217 {
218
219 SG::ReadCondHandle<TileBadChannels> badChannels(m_badChannelsKey, ctx);
220 const std::vector<int>& maskedDrawers = badChannels->getMaskedDrawers();
221
222 return std::binary_search (maskedDrawers.begin(),
223 maskedDrawers.end(),
224 frag_id);
225}

◆ 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 106 of file TileBadChanTool.h.

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

◆ m_defaultStatus

TileBchStatus TileBadChanTool::m_defaultStatus
private

Definition at line 112 of file TileBadChanTool.h.

◆ m_defaultTripsProbs

std::vector<float> TileBadChanTool::m_defaultTripsProbs
private

Definition at line 117 of file TileBadChanTool.h.

◆ m_drawers

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

Definition at line 120 of file TileBadChanTool.h.

◆ m_roses

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

Definition at line 119 of file TileBadChanTool.h.

◆ m_tileHWID

const TileHWID* TileBadChanTool::m_tileHWID
private

Definition at line 111 of file TileBadChanTool.h.

◆ m_tileMgr

const TileDetDescrManager* TileBadChanTool::m_tileMgr
private

Definition at line 109 of file TileBadChanTool.h.


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