ATLAS Offline Software
LArRampBlob.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 
10  :m_nChannels(0),
11  m_nPoints(0)
12 {}
13 
15 {}
16 
17 
18 void LArRampBlob::readBlob(const CondAttrListCollection* attrList, MsgStream& msg) {
19  m_nChannels=0;
20  m_nPoints=0;
21  m_pRamp.clear();
22 
23  if (!attrList) return;
24 
26  CondAttrListCollection::const_iterator gainIt_e=attrList->end();
27 
28  m_pRamp.resize(attrList->size());
29  msg << MSG::DEBUG << "Found data for " << attrList->size() << " gains." << endmsg;
30 
31  int blobSize=0;
32 
33  for(;gainIt!=gainIt_e;++gainIt) {
34  const unsigned gain=gainIt->first;
35  if (gain>=attrList->size() || gain>2) {
36  msg << MSG::ERROR << "Found unexpected COOL-channel (=gain) number:" << gain << endmsg;
37  return; //ERROR
38  }
39  const coral::AttributeList& attr=gainIt->second;
40  const coral::Blob& rampBlob = attr["RampVec"].data<coral::Blob>();
41  if (blobSize==0) blobSize=rampBlob.size();
42  if (m_nPoints==0) m_nPoints=attr["nPoints"].data<unsigned>();
43 
44  //Sanity checks:
45  if (blobSize!=rampBlob.size()) {
46  msg << MSG::ERROR << "Unequal blob size (" << blobSize << "/"
47  << rampBlob.size() << ")" <<endmsg;
48  return;
49  }
50  if (m_nPoints!=attr["nPoints"].data<unsigned>()) {
51  msg << MSG::ERROR << "Unequal polynom degree (" << m_nPoints << "/"
52  << attr["nPoints"].data<unsigned>() << ")" << endmsg;
53  return;
54  }
55 
56  m_pRamp[gain]=static_cast<const float*>(rampBlob.startingAddress());
57  }// end loop over COOL channels
58 
59 
60  if (m_nPoints==0) {
61  msg << MSG::ERROR << "Number of points is zero!" << endmsg;
62  return;
63  }
64  m_nChannels=blobSize/(sizeof(float)*m_nPoints);
65  msg << MSG::DEBUG << "Found data for " << m_nChannels << endmsg;
66  return;
67 }
68 
LArRampBlob::readBlob
void readBlob(const CondAttrListCollection *attrList, MsgStream &msg)
Definition: LArRampBlob.cxx:18
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...
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
LArRampBlob.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArRampBlob::m_nChannels
unsigned m_nChannels
Definition: LArRampBlob.h:37
LArRampBlob::m_pRamp
std::vector< const float * > m_pRamp
Definition: LArRampBlob.h:41
LArRampBlob::~LArRampBlob
~LArRampBlob()
Definition: LArRampBlob.cxx:14
LArRampBlob::m_nPoints
unsigned m_nPoints
Definition: LArRampBlob.h:38
LArRampBlob::LArRampBlob
LArRampBlob()
Definition: LArRampBlob.cxx:9
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition: CondAttrListCollection.h:322
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
DEBUG
#define DEBUG
Definition: page_access.h:11
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
readCCLHist.float
float
Definition: readCCLHist.py:83