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

#include <LArShapeSC.h>

Inheritance diagram for LArShapeSC:
Collaboration diagram for LArShapeSC:

Public Types

typedef LArVectorProxy ShapeRef_t
 This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype Interface.
enum  { ERRORCODE = LArElecCalib::ERRORCODE }

Public Member Functions

 LArShapeSC (const CondAttrListCollection *attrList)
virtual ~LArShapeSC ()
bool good () const
virtual ShapeRef_t Shape (const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) const
virtual ShapeRef_t ShapeDer (const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) 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
void readBlob (const CondAttrListCollection *attrList, MsgStream &msg)
ILArShape::ShapeRef_t ShapeByHash (const IdentifierHash &hs, int gain) const
ILArShape::ShapeRef_t ShapeDerByHash (const IdentifierHash &hs, 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

std::vector< const float * > m_pShape
std::vector< const float * > m_pShapeDer
std::vector< const float * > m_pTimeOffset
unsigned m_nChannels
unsigned m_nSamples
bool m_isInitialized
const LArOnline_SuperCellIDm_scOnlineID

Private Member Functions

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

Private Attributes

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 17 of file LArShapeSC.h.

Member Typedef Documentation

◆ ShapeRef_t

This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype Interface.

Author
S. Laplace
Version
0-0-1 , 29/01/2004

History:

  • 08/02/2004, S. Laplace: new online ID

Definition at line 26 of file ILArShape.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
ERRORCODE 

Definition at line 22 of file LArShapeBlob.h.

Constructor & Destructor Documentation

◆ LArShapeSC() [1/2]

LArShapeSC::LArShapeSC ( )
private

Definition at line 9 of file LArShapeSC.cxx.

10 : LArCondSuperCellBase ("LArShapeSC")
11{}
LArCondSuperCellBase(const std::string &name)

◆ LArShapeSC() [2/2]

LArShapeSC::LArShapeSC ( const CondAttrListCollection * attrList)

Definition at line 16 of file LArShapeSC.cxx.

17 : LArCondSuperCellBase ("LArShapeSC")
18{
19 if (initializeBase().isFailure()) return;
20
21 readBlob(attrList,msg());
22}
MsgStream & msg() const
The standard message stream.
void readBlob(const CondAttrListCollection *attrList, MsgStream &msg)

◆ ~LArShapeSC()

LArShapeSC::~LArShapeSC ( )
virtual

Definition at line 13 of file LArShapeSC.cxx.

13{}

Member Function Documentation

◆ good()

bool LArShapeSC::good ( ) const
inline

Definition at line 28 of file LArShapeSC.h.

◆ 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}
#define ATH_CHECK_WITH_CONTEXT
Evaluate an expression and check for errors, with an explicitly specified context name.
#define ATH_MSG_DEBUG(x)
const LArOnline_SuperCellID * m_scOnlineID

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

◆ 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 LArShapeSC::nTimeBins ( const HWIdentifier & CellID,
int gain ) const
virtual

Definition at line 43 of file LArShapeSC.cxx.

43 {
44 return 1;
45}

◆ readBlob()

void LArShapeBlob::readBlob ( const CondAttrListCollection * attrList,
MsgStream & msg )
inherited

Definition at line 17 of file LArShapeBlob.cxx.

17 {
19 m_nSamples=0;
20 m_pShape.clear();
21 m_pShapeDer.clear();
22 m_pTimeOffset.clear();
23
24 if (!attrList) return;
25
28
29 m_pShape.resize(attrList->size());
30 m_pShapeDer.resize(attrList->size());
31 m_pTimeOffset.resize(attrList->size());
32 msg << MSG::DEBUG << "Found data for " << attrList->size() << " gains." << endmsg;
33
34 int blobSize=0; //FIXME Force size to hash-max??? m_onlineHelper->channelHashMax()
35
36
37 for(;gainIt!=gainIt_e;++gainIt) {
38 const unsigned gain=gainIt->first;
39 if (gain>=attrList->size() || gain>2) {
40 msg << MSG::ERROR << "Found unexpected COOL-channel (=gain) number:" << gain << endmsg;
41 return; //ERROR
42 }
43 const coral::AttributeList& attr=gainIt->second;
44 const coral::Blob& shapeaBlob = attr["Shape"].data<coral::Blob>();
45 const coral::Blob& shapebBlob = attr["ShapeDer"].data<coral::Blob>();
46 const coral::Blob& toBlob = attr["TimeOffset"].data<coral::Blob>();
47 if (blobSize==0) blobSize=shapeaBlob.size();
48 if (m_nSamples==0) m_nSamples=attr["nSamples"].data<unsigned>();
49
50 //Sanity checks:
51 if (blobSize!=shapeaBlob.size() || blobSize!=shapebBlob.size()) {
52 msg << MSG::ERROR << "Unequal blob size (" << blobSize << "/"
53 << shapeaBlob.size() << "/" << shapebBlob.size() << ")" <<endmsg;
54 return;
55 }
56 if (m_nSamples!=attr["nSamples"].data<unsigned>()) {
57 msg << MSG::ERROR << "Unequal number of samples (" << m_nSamples << "/"
58 << attr["nSamples"].data<unsigned>() << ")" << endmsg;
59 return;
60 }
61
62
63 m_pShape[gain]=static_cast<const float*>(shapeaBlob.startingAddress());
64 m_pShapeDer[gain]=static_cast<const float*>(shapebBlob.startingAddress());
65 m_pTimeOffset[gain]=static_cast<const float*>(toBlob.startingAddress());
66 }// end loop over COOL channels
67
68 if (m_nSamples==0) {
69 msg << MSG::ERROR << "Number of samples is zero!" << endmsg;
70 return;
71 }
72 m_nChannels=blobSize/(sizeof(float)*m_nSamples);
73 msg << MSG::DEBUG << "Found data for " << m_nChannels << endmsg;
74}
#define endmsg
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
std::vector< const float * > m_pTimeOffset
std::vector< const float * > m_pShape
std::vector< const float * > m_pShapeDer
unsigned m_nSamples
MsgStream & msg
Definition testRead.cxx:32

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

◆ Shape()

LArShapeSC::ShapeRef_t LArShapeSC::Shape ( const HWIdentifier & CellID,
int gain,
int tbin = 0,
int mode = 0 ) const
virtual

Implements ILArShape.

Definition at line 27 of file LArShapeSC.cxx.

27 {
28 const IdentifierHash hash=m_scOnlineID->channel_Hash(hwid);
29 return this->ShapeByHash(hash,0);
30}
ILArShape::ShapeRef_t ShapeByHash(const IdentifierHash &hs, int gain) const

◆ ShapeByHash()

ILArShape::ShapeRef_t LArShapeBlob::ShapeByHash ( const IdentifierHash & hs,
int gain ) const
inlineinherited

Definition at line 30 of file LArShapeBlob.h.

30 {
31 const float* pStart=m_pShape[gain]+(hs*m_nSamples);
32 if (*pStart==static_cast<float>(ERRORCODE))
33 return ILArShape::ShapeRef_t(NULL,NULL);
34 else
35 return ILArShape::ShapeRef_t(pStart,pStart+m_nSamples);
36 }
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
Definition ILArShape.h:26

◆ ShapeDer()

LArShapeSC::ShapeRef_t LArShapeSC::ShapeDer ( const HWIdentifier & CellID,
int gain,
int tbin = 0,
int mode = 0 ) const
virtual

Implements ILArShape.

Definition at line 32 of file LArShapeSC.cxx.

32 {
33 const IdentifierHash hash=m_scOnlineID->channel_Hash(hwid);
34 return this->ShapeDerByHash(hash,0);
35}
ILArShape::ShapeRef_t ShapeDerByHash(const IdentifierHash &hs, int gain) const

◆ ShapeDerByHash()

ILArShape::ShapeRef_t LArShapeBlob::ShapeDerByHash ( const IdentifierHash & hs,
int gain ) const
inlineinherited

Definition at line 38 of file LArShapeBlob.h.

38 {
39 const float* pStart=m_pShapeDer[gain]+(hs*m_nSamples);
40 if (*pStart==static_cast<float>(ERRORCODE))
41 return ILArShape::ShapeRef_t(NULL,NULL);
42 else
43 return ILArShape::ShapeRef_t(pStart,pStart+m_nSamples);
44 }

◆ timeBinWidth()

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

Definition at line 48 of file LArShapeSC.cxx.

48 {
49 return (25./24.);
50}

◆ timeOffset()

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

Definition at line 37 of file LArShapeSC.cxx.

37 {
38 const IdentifierHash hash=m_scOnlineID->channel_Hash(hwid);
39 return m_pTimeOffset[0][hash];
40}

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

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 LArShapeBlob::m_nChannels
protectedinherited

Definition at line 52 of file LArShapeBlob.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nSamples

unsigned LArShapeBlob::m_nSamples
protectedinherited

Definition at line 53 of file LArShapeBlob.h.

◆ m_pShape

std::vector<const float*> LArShapeBlob::m_pShape
protectedinherited

Definition at line 48 of file LArShapeBlob.h.

◆ m_pShapeDer

std::vector<const float*> LArShapeBlob::m_pShapeDer
protectedinherited

Definition at line 49 of file LArShapeBlob.h.

◆ m_pTimeOffset

std::vector<const float*> LArShapeBlob::m_pTimeOffset
protectedinherited

Definition at line 50 of file LArShapeBlob.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: