ATLAS Offline Software
Loading...
Searching...
No Matches
LArOFCBinSubsetCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7void
9 OFCBinTransType* transObj,
10 MsgStream & /*log*/) const
11{
12 // Copy basic metadata
13 transObj->setChannel (persObj->m_subset.m_channel);
14 transObj->setGroupingType (persObj->m_subset.m_groupingType);
15 transObj->initialize (persObj->m_subset.m_febIds, persObj->m_subset.m_gain);
16
17 // Copy conditions
18 unsigned int nfebids = persObj->m_subset.m_febIds.size();
19 const unsigned int nChannelsPerFeb = persObj->m_subset.subsetSize();
20 unsigned index =0;
21
22 auto subsetIt = transObj->subsetBegin();
23 for (unsigned int i = 0; i < nfebids; ++i, ++subsetIt){
24 // Loop over channels in feb
25 for (unsigned int j = 0; j < nChannelsPerFeb; ++j){
26 (*subsetIt).second[j].m_bin=persObj->m_values[index];
27 // std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel="
28 // << j << " Payload= <<
29 ++index;
30 }
31 }
32
33 unsigned int ncorrs = persObj->m_subset.m_corrChannels.size();
35 corrs.resize(ncorrs);
36
37 // Loop over corrections
38 for (unsigned int i = 0; i < ncorrs; ++i){
39 corrs[i].first = persObj->m_subset.m_corrChannels[i];
40 corrs[i].second.m_bin=persObj->m_values[index];
41 ++index;
42 }
43 transObj->insertCorrections (std::move (corrs));
44
45}
46
47
48
49
50
51void
53 OFCBinPersType* persObj,
54 MsgStream &log) const
55{
56 // Get the number of channels, corrections and the size of pedestal and pedestalrms
57 unsigned int ncorrs = transObj->correctionVecSize();
58 const unsigned int nChannelsPerFeb = transObj->channelVectorSize();
59 unsigned int nsubsetsNotEmpty = 0;
60
61 const auto subsetEnd = transObj->subsetEnd();
62 for (auto subsetIt = transObj->subsetBegin();
63 subsetIt != subsetEnd;
64 ++subsetIt)
65 {
66 unsigned int nfebChans = (*subsetIt).second.size();
67 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
68 log << MSG::ERROR
69 << "LArOFCBinSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
70 << endmsg;
71 return;
72 }
73 if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets
74 }
75
76 // Reserve space in vectors
77 persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty);
78 persObj->m_subset.m_corrChannels.reserve(ncorrs);
79 persObj->m_values.reserve(ncorrs+nsubsetsNotEmpty*nChannelsPerFeb);
80
81 //Copy subsets
82 for (auto subsetIt = transObj->subsetBegin();
83 subsetIt != subsetEnd;
84 ++subsetIt)
85 {
86 unsigned int nfebChans = (*subsetIt).second.size();
87 if (nfebChans==0) continue;
88 unsigned int febid = (*subsetIt).first;
89 persObj->m_subset.m_febIds.push_back(febid);
90 for (unsigned int j=0; j<nfebChans;++j) //Loop over channels in FEB
91 persObj->m_values.push_back((*subsetIt).second[j].m_bin);
92 }
93
94 // Copy corrections
95 const auto corrEnd = transObj->correctionVecEnd();
96 for (auto corrIt = transObj->correctionVecBegin();
97 corrIt != corrEnd;
98 ++corrIt)
99 {
100 persObj->m_subset.m_corrChannels.push_back(corrIt->first);
101 persObj->m_values.push_back(corrIt->second.m_bin);
102 }
103
104 // Copy the rest
105 persObj->m_subset.m_gain = transObj->gain();
106 persObj->m_subset.m_channel = transObj->channel();
107 persObj->m_subset.m_groupingType = transObj->groupingType();
108}
#define endmsg
LArConditionsSubset< LArOFCBinP > OFCBinTransType
LArSingleIntSubset_p1 OFCBinPersType
std::vector< unsigned int > m_febIds
std::vector< unsigned int > m_corrChannels
unsigned int subsetSize() const
void initialize(const std::vector< FebId > &ids, unsigned int gain)
Initialize with set of FEB ids.
ConstSubsetIt subsetEnd() const
unsigned channelVectorSize() const
ConstCorrectionVecIt correctionVecBegin() const
Iterators over channel set.
unsigned int groupingType() const
Type of grouping - defined in LArConditionsContainerBase.h.
ConstCorrectionVecIt correctionVecEnd() const
void setGroupingType(unsigned int type)
set the type of grouping - defined in LArConditionsContainerBase.h
ConstSubsetIt subsetBegin() const
Iterators over subset.
unsigned int gain() const
Access to gain.
size_type correctionVecSize() const
Size of channel set.
std::vector< CorrectionPair > CorrectionVec
unsigned int channel() const
Access to the COOL channel number.
void insertCorrections(CorrectionVec &&corrs)
Insert a group of corrections.
void setChannel(unsigned int channel)
set the COOL channel number
virtual void transToPers(const OFCBinTransType *transObj, OFCBinPersType *persObj, MsgStream &log) const override
virtual void persToTrans(const OFCBinPersType *persObj, OFCBinTransType *transObj, MsgStream &log) const override
std::vector< int > m_values
LArConditionsSubset_p1 m_subset
Definition index.py:1