ATLAS Offline Software
LArOFCSC.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "CoralBase/Blob.h"
8 
10  LArCondSuperCellBase("LArOFCSC"),
11  m_nChannels(0),
12  m_nSamples(0)
13 {
14 }
15 
17 
18 
20  LArCondSuperCellBase("LArOFCSC"),
21  m_nChannels(0),
22  m_nSamples(0)
23 {
24 
25  if (initializeBase().isFailure()) return;
26 
27  if (!attrList) return;
28 
30  CondAttrListCollection::const_iterator gainIt_e=attrList->end();
31 
32  m_pOFCa.resize(attrList->size());
33  m_pOFCb.resize(attrList->size());
34  m_pTimeOffset.resize(attrList->size());
35  ATH_MSG_DEBUG( "Found data for " << attrList->size() << " gains.");
36 
37  int blobSize=0; //FIXME Force size to hash-max??? m_scOnlineID->channelHashMax()
38 
39  m_nSamples=0;
40 
41  for(;gainIt!=gainIt_e;++gainIt) {
42  const unsigned gain=gainIt->first;
43  if (gain>=attrList->size() || gain>2) {
44  ATH_MSG_ERROR("Found unexpected COOL-channel (=gain) number:" << gain);
45  return; //ERROR
46  }
47  const coral::AttributeList& attr=gainIt->second;
48  const coral::Blob& ofcaBlob = attr["OFCa"].data<coral::Blob>();
49  const coral::Blob& ofcbBlob = attr["OFCb"].data<coral::Blob>();
50  const coral::Blob& toBlob = attr["TimeOffset"].data<coral::Blob>();
51  if (blobSize==0) blobSize=ofcaBlob.size();
52  if (m_nSamples==0) m_nSamples=attr["nSamples"].data<unsigned>();
53 
54  //Sanity checks:
55  if (blobSize!=ofcaBlob.size() || blobSize!=ofcbBlob.size()) {
56  ATH_MSG_ERROR("Unequal blob size (" << blobSize << "/"
57  << ofcaBlob.size() << "/" << ofcbBlob.size() << ")");
58  return;
59  }
60  if (m_nSamples!=attr["nSamples"].data<unsigned>()) {
61  ATH_MSG_ERROR("Unequal number of samples (" << m_nSamples << "/"
62  << attr["nSamples"].data<unsigned>() << ")");
63  return;
64  }
65 
66 
67  m_pOFCa[gain]=static_cast<const float*>(ofcaBlob.startingAddress());
68  m_pOFCb[gain]=static_cast<const float*>(ofcbBlob.startingAddress());
69  m_pTimeOffset[gain]=static_cast<const float*>(toBlob.startingAddress());
70  }// end loop over COOL channels
71 
72  if (m_nSamples==0) {
73  ATH_MSG_ERROR("Number of samples is zero!");
74  return;
75  }
76  m_nChannels=blobSize/(sizeof(float)*m_nSamples);
77  ATH_MSG_DEBUG("Found data for " << m_nChannels);
78 }
79 
80 LArOFCSC::OFCRef_t LArOFCSC::OFC_a(const HWIdentifier& onId, int gain, int tbin) const {
81  if (tbin!=0) return OFCRef_t(nullptr,nullptr);
82  return this->OFC_a(m_scOnlineID->channel_Hash(onId),gain);
83 }
84 
85 LArOFCSC::OFCRef_t LArOFCSC::OFC_b(const HWIdentifier& onId, int gain, int tbin) const {
86  if (tbin!=0) return OFCRef_t(nullptr,nullptr);
87  return this->OFC_b(m_scOnlineID->channel_Hash(onId),gain);
88 }
89 
90 float LArOFCSC::timeOffset(const HWIdentifier& CellID, int gain) const {
92  return m_pTimeOffset[gain][hs];
93 }
94 
95 
96 unsigned LArOFCSC::nTimeBins(const HWIdentifier&, int) const {
97  return 1;
98 }
99 
100 
101 float LArOFCSC::timeBinWidth(const HWIdentifier&, int ) const {
102  return (25./24.);
103 }
104 
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1632
LArOFCSC::m_pOFCb
std::vector< const float * > m_pOFCb
Definition: LArOFCSC.h:76
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArCondSuperCellBase::m_scOnlineID
const LArOnline_SuperCellID * m_scOnlineID
Definition: LArCondSuperCellBase.h:23
LArOFCSC::m_pTimeOffset
std::vector< const float * > m_pTimeOffset
Definition: LArOFCSC.h:77
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
HWIdentifier
Definition: HWIdentifier.h:13
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
LArOFCSC.h
LArOFCSC::~LArOFCSC
virtual ~LArOFCSC()
Definition: LArOFCSC.cxx:16
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CreatePhysValWebPage.hs
hs
Definition: CreatePhysValWebPage.py:107
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArOFCSC::OFCRef_t
ILArOFC::OFCRef_t OFCRef_t
Definition: LArOFCSC.h:24
LArCondSuperCellBase::initializeBase
StatusCode initializeBase()
Definition: LArCondSuperCellBase.cxx:22
LArOFCSC::m_nSamples
unsigned m_nSamples
Definition: LArOFCSC.h:80
LArOFCSC::timeBinWidth
virtual float timeBinWidth(const HWIdentifier &CellID, int gain) const
Definition: LArOFCSC.cxx:101
LArOFCSC::nTimeBins
virtual unsigned nTimeBins(const HWIdentifier &CellID, int gain) const
Definition: LArOFCSC.cxx:96
LArOFCSC::OFC_b
virtual OFCRef_t OFC_b(const HWIdentifier &CellID, int gain, int tbin=0) const
Definition: LArOFCSC.cxx:85
LArCondSuperCellBase
Definition: LArCondSuperCellBase.h:15
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition: CondAttrListCollection.h:322
LArOFCSC::m_pOFCa
std::vector< const float * > m_pOFCa
Definition: LArOFCSC.h:75
LArOFCSC::m_nChannels
unsigned m_nChannels
Definition: LArOFCSC.h:79
LArOFCSC::LArOFCSC
LArOFCSC()
Definition: LArOFCSC.cxx:9
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
LArOFCSC::timeOffset
virtual float timeOffset(const HWIdentifier &CellID, int gain) const
Definition: LArOFCSC.cxx:90
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
readCCLHist.float
float
Definition: readCCLHist.py:83
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38
LArOFCSC::OFC_a
virtual OFCRef_t OFC_a(const HWIdentifier &CellID, int gain, int tbin=0) const
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
Definition: LArOFCSC.cxx:80