ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
80LArOFCSC::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
85LArOFCSC::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
90float LArOFCSC::timeOffset(const HWIdentifier& CellID, int gain) const {
91 const IdentifierHash hs=m_scOnlineID->channel_Hash(CellID);
92 return m_pTimeOffset[gain][hs];
93}
94
95
96unsigned LArOFCSC::nTimeBins(const HWIdentifier&, int) const {
97 return 1;
98}
99
100
101float LArOFCSC::timeBinWidth(const HWIdentifier&, int ) const {
102 return (25./24.);
103}
104
#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.
const LArOnline_SuperCellID * m_scOnlineID
LArCondSuperCellBase(const std::string &name)
unsigned m_nChannels
Definition LArOFCSC.h:79
unsigned m_nSamples
Definition LArOFCSC.h:80
virtual OFCRef_t OFC_b(const HWIdentifier &CellID, int gain, int tbin=0) const
Definition LArOFCSC.cxx:85
virtual float timeOffset(const HWIdentifier &CellID, int gain) const
Definition LArOFCSC.cxx:90
std::vector< const float * > m_pTimeOffset
Definition LArOFCSC.h:77
virtual unsigned nTimeBins(const HWIdentifier &CellID, int gain) const
Definition LArOFCSC.cxx:96
virtual ~LArOFCSC()
Definition LArOFCSC.cxx:16
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
ILArOFC::OFCRef_t OFCRef_t
Definition LArOFCSC.h:24
std::vector< const float * > m_pOFCb
Definition LArOFCSC.h:76
virtual float timeBinWidth(const HWIdentifier &CellID, int gain) const
Definition LArOFCSC.cxx:101
std::vector< const float * > m_pOFCa
Definition LArOFCSC.h:75