ATLAS Offline Software
LArDSPThresholdsFlat.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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 
12  LArCondFlatBase("LArDSPThresholdsFlat"),
13  m_nChannels(0),
14  m_ptQThr(nullptr),
15  m_psamplesThr(nullptr),
16  m_ptrigSumThr(nullptr)
17 
18 {}
19 
21  LArCondFlatBase("LArDSPThresholdsFlat"),
22  m_nChannels(0),
23  m_ptQThr(nullptr),
24  m_psamplesThr(nullptr),
25  m_ptrigSumThr(nullptr)
26 {
27  if (initializeBase().isFailure()) return;
28  readBlob(attrList);
29  return;
30 }
31 
32 
33 
34 
35 float LArDSPThresholdsFlat::tQThr(const HWIdentifier& CellID) const {
36  return this->tQThrByHash(m_onlineHelper->channel_Hash(CellID));
37 }
38 
40  if (h>=m_nChannels) {
41  ATH_MSG_ERROR ("tQThrByHash: Hash out of range ( " << h << ", max=" << m_nChannels << ")" );
42  return 0;
43  }
44  return m_ptQThr[h];
45 }
46 
47 float LArDSPThresholdsFlat::samplesThr(const HWIdentifier& CellID) const {
48  return this->samplesThrByHash(m_onlineHelper->channel_Hash(CellID));
49 }
50 
52  if (h>=m_nChannels) {
53  ATH_MSG_ERROR( "samplesThrByHash: Hash out of range ( " << h << ", max=" << m_nChannels << ")" );
54  return 0;
55  }
56  return m_psamplesThr[h];
57 }
58 
59 float LArDSPThresholdsFlat::trigSumThr(const HWIdentifier& CellID) const {
60  return this->trigSumThrByHash(m_onlineHelper->channel_Hash(CellID));
61 }
62 
64  if (h>=m_nChannels) {
65  ATH_MSG_ERROR( "trigSumThrByHash: Hash out of range ( " << h << ", max=" << m_nChannels << ")" );
66  return 0;
67  }
68  return m_ptrigSumThr[h];
69 }
70 
72  m_nChannels=0;
73  //m_setName.clear();
74 
75  if (!attrList) return;
76 
77  //const coral::AttributeList& attr= attrList->coralList();
78 
79  //m_setName=attr["Name"].data<std::string>();
80 
81  const coral::Blob& tQThrBlob = (*attrList)["tQThr"].data<coral::Blob>();
82  const coral::Blob& samplesThrBlob = (*attrList)["samplesThr"].data<coral::Blob>();
83  const coral::Blob& trigSumThrBlob = (*attrList)["trigSumThr"].data<coral::Blob>();
84  //const coral::Blob *tQThrBlob = new coral::Blob(attr["tQThr"].data<coral::Blob>());
85  //const coral::Blob *samplesThrBlob = new coral::Blob(attr["samplesThr"].data<coral::Blob>());
86  //const coral::Blob *trigSumThrBlob = new coral::Blob(attr["trigSumThr"].data<coral::Blob>());
87 
88  if (!(tQThrBlob.size()==samplesThrBlob.size() && samplesThrBlob.size()==trigSumThrBlob.size())) {
89  ATH_MSG_ERROR( "Unequal blob size tQThr/samplesThr/trigSumThr = "
90  << tQThrBlob.size() << "/" << samplesThrBlob.size() << "/" << trigSumThrBlob.size() );
91  return;
92  }
93 
94  m_nChannels=tQThrBlob.size()/sizeof(float);
95 
96 
98  ATH_MSG_WARNING( "Found data for " << m_nChannels << " but expected " << m_onlineHelper->channelHashMax() );
99  }
100 
101  ATH_MSG_DEBUG( "Found data for " << m_nChannels );
102  m_ptQThr=static_cast<const float*>(tQThrBlob.startingAddress());
103  m_psamplesThr=static_cast<const float*>(samplesThrBlob.startingAddress());
104  m_ptrigSumThr=static_cast<const float*>(trigSumThrBlob.startingAddress());
105 
106 
107  return;
108 }
LArDSPThresholdsFlat::trigSumThrByHash
float trigSumThrByHash(const IdentifierHash &h) const
Definition: LArDSPThresholdsFlat.cxx:63
LArDSPThresholdsFlat::m_psamplesThr
const float * m_psamplesThr
Definition: LArDSPThresholdsFlat.h:49
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1636
LArDSPThresholdsFlat::tQThrByHash
float tQThrByHash(const IdentifierHash &h) const
Definition: LArDSPThresholdsFlat.cxx:39
LArCondFlatBase
Definition: LArCondFlatBase.h:20
LArDSPThresholdsFlat::m_nChannels
unsigned m_nChannels
Definition: LArDSPThresholdsFlat.h:47
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
LArCondFlatBase::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition: LArCondFlatBase.h:29
HWIdentifier
Definition: HWIdentifier.h:13
AthenaAttributeList.h
LArDSPThresholdsFlat::samplesThr
float samplesThr(const HWIdentifier &CellID) const
Definition: LArDSPThresholdsFlat.cxx:47
LArDSPThresholdsFlat::samplesThrByHash
float samplesThrByHash(const IdentifierHash &h) const
Definition: LArDSPThresholdsFlat.cxx:51
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArDSPThresholdsFlat::tQThr
float tQThr(const HWIdentifier &CellID) const
Definition: LArDSPThresholdsFlat.cxx:35
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
extractSporadic.h
list h
Definition: extractSporadic.py:97
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
LArDSPThresholdsFlat::m_ptQThr
const float * m_ptQThr
Definition: LArDSPThresholdsFlat.h:48
LArDSPThresholdsFlat::m_ptrigSumThr
const float * m_ptrigSumThr
Definition: LArDSPThresholdsFlat.h:50
LArDSPThresholdsFlat.h
LArOnlineID_Base::channelHashMax
size_type channelHashMax(void) const
Define channel hash tables max size.
Definition: LArOnlineID_Base.cxx:1901
LArDSPThresholdsFlat::readBlob
void readBlob(const AthenaAttributeList *attr)
Definition: LArDSPThresholdsFlat.cxx:71
LArDSPThresholdsFlat::LArDSPThresholdsFlat
LArDSPThresholdsFlat()
Definition: LArDSPThresholdsFlat.cxx:11
LArDSPThresholdsFlat::trigSumThr
float trigSumThr(const HWIdentifier &CellID) const
Definition: LArDSPThresholdsFlat.cxx:59
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArCondFlatBase::initializeBase
StatusCode initializeBase()
Definition: LArCondFlatBase.cxx:29
IdentifierHash
Definition: IdentifierHash.h:38
readCCLHist.float
float
Definition: readCCLHist.py:83