11 MsgStream & log)
const
21 unsigned int autocorrIndex = 0;
23 unsigned int ifebWithData = 0;
25 for (
unsigned int i = 0; i < nfebids; ++i, ++subsetIt){
26 unsigned int febid = subsetIt->first;
27 bool hasSparseData =
false;
28 unsigned int chansSet = 0;
29 unsigned int chansOffset = 0;
41 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
43 bool copyChannel =
true;
47 if (!(chansSet & (1 << (j - chansOffset)))) {
51 if (j%32 == 31 && j < nChannelsPerFeb-2) {
63 if (autocorrIndex + nAutoCorrs > persObj->
m_vAutoCorr.size()) {
65 <<
"LArAutoCorrSubsetCnv_p1::persToTrans - autocorr index too large: autocorr/size "
66 << autocorrIndex <<
" " << persObj->
m_vAutoCorr.size() <<
" "
71 subsetIt->second[j].m_vAutoCorr.assign
73 persObj->
m_vAutoCorr.begin() + autocorrIndex + nAutoCorrs);
74 autocorrIndex += nAutoCorrs;
96 for (
unsigned int i = 0; i < ncorrs; ++i){
98 if (autocorrIndex + nAutoCorrs > persObj->
m_vAutoCorr.size()) {
100 <<
"LArAutoCorrSubsetCnv_p1::persToTrans - autocorr index too large: autocorr/size "
101 << autocorrIndex <<
" " << persObj->
m_vAutoCorr.size() <<
" "
108 corrs[i].second.m_vAutoCorr.assign
110 persObj->
m_vAutoCorr.begin() + autocorrIndex + nAutoCorrs);
111 autocorrIndex += nAutoCorrs;
123 MsgStream &log)
const
157 unsigned int nsubsetsNotEmpty = 0;
159 unsigned int nchans = 0;
160 unsigned int nAutoCorrs = 0;
162 bool foundNAutoCorrs =
false;
163 std::vector<unsigned int> febsWithSparseData;
167 const auto subsetEnd = transObj->
subsetEnd();
169 subsetIt != subsetEnd;
172 unsigned int nfebChans = subsetIt->second.size();
174 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
176 <<
"LArAutoCorrSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
180 if (nfebChans) ++nsubsetsNotEmpty;
183 bool subsetIsSparse =
false;
184 for (
unsigned int j = 0; j < nfebChans; ++j) {
187 if (!subsetIsSparse) {
189 subsetIsSparse =
true;
190 febsWithSparseData.push_back(subsetIt->first);
195 if (!foundNAutoCorrs) {
198 foundNAutoCorrs =
true;
203 if (!foundNAutoCorrs && ncorrs>0) {
215 unsigned int nAutoCorrsTot = (nchans + ncorrs)*nAutoCorrs;
222 if (febsWithSparseData.size())
226 unsigned int isparse = 0;
228 subsetIt != subsetEnd;
231 unsigned int nfebChans = subsetIt->second.size();
234 if (nfebChans == 0)
continue;
236 unsigned int febid = subsetIt->first;
240 bool isSparse =
false;
241 if (isparse < febsWithSparseData.size() &&
242 febsWithSparseData[isparse] == febid) {
251 unsigned int chansSet = 0;
252 unsigned int chansOffset = 0;
253 for (
unsigned int j = 0; j < nfebChans; ++j){
255 bool saveAutoCorrs =
true;
259 if (subsetIt->second[j].m_vAutoCorr.size() > 0) {
262 assert (j >= chansOffset && (j - chansOffset) <= 31);
263 chansSet |= (1 << (j - chansOffset));
266 saveAutoCorrs =
false;
269 if (j == (chansOffset + 31) || j == nfebChans - 1) {
278 for (
unsigned int k = 0; k < nAutoCorrs; ++k){
279 if (k>=subsetIt->second[j].m_vAutoCorr.size()) {
284 persObj->
m_vAutoCorr.push_back(subsetIt->second[j].m_vAutoCorr[k]);
287 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": AutoCorr object too small. Expected "
288 << nAutoCorrs <<
" entries. Padded with 0.0" <<
endmsg;
310 for (
unsigned int k = 0; k < nAutoCorrs; ++k){
311 if (k>=corrIt->second.m_vAutoCorr.size()) {
316 persObj->
m_vAutoCorr.push_back(corrIt->second.m_vAutoCorr[k]);
319 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
320 "): AutoCorr object too small. Expected " << nAutoCorrs <<
" entries. Padded with 0.0" <<
endmsg;
LArAutoCorrSubset_p1 LArAutoCorrPersType
LArConditionsSubset< LArAutoCorrP1 > LArAutoCorrTransType
This file defines the template class used for I/O of conditions data.
c-struct reproducing the structure of the persistent data
std::vector< float > m_vAutoCorr
virtual void persToTrans(const LArAutoCorrPersType *persObj, LArAutoCorrTransType *transObj, MsgStream &log) const override
virtual void transToPers(const LArAutoCorrTransType *transObj, LArAutoCorrPersType *persObj, MsgStream &log) const override
LArConditionsSubset_p1 m_subset
unsigned int m_vAutoCorrSize
std::vector< float > m_vAutoCorr
std::vector< unsigned int > m_febIds
std::vector< unsigned int > m_corrChannels
unsigned int subsetSize() const
std::vector< unsigned int > m_febsWithSparseData
unsigned int m_groupingType
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