ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
virtual const TileBchStatusgetAdcStatus (const HWIdentifier &adc_id) const override
 Return Tile ADC status. More...
 
virtual const TileBchStatusgetAdcStatus (unsigned int drawerIdx, unsigned int channel, unsigned int adc, const EventContext &ctx) const override
 Return Tile ADC status. More...
 
virtual const TileBchStatusgetAdcStatus (unsigned int drawerIdx, unsigned int channel, unsigned int adc) const override
 Return Tile ADC status. More...
 
const TileBchStatusgetChannelStatus (IdentifierHash hash_id) const
 
virtual const TileBchStatusgetChannelStatus (const HWIdentifier &channel_id, const EventContext &ctx) const override
 Return Tile channel status. More...
 
virtual const TileBchStatusgetChannelStatus (const HWIdentifier &channel_id) const override
 Return Tile channel status. More...
 
virtual const TileBchStatusgetChannelStatus (unsigned int drawerIdx, unsigned int channel, const EventContext &ctx) const override
 Return Tile channel status. More...
 
virtual const TileBchStatusgetChannelStatus (unsigned int drawerIdx, unsigned int channel) const override
 Return Tile channel status. More...
 
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. More...
 
virtual const std::vector< float > & getTripsProbabilities (unsigned int ros) const override
 Return trips probabilities for all Tile drawers. More...
 
virtual bool isDrawerMasked (unsigned int frag_id, const EventContext &ctx) const override
 Check if Tile drawer is masked completely. More...
 
virtual bool isDrawerMasked (unsigned int frag_id) const override
 Check if Tile drawer is masked completely. More...
 
virtual CaloBadChannel caloStatus (const EventContext &ctx, Identifier id) const=0
 ICaloBadChanTool interface. More...
 
virtual CaloBadChannel caloStatus (Identifier id) const
 ICaloBadChanTool interface. More...
 

Private Member Functions

TileBadChanTooloperator= (const TileBadChanTool &)
 

Private Attributes

SG::ReadCondHandleKey< TileBadChannelsm_badChannelsKey
 Name of TileBadChannels in condition store. More...
 
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 }

◆ ~TileBadChanTool()

TileBadChanTool::~TileBadChanTool ( )
virtual

Definition at line 39 of file TileBadChanTool.cxx.

39  {
40 
41 }

Member Function Documentation

◆ caloStatus() [1/3]

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

◆ caloStatus() [2/3]

virtual CaloBadChannel ICaloBadChanTool::caloStatus

ICaloBadChanTool interface.

Parameters
cell_idCalo cell identifier

◆ caloStatus() [3/3]

virtual CaloBadChannel ICaloBadChanTool::caloStatus
inline

ICaloBadChanTool interface.

Parameters
cell_idCalo cell identifier

Definition at line 23 of file ICaloBadChanTool.h.

24  {
25  return caloStatus(Gaudi::Hive::currentContext(), id);
26  }

◆ encodeStatus()

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

Definition at line 239 of file TileBadChanTool.cxx.

239  {
241 }

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

◆ getAdcStatus() [1/5]

const TileBchStatus & TileBadChanTool::getAdcStatus ( const HWIdentifier adc_id) const
overridevirtual

Return Tile ADC status.

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

Definition at line 135 of file TileBadChanTool.cxx.

135  {
136 
137  const EventContext& ctx{Gaudi::Hive::currentContext()};
138  return getAdcStatus(adc_id, ctx);
139 
140 }

◆ getAdcStatus() [2/5]

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 
128  return badChannels->getAdcStatus(adc_id);
129 
130 }

◆ getAdcStatus() [3/5]

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

Definition at line 145 of file TileBadChanTool.cxx.

145  {
146 
147  if (hash_id != TileHWID::NOT_VALID_HASH) {
148  HWIdentifier adc_id = m_tileHWID->adc_id(hash_id, adc);
149 
151  return badChannels->getAdcStatus(adc_id);
152  } else {
153  return m_defaultStatus;
154  }
155 
156 }

◆ getAdcStatus() [4/5]

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

Return Tile ADC status.

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

Definition at line 231 of file TileBadChanTool.cxx.

231  {
232 
233  const EventContext& ctx{Gaudi::Hive::currentContext()};
234  return getAdcStatus(drawerIdx, channel, adc, ctx);
235 
236 }

◆ getAdcStatus() [5/5]

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

219  {
220 
221  HWIdentifier adc_id = m_tileHWID->adc_id(m_roses[drawerIdx], m_drawers[drawerIdx], channel, adc);
222 
224  return badChannels->getAdcStatus(adc_id);
225 
226 }

◆ getChannelStatus() [1/5]

const TileBchStatus & TileBadChanTool::getChannelStatus ( const HWIdentifier channel_id) const
overridevirtual

Return Tile channel status.

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

Definition at line 187 of file TileBadChanTool.cxx.

187  {
188 
189  const EventContext& ctx{Gaudi::Hive::currentContext()};
190  return getChannelStatus(channel_id, ctx);
191 
192 }

◆ getChannelStatus() [2/5]

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

177  {
178 
180  return badChannels->getChannelStatus(channel_id);
181 
182 }

◆ getChannelStatus() [3/5]

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

Definition at line 161 of file TileBadChanTool.cxx.

161  {
162 
163  if (hash_id != TileHWID::NOT_VALID_HASH) {
165 
167  return badChannels->getChannelStatus(channel_id);
168  } else {
169  return m_defaultStatus;
170  }
171 
172 }

◆ getChannelStatus() [4/5]

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

Return Tile channel status.

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

Definition at line 209 of file TileBadChanTool.cxx.

209  {
210 
211  const EventContext& ctx{Gaudi::Hive::currentContext()};
212  return getChannelStatus(drawerIdx, channel, ctx);
213 
214 }

◆ getChannelStatus() [5/5]

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

197  {
198 
200 
202  return badChannels->getChannelStatus(channel_id);
203 
204 }

◆ getTripsProbabilities() [1/2]

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

Return trips probabilities for all Tile drawers.

Returns
Trip probabilites for all Tile drawers

Definition at line 256 of file TileBadChanTool.cxx.

256  {
257 
258  const EventContext& ctx{Gaudi::Hive::currentContext()};
259  return getTripsProbabilities(ros, ctx);
260 
261 }

◆ getTripsProbabilities() [2/2]

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

243  {
244 
246 
247  const std::vector<std::vector<float>>& tripsProbs = badChannels->getTripsProbabilities();
248 
249  if (!tripsProbs.empty()) {
250  return tripsProbs.at(ros - 1);
251  }
252 
253  return m_defaultTripsProbs;
254 }

◆ 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
51 
52  //=== TileDetDescrManager
54 
55  //=== TileDetDescrManager
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 }

◆ isDrawerMasked() [1/2]

bool TileBadChanTool::isDrawerMasked ( unsigned int  frag_id) const
overridevirtual

Check if Tile drawer is masked completely.

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

Definition at line 274 of file TileBadChanTool.cxx.

274  {
275 
276  const EventContext& ctx{Gaudi::Hive::currentContext()};
277  return isDrawerMasked(frag_id, ctx);
278 
279 }

◆ isDrawerMasked() [2/2]

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

264  {
265 
267  const std::vector<int>& maskedDrawers = badChannels->getMaskedDrawers();
268 
269  return std::binary_search (maskedDrawers.begin(),
270  maskedDrawers.end(),
271  frag_id);
272 }

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

◆ m_defaultStatus

TileBchStatus TileBadChanTool::m_defaultStatus
private

Definition at line 143 of file TileBadChanTool.h.

◆ m_defaultTripsProbs

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

Definition at line 148 of file TileBadChanTool.h.

◆ m_drawers

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

Definition at line 151 of file TileBadChanTool.h.

◆ m_roses

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

Definition at line 150 of file TileBadChanTool.h.

◆ m_tileHWID

const TileHWID* TileBadChanTool::m_tileHWID
private

Definition at line 142 of file TileBadChanTool.h.

◆ m_tileMgr

const TileDetDescrManager* TileBadChanTool::m_tileMgr
private

Definition at line 140 of file TileBadChanTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloDetDescrElement::onl2
IdentifierHash onl2() const
cell online identifier 2
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:408
TileBadChanTool::caloStatus
virtual CaloBadChannel caloStatus(const EventContext &ctx, Identifier cell_id) const override
Definition: TileBadChanTool.cxx:85
TileCalibUtils::getMaxDrawer
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
Definition: TileCalibUtils.cxx:136
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
TileCalibUtils::MAX_DRAWERIDX
static const unsigned int MAX_DRAWERIDX
Maximal drawer index
Definition: TileCalibUtils.h:143
TileBadChanTool::isDrawerMasked
virtual bool isDrawerMasked(unsigned int frag_id, const EventContext &ctx) const override
Check if Tile drawer is masked completely.
Definition: TileBadChanTool.cxx:264
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
TileBchStatus
Class holding bad channel problems.
Definition: TileBchStatus.h:20
CaloBadChannel::deadBit
@ deadBit
Definition: CaloBadChannel.h:14
TileBadChanTool::getTripsProbabilities
virtual const std::vector< float > & getTripsProbabilities(unsigned int ros, const EventContext &ctx) const override
Return trips probabilities for all Tile drawers.
Definition: TileBadChanTool.cxx:243
CaloBadChannel::affectedBit
@ affectedBit
Definition: CaloBadChannel.h:14
HWIdentifier
Definition: HWIdentifier.h:13
TileBadChanTool::getAdcStatus
const TileBchStatus & getAdcStatus(IdentifierHash hash_id, unsigned int adc) const
Definition: TileBadChanTool.cxx:145
TileBadChanTool::m_drawers
std::vector< unsigned int > m_drawers
Definition: TileBadChanTool.h:151
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileCalibUtils::MAX_DRAWER
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
Definition: TileCalibUtils.h:139
CaloDetDescrElement::onl1
IdentifierHash onl1() const
cell online identifier 1
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:404
TileBadChanTool::getChannelStatus
const TileBchStatus & getChannelStatus(IdentifierHash hash_id) const
Definition: TileBadChanTool.cxx:161
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TileBadChanTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileBadChanTool.h:142
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileBadChannels::encodeStatus
static uint32_t encodeStatus(const TileBchStatus &status)
Definition: TileBadChannels.cxx:52
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
createCoolChannelIdFile.channel_id
channel_id
Definition: createCoolChannelIdFile.py:52
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileBchStatus::isAffected
bool isAffected() const
Definition: TileBchStatus.h:137
CaloBadChannel::BitWord
unsigned int BitWord
Definition: CaloBadChannel.h:12
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileBadChanTool::m_tileMgr
const TileDetDescrManager * m_tileMgr
Definition: TileBadChanTool.h:140
TileCalibUtils::MAX_ROS
static const unsigned int MAX_ROS
Number of ROSs
Definition: TileCalibUtils.h:138
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileDetDescrManager::get_cell_element
CaloDetDescrElement * get_cell_element(unsigned int cell_hash) const
Definition: TileDetDescrManager.h:156
TileHWID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: TileHWID.h:314
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileHWID::channel_id
HWIdentifier channel_id(int ros, int drawer, int channel) const
channel HWIdentifer
Definition: TileHWID.cxx:199
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TileBadChanTool::m_roses
std::vector< unsigned int > m_roses
Definition: TileBadChanTool.h:150
TileBadChanTool::m_defaultTripsProbs
std::vector< float > m_defaultTripsProbs
Definition: TileBadChanTool.h:148
CaloBadChannel::setBit
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".
Definition: CaloBadChannel.h:38
TileHWID::adc_id
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
Definition: TileHWID.cxx:229
TileBadChanTool::m_badChannelsKey
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
Definition: TileBadChanTool.h:137
python.Classes.TileBchStatus
TileBchStatus
Definition: TileCalib/TileCalibBlobObjs/python/Classes.py:16
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
F
#define F(x, y, z)
Definition: MD5.cxx:112
CaloBadChannel
Definition: CaloBadChannel.h:8
merge.status
status
Definition: merge.py:17
TileCalibUtils::getDrawerIdx
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Definition: TileCalibUtils.cxx:60
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TileBadChanTool::m_defaultStatus
TileBchStatus m_defaultStatus
Definition: TileBadChanTool.h:143
TileBchStatus::isBad
bool isBad() const
Definition: TileBchStatus.h:145