ATLAS Offline Software
Loading...
Searching...
No Matches
LArOFCFlat.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
10 : LArCondFlatBase("LArOFCFlat"),
11 m_nChannels(0),
12 m_nSamples(0)
13 {}
14
16
17
19 : LArCondFlatBase("LArOFCFlat"),
20 m_nChannels(0),
21 m_nSamples(0)
22{
23 if (initializeBase().isFailure()) return;
24
25 if (!attrList) return;
26
29
30 m_pOFCa.resize(attrList->size());
31 m_pOFCb.resize(attrList->size());
32 m_pTimeOffset.resize(attrList->size());
33 ATH_MSG_DEBUG( "Found data for " << attrList->size() << " gains." );
34
35 int blobSize=0; //FIXME Force size to hash-max??? m_onlineHelper->channelHashMax()
36
37 m_nSamples=0;
38
39 for(;gainIt!=gainIt_e;++gainIt) {
40 const unsigned gain=gainIt->first;
41 if (gain>=attrList->size() || gain>2) {
42 ATH_MSG_ERROR( "Found unexpected COOL-channel (=gain) number:" << gain );
43 return; //ERROR
44 }
45 const coral::AttributeList& attr=gainIt->second;
46 const coral::Blob& ofcaBlob = attr["OFCa"].data<coral::Blob>();
47 const coral::Blob& ofcbBlob = attr["OFCb"].data<coral::Blob>();
48 const coral::Blob& toBlob = attr["TimeOffset"].data<coral::Blob>();
49 if (blobSize==0) blobSize=ofcaBlob.size();
50 if (m_nSamples==0) m_nSamples=attr["nSamples"].data<unsigned>();
51
52 //Sanity checks:
53 if (blobSize!=ofcaBlob.size() || blobSize!=ofcbBlob.size()) {
54 ATH_MSG_ERROR( "Unequal blob size (" << blobSize << "/"
55 << ofcaBlob.size() << "/" << ofcbBlob.size() << ")" );
56 return;
57 }
58 if (m_nSamples!=attr["nSamples"].data<unsigned>()) {
59 ATH_MSG_ERROR( "Unequal number of samples (" << m_nSamples << "/"
60 << attr["nSamples"].data<unsigned>() << ")" );
61 return;
62 }
63
64
65 m_pOFCa[gain]=static_cast<const float*>(ofcaBlob.startingAddress());
66 m_pOFCb[gain]=static_cast<const float*>(ofcbBlob.startingAddress());
67 m_pTimeOffset[gain]=static_cast<const float*>(toBlob.startingAddress());
68 }// end loop over COOL channels
69
70 if (m_nSamples==0) {
71 ATH_MSG_ERROR( "Number of samples is zero!" );
72 return;
73 }
74 m_nChannels=blobSize/(sizeof(float)*m_nSamples);
75 ATH_MSG_DEBUG( "Found data for " << m_nChannels );
76}
77
78LArOFCFlat::OFCRef_t LArOFCFlat::OFC_a(const HWIdentifier& onId, int gain, int tbin) const {
79 if (tbin!=0) return OFCRef_t(nullptr,nullptr);
80 return this->OFC_a(m_onlineHelper->channel_Hash(onId),gain);
81}
82
83LArOFCFlat::OFCRef_t LArOFCFlat::OFC_b(const HWIdentifier& onId, int gain, int tbin) const {
84 if (tbin!=0) return OFCRef_t(nullptr,nullptr);
85 return this->OFC_b(m_onlineHelper->channel_Hash(onId),gain);
86}
87
88float LArOFCFlat::timeOffset(const HWIdentifier& CellID, int gain) const {
89 const IdentifierHash hs=m_onlineHelper->channel_Hash(CellID);
90 return m_pTimeOffset[gain][hs];
91}
92
93
94unsigned LArOFCFlat::nTimeBins(const HWIdentifier&, int) const {
95 return 1;
96}
97
98
99float LArOFCFlat::timeBinWidth(const HWIdentifier&, int ) const {
100 return (25./24.);
101}
102
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
if(febId1==febId2)
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
size_type size() const
number of Chan/AttributeList pairs
ChanAttrListMap::const_iterator const_iterator
This is a "hash" representation of an Identifier.
LArCondFlatBase(const std::string &name)
const LArOnlineID * m_onlineHelper
StatusCode initializeBase()
virtual OFCRef_t OFC_b(const HWIdentifier &CellID, int gain, int tbin=0) const
virtual unsigned nTimeBins(const HWIdentifier &CellID, int gain) const
virtual float timeOffset(const HWIdentifier &CellID, int gain) const
unsigned m_nSamples
Definition LArOFCFlat.h:80
unsigned m_nChannels
Definition LArOFCFlat.h:79
virtual ~LArOFCFlat()
ILArOFC::OFCRef_t OFCRef_t
Definition LArOFCFlat.h:24
std::vector< const float * > m_pOFCa
Definition LArOFCFlat.h:75
std::vector< const float * > m_pOFCb
Definition LArOFCFlat.h:76
virtual float timeBinWidth(const HWIdentifier &CellID, int gain) const
std::vector< const float * > m_pTimeOffset
Definition LArOFCFlat.h:77
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)