ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
LArFebConfig Class Reference

#include <LArFebConfig.h>

Inheritance diagram for LArFebConfig:
Collaboration diagram for LArFebConfig:

Public Member Functions

 LArFebConfig ()=delete
 
 LArFebConfig (const LArOnlineID *onlineId)
 
void add (HWIdentifier febid, const coral::AttributeList *attrList)
 
short lowerGainThreshold (const HWIdentifier &id) const
 
short upperGainThreshold (const HWIdentifier &id) const
 
void thresholds (const HWIdentifier &chid, short &lower, short &upper) const
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Types

enum  { ERRORCODE = LArElecCalib::ERRORCODE }
 

Private Member Functions

const coral::AttributeList * getAttrList (const HWIdentifier &chid, int &channel) const
 
short getThresholdFromAttrList (const std::string &MedLow, const coral::AttributeList *attrList, const std::string &chanstr) const
 
short getThreshold (const std::string &MedLow, const HWIdentifier &chid) const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

const LArOnlineIDm_onlineID
 
std::unordered_map< HWIdentifier::value_type, const coral::AttributeList * > m_attrPerFeb
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Static Private Attributes

static const std::string s_lower = "lower"
 
static const std::string s_upper = "upper"
 

Detailed Description

Definition at line 16 of file LArFebConfig.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ERRORCODE 

Definition at line 46 of file LArFebConfig.h.

Constructor & Destructor Documentation

◆ LArFebConfig() [1/2]

LArFebConfig::LArFebConfig ( )
delete

◆ LArFebConfig() [2/2]

LArFebConfig::LArFebConfig ( const LArOnlineID onlineId)

Definition at line 14 of file LArFebConfig.cxx.

14  :
15  AthMessaging(Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc" ),"LArFebConfig"),
16  m_onlineID(onlineId)
17 
18 { }

Member Function Documentation

◆ add()

void LArFebConfig::add ( HWIdentifier  febid,
const coral::AttributeList *  attrList 
)

Definition at line 21 of file LArFebConfig.cxx.

23 {
24  m_attrPerFeb[febid.get_compact()] = attrList;
25 }

◆ getAttrList()

const coral::AttributeList * LArFebConfig::getAttrList ( const HWIdentifier chid,
int &  channel 
) const
private

Definition at line 46 of file LArFebConfig.cxx.

48 {
49  if (m_attrPerFeb.empty()) {
50  ATH_MSG_WARNING("FEB threshold cache is empty");
51  return nullptr;
52  }
53 
54  const HWIdentifier fid=m_onlineID->feb_Id(chid);
55  channel = m_onlineID->channel(chid);
56  auto it = m_attrPerFeb.find(fid.get_compact());
57  if (it == m_attrPerFeb.end()) {
58  ATH_MSG_DEBUG("Such FEB was not found !");
59  return nullptr;
60  }
61  return it->second;
62 }

◆ getThreshold()

short LArFebConfig::getThreshold ( const std::string &  MedLow,
const HWIdentifier chid 
) const
private

Definition at line 75 of file LArFebConfig.cxx.

77 {
78  int channel = 0;
79  const coral::AttributeList* attrList = getAttrList (chid, channel);
80  if (attrList == nullptr) {
81  return ERRORCODE;
82  }
83  std::string chanstr = std::to_string(channel+1);
84  return getThresholdFromAttrList (MedLow, attrList, chanstr);
85 }

◆ getThresholdFromAttrList()

short LArFebConfig::getThresholdFromAttrList ( const std::string &  MedLow,
const coral::AttributeList *  attrList,
const std::string &  chanstr 
) const
private

Definition at line 66 of file LArFebConfig.cxx.

69 {
70  std::string channame = MedLow + chanstr;
71  return (short)(*attrList)[channame].data<int32_t>(); //Will throw and exception if channel does not exist
72 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ lowerGainThreshold()

short LArFebConfig::lowerGainThreshold ( const HWIdentifier id) const
inline

Definition at line 50 of file LArFebConfig.h.

50  {
51  return getThreshold(s_lower, chid);
52 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ thresholds()

void LArFebConfig::thresholds ( const HWIdentifier chid,
short &  lower,
short &  upper 
) const

Definition at line 28 of file LArFebConfig.cxx.

31 {
32  int channel = 0;
33  const coral::AttributeList* attrList = getAttrList (chid, channel);
34  if (attrList == nullptr) {
35  lower = ERRORCODE;
36  upper = ERRORCODE;
37  return;
38  }
39  std::string chanstr = std::to_string(channel+1);
40  lower = getThresholdFromAttrList (s_lower, attrList, chanstr);
41  upper = getThresholdFromAttrList (s_upper, attrList, chanstr);
42 }

◆ upperGainThreshold()

short LArFebConfig::upperGainThreshold ( const HWIdentifier id) const
inline

Definition at line 55 of file LArFebConfig.h.

55  {
56  return getThreshold(s_upper,chid);
57 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_attrPerFeb

std::unordered_map<HWIdentifier::value_type,const coral::AttributeList*> LArFebConfig::m_attrPerFeb
private

Definition at line 33 of file LArFebConfig.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_onlineID

const LArOnlineID* LArFebConfig::m_onlineID
private

Definition at line 31 of file LArFebConfig.h.

◆ s_lower

const std::string LArFebConfig::s_lower = "lower"
staticprivate

Definition at line 43 of file LArFebConfig.h.

◆ s_upper

const std::string LArFebConfig::s_upper = "upper"
staticprivate

Definition at line 44 of file LArFebConfig.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
LArFebConfig::s_upper
static const std::string s_upper
Definition: LArFebConfig.h:44
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LArElecCalib::ERRORCODE
@ ERRORCODE
Definition: LArCalibErrorCode.h:17
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Identifier::get_compact
value_type get_compact() const
Get the compact id.
upper
int upper(int c)
Definition: LArBadChannelParser.cxx:49
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
HWIdentifier
Definition: HWIdentifier.h:13
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
LArFebConfig::ERRORCODE
@ ERRORCODE
Definition: LArFebConfig.h:46
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
LArFebConfig::getThreshold
short getThreshold(const std::string &MedLow, const HWIdentifier &chid) const
Definition: LArFebConfig.cxx:75
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1963
PlotCalibFromCool.channame
channame
Definition: PlotCalibFromCool.py:278
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArFebConfig::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArFebConfig.h:31
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1479
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
LArFebConfig::m_attrPerFeb
std::unordered_map< HWIdentifier::value_type, const coral::AttributeList * > m_attrPerFeb
Definition: LArFebConfig.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
LArFebConfig::getAttrList
const coral::AttributeList * getAttrList(const HWIdentifier &chid, int &channel) const
Definition: LArFebConfig.cxx:46
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
LArFebConfig::s_lower
static const std::string s_lower
Definition: LArFebConfig.h:43
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
LArFebConfig::getThresholdFromAttrList
short getThresholdFromAttrList(const std::string &MedLow, const coral::AttributeList *attrList, const std::string &chanstr) const
Definition: LArFebConfig.cxx:66