ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCOOLConditions
src
LArShapeBlob.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArCOOLConditions/LArShapeBlob.h
"
6
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
7
#include "CoralBase/Blob.h"
8
9
LArShapeBlob::LArShapeBlob
():
10
m_nChannels
(0),
11
m_nSamples
(0)
12
{}
13
14
LArShapeBlob::~LArShapeBlob
() {}
15
16
17
void
LArShapeBlob::readBlob
(
const
CondAttrListCollection
* attrList, MsgStream&
msg
) {
18
m_nChannels
=0;
19
m_nSamples
=0;
20
m_pShape
.clear();
21
m_pShapeDer
.clear();
22
m_pTimeOffset
.clear();
23
24
if
(!attrList)
return
;
25
26
CondAttrListCollection::const_iterator
gainIt=attrList->
begin
();
27
CondAttrListCollection::const_iterator
gainIt_e=attrList->
end
();
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
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArShapeBlob.h
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
CondAttrListCollection::end
const_iterator end() const
Definition
CondAttrListCollection.h:314
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition
CondAttrListCollection.h:308
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition
CondAttrListCollection.h:321
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition
CondAttrListCollection.h:62
LArShapeBlob::m_pTimeOffset
std::vector< const float * > m_pTimeOffset
Definition
LArShapeBlob.h:50
LArShapeBlob::m_pShape
std::vector< const float * > m_pShape
Definition
LArShapeBlob.h:48
LArShapeBlob::readBlob
void readBlob(const CondAttrListCollection *attrList, MsgStream &msg)
Definition
LArShapeBlob.cxx:17
LArShapeBlob::m_pShapeDer
std::vector< const float * > m_pShapeDer
Definition
LArShapeBlob.h:49
LArShapeBlob::LArShapeBlob
LArShapeBlob()
Definition
LArShapeBlob.cxx:9
LArShapeBlob::m_nSamples
unsigned m_nSamples
Definition
LArShapeBlob.h:53
LArShapeBlob::~LArShapeBlob
~LArShapeBlob()
Definition
LArShapeBlob.cxx:14
LArShapeBlob::m_nChannels
unsigned m_nChannels
Definition
LArShapeBlob.h:52
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0