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

#include <LArShapeBlob.h>

Inheritance diagram for LArShapeBlob:
Collaboration diagram for LArShapeBlob:

Public Types

enum  { ERRORCODE = LArElecCalib::ERRORCODE }

Public Member Functions

 LArShapeBlob ()
 ~LArShapeBlob ()
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

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

Detailed Description

Definition at line 18 of file LArShapeBlob.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ERRORCODE 

Definition at line 22 of file LArShapeBlob.h.

Constructor & Destructor Documentation

◆ LArShapeBlob()

LArShapeBlob::LArShapeBlob ( )

Definition at line 9 of file LArShapeBlob.cxx.

9 :
10 m_nChannels(0),
11 m_nSamples(0)
12 {}
unsigned m_nSamples
unsigned m_nChannels

◆ ~LArShapeBlob()

LArShapeBlob::~LArShapeBlob ( )

Definition at line 14 of file LArShapeBlob.cxx.

14{}

Member Function Documentation

◆ readBlob()

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

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
MsgStream & msg
Definition testRead.cxx:32

◆ ShapeByHash()

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

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

◆ ShapeDerByHash()

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

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 }

Member Data Documentation

◆ m_nChannels

unsigned LArShapeBlob::m_nChannels
protected

Definition at line 52 of file LArShapeBlob.h.

◆ m_nSamples

unsigned LArShapeBlob::m_nSamples
protected

Definition at line 53 of file LArShapeBlob.h.

◆ m_pShape

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

Definition at line 48 of file LArShapeBlob.h.

◆ m_pShapeDer

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

Definition at line 49 of file LArShapeBlob.h.

◆ m_pTimeOffset

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

Definition at line 50 of file LArShapeBlob.h.


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