11 MsgStream &
log)
const
22 unsigned int nPhases = persObj->
m_nPhases;
24 unsigned int dataIndex = 0;
25 unsigned int timeIndex = 0;
28 unsigned int ifebWithData = 0;
31 for (
unsigned int i = 0;
i < nfebids; ++
i, ++subsetIt){
33 unsigned int febid = (*subsetIt).first;
35 bool hasSparseData =
false;
36 unsigned int chansSet = 0;
37 unsigned int chansOffset = 0;
38 if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() &&
49 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
51 bool copyChannel =
true;
53 if (!(chansSet & (1 << (j - chansOffset)))) {
57 if (j%32 == 31 && j < nChannelsPerFeb-2) {
69 if (dataIndex >= persObj->
m_vOFC_a.size() ||
70 dataIndex >= persObj->
m_vOFC_b.size() ||
74 <<
"LArOFCSubsetCnv_p1::persToTrans - ofc index too large: dataIndex size ofc_a, size ofc_b, timeIndex timeOffset size, timeBinWidth size "
75 << dataIndex <<
" " << persObj->
m_vOFC_a.size() <<
" "
76 << persObj->
m_vOFC_b.size() <<
" " << timeIndex <<
" "
84 (*subsetIt).second[j];
105 std::vector<float> vSamples(
nSamples, 0.0);
106 std::vector<std::vector<float> > vOFC(nPhases, vSamples);
107 LArOFCP1 larOFCP1(0.0, 0.0, vOFC, vOFC);
113 for (
unsigned int i = 0;
i < ncorrs; ++
i){
115 if (dataIndex >= persObj->
m_vOFC_a.size() ||
116 dataIndex >= persObj->
m_vOFC_b.size() ||
120 <<
"LArOFCSubsetCnv_p1::persToTrans - ofc index too large: dataIndex size ofc_a, size ofc_b, timeIndex timeOffset size, timeBinWidth size "
121 << dataIndex <<
" " << persObj->
m_vOFC_a.size() <<
" "
122 << persObj->
m_vOFC_b.size() <<
" " << timeIndex <<
" "
153 MsgStream &
log)
const
187 unsigned int nsubsetsNotEmpty = 0;
190 unsigned int nchans = 0;
191 unsigned int nPhases = 0;
193 bool foundOFCs =
false;
194 std::vector<unsigned int> febsWithSparseData;
198 const auto subsetEnd = transObj->
subsetEnd();
200 subsetIt != subsetEnd;
203 unsigned int nfebChans = (*subsetIt).second.size();
205 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
207 <<
"LArOFCSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
211 if (nfebChans) ++nsubsetsNotEmpty;
214 bool subsetIsSparse =
false;
215 for (
unsigned int j = 0; j < nfebChans; ++j) {
217 (*subsetIt).second[j];
218 if (
ofc.OFC_aSize() == 0) {
219 if (!subsetIsSparse) {
221 subsetIsSparse =
true;
222 febsWithSparseData.push_back((*subsetIt).first);
230 nPhases =
ofc.OFC_aSize();
237 if (!foundOFCs && ncorrs>0) {
241 nPhases =
ofc.OFC_aSize();
252 unsigned int ndataTot = (nchans + ncorrs)*nPhases*
nSamples;
253 unsigned int nTime = (nchans + ncorrs);
254 persObj->
m_vOFC_a.reserve(ndataTot);
255 persObj->
m_vOFC_b.reserve(ndataTot);
263 if (febsWithSparseData.size())
267 unsigned int isparse = 0;
269 subsetIt != subsetEnd;
272 unsigned int nfebChans = (*subsetIt).second.size();
275 if (nfebChans == 0)
continue;
277 unsigned int febid = (*subsetIt).first;
281 bool isSparse =
false;
282 if (isparse < febsWithSparseData.size() &&
283 febsWithSparseData[isparse] == febid) {
292 unsigned int chansSet = 0;
293 unsigned int chansOffset = 0;
294 for (
unsigned int j = 0; j < nfebChans; ++j){
296 bool saveOFCs =
true;
299 if ((*subsetIt).second[j].OFC_aSize() > 0) {
301 assert (j >= chansOffset && (j - chansOffset) <= 31);
302 chansSet |= (1 << (j - chansOffset));
308 if (j == (chansOffset + 31) || j == nfebChans-1) {
317 for (
unsigned int k = 0;
k < nPhases; ++
k) {
320 if (
k >= (*subsetIt).second[j].OFC_aSize() ||
321 l >= (*subsetIt).second[j].OFC_a(
k).size())
328 persObj->
m_vOFC_a.push_back((*subsetIt).second[j].OFC_a(
k)[
l]);
329 persObj->
m_vOFC_b.push_back((*subsetIt).second[j].OFC_b(
k)[
l]);
337 persObj->
m_timeOffset.push_back((*subsetIt).second[j].timeOffset());
338 persObj->
m_timeBinWidth.push_back((*subsetIt).second[j].timeBinWidth());
340 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": OFC object too small. Expected "
341 << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;
366 for (
unsigned int k = 0;
k < nPhases; ++
k) {
369 if (
k >= corrIt->second.OFC_aSize() ||
370 l >= corrIt->second.OFC_a(
k).size())
377 persObj->
m_vOFC_a.push_back(corrIt->second.OFC_a(
k)[
l]);
378 persObj->
m_vOFC_b.push_back(corrIt->second.OFC_b(
k)[
l]);
383 persObj->
m_timeOffset.push_back(corrIt->second.timeOffset());
386 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
387 "): OFC object too small. Expected " << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;