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

#include <LArOFCSC.h>

Inheritance diagram for LArOFCSC:
Collaboration diagram for LArOFCSC:

Public Types

enum  { ERRORCODE = LArElecCalib::ERRORCODE }
 
typedef ILArOFC::OFCRef_t OFCRef_t
 

Public Member Functions

 LArOFCSC (const CondAttrListCollection *attrList)
 
virtual ~LArOFCSC ()
 
bool good () const
 
virtual OFCRef_t OFC_a (const HWIdentifier &CellID, int gain, int tbin=0) const
 access to OFCs by online ID, gain, and tbin (!=0 for testbeam) More...
 
virtual OFCRef_t OFC_b (const HWIdentifier &CellID, int gain, int tbin=0) const
 
OFCRef_t OFC_a (const IdentifierHash &hs, int gain) const
 
OFCRef_t OFC_b (const IdentifierHash &hs, int gain) const
 
virtual float timeOffset (const HWIdentifier &CellID, int gain) const
 
virtual unsigned nTimeBins (const HWIdentifier &CellID, int gain) const
 
virtual float timeBinWidth (const HWIdentifier &CellID, int gain) const
 
StatusCode initializeBase ()
 
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...
 

Protected Attributes

bool m_isInitialized
 
const LArOnline_SuperCellIDm_scOnlineID
 

Private Member Functions

 LArOFCSC ()
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::vector< const float * > m_pOFCa
 
std::vector< const float * > m_pOFCb
 
std::vector< const float * > m_pTimeOffset
 
unsigned m_nChannels
 
unsigned m_nSamples
 
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...
 

Detailed Description

Definition at line 18 of file LArOFCSC.h.

Member Typedef Documentation

◆ OFCRef_t

Definition at line 24 of file LArOFCSC.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ERRORCODE 

Definition at line 25 of file LArOFCSC.h.

Constructor & Destructor Documentation

◆ LArOFCSC() [1/2]

LArOFCSC::LArOFCSC ( )
private

Definition at line 9 of file LArOFCSC.cxx.

9  :
10  LArCondSuperCellBase("LArOFCSC"),
11  m_nChannels(0),
12  m_nSamples(0)
13 {
14 }

◆ LArOFCSC() [2/2]

LArOFCSC::LArOFCSC ( const CondAttrListCollection attrList)

Definition at line 19 of file LArOFCSC.cxx.

19  :
20  LArCondSuperCellBase("LArOFCSC"),
21  m_nChannels(0),
22  m_nSamples(0)
23 {
24 
25  if (initializeBase().isFailure()) return;
26 
27  if (!attrList) return;
28 
30  CondAttrListCollection::const_iterator gainIt_e=attrList->end();
31 
32  m_pOFCa.resize(attrList->size());
33  m_pOFCb.resize(attrList->size());
34  m_pTimeOffset.resize(attrList->size());
35  ATH_MSG_DEBUG( "Found data for " << attrList->size() << " gains.");
36 
37  int blobSize=0; //FIXME Force size to hash-max??? m_scOnlineID->channelHashMax()
38 
39  m_nSamples=0;
40 
41  for(;gainIt!=gainIt_e;++gainIt) {
42  const unsigned gain=gainIt->first;
43  if (gain>=attrList->size() || gain>2) {
44  ATH_MSG_ERROR("Found unexpected COOL-channel (=gain) number:" << gain);
45  return; //ERROR
46  }
47  const coral::AttributeList& attr=gainIt->second;
48  const coral::Blob& ofcaBlob = attr["OFCa"].data<coral::Blob>();
49  const coral::Blob& ofcbBlob = attr["OFCb"].data<coral::Blob>();
50  const coral::Blob& toBlob = attr["TimeOffset"].data<coral::Blob>();
51  if (blobSize==0) blobSize=ofcaBlob.size();
52  if (m_nSamples==0) m_nSamples=attr["nSamples"].data<unsigned>();
53 
54  //Sanity checks:
55  if (blobSize!=ofcaBlob.size() || blobSize!=ofcbBlob.size()) {
56  ATH_MSG_ERROR("Unequal blob size (" << blobSize << "/"
57  << ofcaBlob.size() << "/" << ofcbBlob.size() << ")");
58  return;
59  }
60  if (m_nSamples!=attr["nSamples"].data<unsigned>()) {
61  ATH_MSG_ERROR("Unequal number of samples (" << m_nSamples << "/"
62  << attr["nSamples"].data<unsigned>() << ")");
63  return;
64  }
65 
66 
67  m_pOFCa[gain]=static_cast<const float*>(ofcaBlob.startingAddress());
68  m_pOFCb[gain]=static_cast<const float*>(ofcbBlob.startingAddress());
69  m_pTimeOffset[gain]=static_cast<const float*>(toBlob.startingAddress());
70  }// end loop over COOL channels
71 
72  if (m_nSamples==0) {
73  ATH_MSG_ERROR("Number of samples is zero!");
74  return;
75  }
76  m_nChannels=blobSize/(sizeof(float)*m_nSamples);
77  ATH_MSG_DEBUG("Found data for " << m_nChannels);
78 }

◆ ~LArOFCSC()

LArOFCSC::~LArOFCSC ( )
virtual

Definition at line 16 of file LArOFCSC.cxx.

16 {}

Member Function Documentation

◆ good()

bool LArOFCSC::good ( ) const
inline

Definition at line 30 of file LArOFCSC.h.

30 { return m_isInitialized && m_nChannels>0; }

◆ initializeBase()

StatusCode LArCondSuperCellBase::initializeBase ( )
inherited

Definition at line 22 of file LArCondSuperCellBase.cxx.

22  {
23 
24  ATH_MSG_DEBUG( "initializeBase " );
25 
26  if (m_isInitialized) {
27  ATH_MSG_DEBUG( "already initialized - returning " );
28  return (StatusCode::SUCCESS);
29  }
30  //Get SuperCellID ...
31  SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
32  ATH_CHECK_WITH_CONTEXT( detStore.isValid(), "LArCondSuperCellBase" );
33  ATH_CHECK_WITH_CONTEXT( detStore->retrieve( m_scOnlineID,"LArOnline_SuperCellID"), "LArCondSuperCellBase" );
34 
35  m_isInitialized = true;
36  ATH_MSG_DEBUG( "end initializeBase " );
37  return (StatusCode::SUCCESS);
38 }

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

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

◆ nTimeBins()

unsigned LArOFCSC::nTimeBins ( const HWIdentifier CellID,
int  gain 
) const
virtual

Implements ILArOFC.

Definition at line 96 of file LArOFCSC.cxx.

96  {
97  return 1;
98 }

◆ OFC_a() [1/2]

LArOFCSC::OFCRef_t LArOFCSC::OFC_a ( const HWIdentifier id,
int  gain,
int  tbin = 0 
) const
virtual

access to OFCs by online ID, gain, and tbin (!=0 for testbeam)

Implements ILArOFC.

Definition at line 80 of file LArOFCSC.cxx.

80  {
81  if (tbin!=0) return OFCRef_t(nullptr,nullptr);
82  return this->OFC_a(m_scOnlineID->channel_Hash(onId),gain);
83 }

◆ OFC_a() [2/2]

OFCRef_t LArOFCSC::OFC_a ( const IdentifierHash hs,
int  gain 
) const
inline

Definition at line 46 of file LArOFCSC.h.

46  {
47  const float* pStart=m_pOFCa[gain]+(hs*m_nSamples);
48  if (*pStart==ERRORCODE)
49  return OFCRef_t(NULL,NULL);
50  else
51  return OFCRef_t(pStart,pStart+m_nSamples);
52  }

◆ OFC_b() [1/2]

LArOFCSC::OFCRef_t LArOFCSC::OFC_b ( const HWIdentifier CellID,
int  gain,
int  tbin = 0 
) const
virtual

Implements ILArOFC.

Definition at line 85 of file LArOFCSC.cxx.

85  {
86  if (tbin!=0) return OFCRef_t(nullptr,nullptr);
87  return this->OFC_b(m_scOnlineID->channel_Hash(onId),gain);
88 }

◆ OFC_b() [2/2]

OFCRef_t LArOFCSC::OFC_b ( const IdentifierHash hs,
int  gain 
) const
inline

Definition at line 54 of file LArOFCSC.h.

54  {
55  const float* pStart=m_pOFCb[gain]+(hs*m_nSamples);
56  if (*pStart==ERRORCODE)
57  return OFCRef_t(NULL,NULL);
58  else
59  return OFCRef_t(pStart,pStart+m_nSamples);
60  }

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

◆ timeBinWidth()

float LArOFCSC::timeBinWidth ( const HWIdentifier CellID,
int  gain 
) const
virtual

Implements ILArOFC.

Definition at line 101 of file LArOFCSC.cxx.

101  {
102  return (25./24.);
103 }

◆ timeOffset()

float LArOFCSC::timeOffset ( const HWIdentifier CellID,
int  gain 
) const
virtual

Implements ILArOFC.

Definition at line 90 of file LArOFCSC.cxx.

90  {
92  return m_pTimeOffset[gain][hs];
93 }

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_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_isInitialized

bool LArCondSuperCellBase::m_isInitialized
protectedinherited

Definition at line 22 of file LArCondSuperCellBase.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_nChannels

unsigned LArOFCSC::m_nChannels
private

Definition at line 79 of file LArOFCSC.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nSamples

unsigned LArOFCSC::m_nSamples
private

Definition at line 80 of file LArOFCSC.h.

◆ m_pOFCa

std::vector<const float*> LArOFCSC::m_pOFCa
private

Definition at line 75 of file LArOFCSC.h.

◆ m_pOFCb

std::vector<const float*> LArOFCSC::m_pOFCb
private

Definition at line 76 of file LArOFCSC.h.

◆ m_pTimeOffset

std::vector<const float*> LArOFCSC::m_pTimeOffset
private

Definition at line 77 of file LArOFCSC.h.

◆ m_scOnlineID

const LArOnline_SuperCellID* LArCondSuperCellBase::m_scOnlineID
protectedinherited

Definition at line 23 of file LArCondSuperCellBase.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
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1632
LArOFCSC::m_pOFCb
std::vector< const float * > m_pOFCb
Definition: LArOFCSC.h:76
LArCondSuperCellBase::m_scOnlineID
const LArOnline_SuperCellID * m_scOnlineID
Definition: LArCondSuperCellBase.h:23
LArOFCSC::m_pTimeOffset
std::vector< const float * > m_pTimeOffset
Definition: LArOFCSC.h:77
ATH_CHECK_WITH_CONTEXT
#define ATH_CHECK_WITH_CONTEXT
Evaluate an expression and check for errors, with an explicitly specified context name.
Definition: AthCheckMacros.h:36
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
LArOFCSC::ERRORCODE
@ ERRORCODE
Definition: LArOFCSC.h:25
LArCondSuperCellBase::LArCondSuperCellBase
LArCondSuperCellBase(const std::string &name)
Definition: LArCondSuperCellBase.cxx:15
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
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CreatePhysValWebPage.hs
hs
Definition: CreatePhysValWebPage.py:107
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArOFCSC::OFCRef_t
ILArOFC::OFCRef_t OFCRef_t
Definition: LArOFCSC.h:24
LArCondSuperCellBase::initializeBase
StatusCode initializeBase()
Definition: LArCondSuperCellBase.cxx:22
LArOFCSC::m_nSamples
unsigned m_nSamples
Definition: LArOFCSC.h:80
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
LArOFCSC::OFC_b
virtual OFCRef_t OFC_b(const HWIdentifier &CellID, int gain, int tbin=0) const
Definition: LArOFCSC.cxx:85
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition: CondAttrListCollection.h:322
LArOFCSC::m_pOFCa
std::vector< const float * > m_pOFCa
Definition: LArOFCSC.h:75
LArOFCSC::m_nChannels
unsigned m_nChannels
Definition: LArOFCSC.h:79
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
LArElecCalib::ERRORCODE
@ ERRORCODE
Definition: LArCalibErrorCode.h:17
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
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
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
LArCondSuperCellBase::m_isInitialized
bool m_isInitialized
Definition: LArCondSuperCellBase.h:22
readCCLHist.float
float
Definition: readCCLHist.py:83
LArOFCSC::OFC_a
virtual OFCRef_t OFC_a(const HWIdentifier &CellID, int gain, int tbin=0) const
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
Definition: LArOFCSC.cxx:80