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;
30 if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() &&
41 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
43 bool copyChannel =
true;
45 if (!(chansSet & (1 << (j - chansOffset)))) {
49 if (j%32 == 31 && j < nChannelsPerFeb-2) {
61 if (autocorrIndex + nAutoCorrs > persObj->
m_vAutoCorr.size()) {
63 <<
"LArAutoCorrSubsetCnv_p1::persToTrans - autocorr index too large: autocorr/size "
64 << autocorrIndex <<
" " << persObj->
m_vAutoCorr.size() <<
" "
69 subsetIt->second[j].m_vAutoCorr.assign
71 persObj->
m_vAutoCorr.begin() + autocorrIndex + nAutoCorrs);
72 autocorrIndex += nAutoCorrs;
94 for (
unsigned int i = 0;
i < ncorrs; ++
i){
96 if (autocorrIndex + nAutoCorrs > persObj->
m_vAutoCorr.size()) {
98 <<
"LArAutoCorrSubsetCnv_p1::persToTrans - autocorr index too large: autocorr/size "
99 << autocorrIndex <<
" " << persObj->
m_vAutoCorr.size() <<
" "
106 corrs[
i].second.m_vAutoCorr.assign
108 persObj->
m_vAutoCorr.begin() + autocorrIndex + nAutoCorrs);
109 autocorrIndex += nAutoCorrs;
121 MsgStream &
log)
const
155 unsigned int nsubsetsNotEmpty = 0;
157 unsigned int nchans = 0;
158 unsigned int nAutoCorrs = 0;
160 bool foundNAutoCorrs =
false;
161 std::vector<unsigned int> febsWithSparseData;
165 const auto subsetEnd = transObj->
subsetEnd();
167 subsetIt != subsetEnd;
170 unsigned int nfebChans = subsetIt->second.size();
172 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
174 <<
"LArAutoCorrSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
178 if (nfebChans) ++nsubsetsNotEmpty;
181 bool subsetIsSparse =
false;
182 for (
unsigned int j = 0; j < nfebChans; ++j) {
185 if (!subsetIsSparse) {
187 subsetIsSparse =
true;
188 febsWithSparseData.push_back(subsetIt->first);
193 if (!foundNAutoCorrs) {
196 foundNAutoCorrs =
true;
201 if (!foundNAutoCorrs && ncorrs>0) {
213 unsigned int nAutoCorrsTot = (nchans + ncorrs)*nAutoCorrs;
220 if (febsWithSparseData.size())
224 unsigned int isparse = 0;
226 subsetIt != subsetEnd;
229 unsigned int nfebChans = subsetIt->second.size();
232 if (nfebChans == 0)
continue;
234 unsigned int febid = subsetIt->first;
238 bool isSparse =
false;
239 if (isparse < febsWithSparseData.size() &&
240 febsWithSparseData[isparse] == febid) {
249 unsigned int chansSet = 0;
250 unsigned int chansOffset = 0;
251 for (
unsigned int j = 0; j < nfebChans; ++j){
253 bool saveAutoCorrs =
true;
257 if (subsetIt->second[j].m_vAutoCorr.size() > 0) {
259 assert (j >= chansOffset && (j - chansOffset) <= 31);
260 chansSet |= (1 << (j - chansOffset));
263 saveAutoCorrs =
false;
266 if (j == (chansOffset + 31) || j == nfebChans - 1) {
275 for (
unsigned int k = 0;
k < nAutoCorrs; ++
k){
276 if (
k>=subsetIt->second[j].m_vAutoCorr.size()) {
281 persObj->
m_vAutoCorr.push_back(subsetIt->second[j].m_vAutoCorr[
k]);
284 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": AutoCorr object too small. Expected "
285 << nAutoCorrs <<
" entries. Padded with 0.0" <<
endmsg;
307 for (
unsigned int k = 0;
k < nAutoCorrs; ++
k){
308 if (
k>=corrIt->second.m_vAutoCorr.size()) {
313 persObj->
m_vAutoCorr.push_back(corrIt->second.m_vAutoCorr[
k]);
316 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
317 "): AutoCorr object too small. Expected " << nAutoCorrs <<
" entries. Padded with 0.0" <<
endmsg;