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

#include <LArOFCFlat.h>

Inheritance diagram for LArOFCFlat:
Collaboration diagram for LArOFCFlat:

Public Types

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

Public Member Functions

 LArOFCFlat (const CondAttrListCollection *attrList)
virtual ~LArOFCFlat ()
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)
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.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Protected Attributes

bool m_isInitialized
const LArOnlineIDm_onlineHelper

Private Member Functions

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

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.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 18 of file LArOFCFlat.h.

Member Typedef Documentation

◆ OFCRef_t

Definition at line 24 of file LArOFCFlat.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ERRORCODE 

Definition at line 25 of file LArOFCFlat.h.

Constructor & Destructor Documentation

◆ LArOFCFlat() [1/2]

LArOFCFlat::LArOFCFlat ( )
private

Definition at line 9 of file LArOFCFlat.cxx.

10 : LArCondFlatBase("LArOFCFlat"),
11 m_nChannels(0),
12 m_nSamples(0)
13 {}
LArCondFlatBase(const std::string &name)
unsigned m_nSamples
Definition LArOFCFlat.h:80
unsigned m_nChannels
Definition LArOFCFlat.h:79

◆ LArOFCFlat() [2/2]

LArOFCFlat::LArOFCFlat ( const CondAttrListCollection * attrList)

Definition at line 18 of file LArOFCFlat.cxx.

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

◆ ~LArOFCFlat()

LArOFCFlat::~LArOFCFlat ( )
virtual

Definition at line 15 of file LArOFCFlat.cxx.

15{}

Member Function Documentation

◆ good()

bool LArOFCFlat::good ( ) const
inline

Definition at line 30 of file LArOFCFlat.h.

30{ return m_isInitialized && m_nChannels>0; }

◆ initializeBase()

StatusCode LArCondFlatBase::initializeBase ( )
inherited

Definition at line 26 of file LArCondFlatBase.cxx.

26 {
27
28 ATH_MSG_DEBUG( "initializeBase " );
29
30 if (m_isInitialized) {
31 ATH_MSG_DEBUG( "already initialized - returning " );
32 return (StatusCode::SUCCESS);
33 }
34 //Get LArOnlineID....
35 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
36 ATH_CHECK_WITH_CONTEXT( detStore.isValid(), "LArCondFlatBase" );
37 ATH_CHECK_WITH_CONTEXT( detStore->retrieve(m_onlineHelper,"LArOnlineID"), "LArCondFlatBase" );
38
39 m_isInitialized = true;
40 ATH_MSG_DEBUG( "end initializeBase ");
41 return (StatusCode::SUCCESS);
42}
#define ATH_CHECK_WITH_CONTEXT
Evaluate an expression and check for errors, with an explicitly specified context name.
const LArOnlineID * m_onlineHelper

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ 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 178 of file AthMessaging.h.

179{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ 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_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ nTimeBins()

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

Implements ILArOFC.

Definition at line 94 of file LArOFCFlat.cxx.

94 {
95 return 1;
96}

◆ OFC_a() [1/2]

LArOFCFlat::OFCRef_t LArOFCFlat::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 78 of file LArOFCFlat.cxx.

78 {
79 if (tbin!=0) return OFCRef_t(nullptr,nullptr);
80 return this->OFC_a(m_onlineHelper->channel_Hash(onId),gain);
81}
ILArOFC::OFCRef_t OFCRef_t
Definition LArOFCFlat.h:24
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)

◆ OFC_a() [2/2]

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

Definition at line 46 of file LArOFCFlat.h.

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

◆ OFC_b() [1/2]

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

Implements ILArOFC.

Definition at line 83 of file LArOFCFlat.cxx.

83 {
84 if (tbin!=0) return OFCRef_t(nullptr,nullptr);
85 return this->OFC_b(m_onlineHelper->channel_Hash(onId),gain);
86}
virtual OFCRef_t OFC_b(const HWIdentifier &CellID, int gain, int tbin=0) const

◆ OFC_b() [2/2]

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

Definition at line 54 of file LArOFCFlat.h.

54 {
55 const float* pStart=m_pOFCb[gain]+(hs*m_nSamples);
56 if (*pStart==static_cast<float>(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 LArOFCFlat::timeBinWidth ( const HWIdentifier & CellID,
int gain ) const
virtual

Implements ILArOFC.

Definition at line 99 of file LArOFCFlat.cxx.

99 {
100 return (25./24.);
101}

◆ timeOffset()

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

Implements ILArOFC.

Definition at line 88 of file LArOFCFlat.cxx.

88 {
89 const IdentifierHash hs=m_onlineHelper->channel_Hash(CellID);
90 return m_pTimeOffset[gain][hs];
91}

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.

135{ nullptr };

◆ m_isInitialized

bool LArCondFlatBase::m_isInitialized
protectedinherited

Definition at line 23 of file LArCondFlatBase.h.

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ 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 LArOFCFlat::m_nChannels
private

Definition at line 79 of file LArOFCFlat.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nSamples

unsigned LArOFCFlat::m_nSamples
private

Definition at line 80 of file LArOFCFlat.h.

◆ m_onlineHelper

const LArOnlineID* LArCondFlatBase::m_onlineHelper
protectedinherited

Definition at line 24 of file LArCondFlatBase.h.

◆ m_pOFCa

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

Definition at line 75 of file LArOFCFlat.h.

◆ m_pOFCb

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

Definition at line 76 of file LArOFCFlat.h.

◆ m_pTimeOffset

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

Definition at line 77 of file LArOFCFlat.h.


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