ATLAS Offline Software
LArPedestalBlob.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "CoralBase/Blob.h"
8 #include "CoralBase/Attribute.h"
9 #include "CoralBase/AttributeList.h"
10 #include "CoralBase/AttributeListSpecification.h"
11 
13  m_nChannels(0)
14  {}
15 
17 
18 void LArPedestalBlob::readBlob(const CondAttrListCollection* attrList, MsgStream& msg) {
19  m_nChannels=0;
20  m_pPedestal.clear();
21  m_pPedestalRMS.clear();
22 
23  if (!attrList) return;
24 
26  CondAttrListCollection::const_iterator gainIt_e=attrList->end();
27 
28  m_pPedestal.resize(attrList->size());
29  m_pPedestalRMS.resize(attrList->size());
30  msg << MSG::DEBUG << "Found data for " << attrList->size() << " gains." << endmsg;
31 
32  int blobSize=0;
33 
34  for(;gainIt!=gainIt_e;++gainIt) {
35  const unsigned gain=gainIt->first;
36  if (gain>=attrList->size()) {
37  msg << MSG::ERROR << "Found unexpected COOL-channel (=gain) number:" << gain << endmsg;
38  return; //ERROR
39  }
40  const coral::AttributeList& attr=gainIt->second;
41  const coral::Blob& pedBlob = attr["Pedestal"].data<coral::Blob>();
42  const coral::Blob& rmsBlob = attr["PedestalRMS"].data<coral::Blob>();
43  if (blobSize==0) blobSize=pedBlob.size();
44 
45  //Sanity checks:
46  if (blobSize!=pedBlob.size() || blobSize!=rmsBlob.size()) {
47  msg << MSG::ERROR << "Unequal blob size (" << blobSize << "/"
48  << pedBlob.size() << "/" << rmsBlob.size() << ")" <<endmsg;
49  return;
50  }
51  m_pPedestal[gain]=static_cast<const float*>(pedBlob.startingAddress());
52  m_pPedestalRMS[gain]=static_cast<const float*>(rmsBlob.startingAddress());
53  }// end loop over COOL channels
54 
55 
56  m_nChannels=blobSize/sizeof(float);
57  msg << MSG::DEBUG << "Found data for " << m_nChannels << endmsg;
58  return;
59 }
LArPedestalBlob::m_pPedestalRMS
std::vector< const float * > m_pPedestalRMS
Definition: LArPedestalBlob.h:38
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArPedestalBlob::readBlob
void readBlob(const CondAttrListCollection *attrList, MsgStream &msg)
Definition: LArPedestalBlob.cxx:18
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
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArPedestalBlob.h
LArPedestalBlob::~LArPedestalBlob
~LArPedestalBlob()
Definition: LArPedestalBlob.cxx:16
LArPedestalBlob::LArPedestalBlob
LArPedestalBlob()
Definition: LArPedestalBlob.cxx:12
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition: CondAttrListCollection.h:322
LArPedestalBlob::m_pPedestal
std::vector< const float * > m_pPedestal
Definition: LArPedestalBlob.h:37
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
DEBUG
#define DEBUG
Definition: page_access.h:11
LArPedestalBlob::m_nChannels
unsigned m_nChannels
Definition: LArPedestalBlob.h:40
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
readCCLHist.float
float
Definition: readCCLHist.py:83