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;
49 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
51 bool copyChannel =
true;
55 if (!(chansSet & (1 << (j - chansOffset)))) {
59 if (j%32 == 31 && j < nChannelsPerFeb-2) {
71 if (dataIndex >= persObj->
m_vOFC_a.size() ||
72 dataIndex >= persObj->
m_vOFC_b.size() ||
76 <<
"LArOFCSubsetCnv_p1::persToTrans - ofc index too large: dataIndex size ofc_a, size ofc_b, timeIndex timeOffset size, timeBinWidth size "
77 << dataIndex <<
" " << persObj->
m_vOFC_a.size() <<
" "
78 << persObj->
m_vOFC_b.size() <<
" " << timeIndex <<
" "
86 (*subsetIt).second[j];
107 std::vector<float> vSamples(
nSamples, 0.0);
108 std::vector<std::vector<float> > vOFC(nPhases, vSamples);
109 LArOFCP1 larOFCP1(0.0, 0.0, vOFC, vOFC);
115 for (
unsigned int i = 0;
i < ncorrs; ++
i){
117 if (dataIndex >= persObj->
m_vOFC_a.size() ||
118 dataIndex >= persObj->
m_vOFC_b.size() ||
122 <<
"LArOFCSubsetCnv_p1::persToTrans - ofc index too large: dataIndex size ofc_a, size ofc_b, timeIndex timeOffset size, timeBinWidth size "
123 << dataIndex <<
" " << persObj->
m_vOFC_a.size() <<
" "
124 << persObj->
m_vOFC_b.size() <<
" " << timeIndex <<
" "
155 MsgStream &
log)
const
189 unsigned int nsubsetsNotEmpty = 0;
192 unsigned int nchans = 0;
193 unsigned int nPhases = 0;
195 bool foundOFCs =
false;
196 std::vector<unsigned int> febsWithSparseData;
200 const auto subsetEnd = transObj->
subsetEnd();
202 subsetIt != subsetEnd;
205 unsigned int nfebChans = (*subsetIt).second.size();
207 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
209 <<
"LArOFCSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
213 if (nfebChans) ++nsubsetsNotEmpty;
216 bool subsetIsSparse =
false;
217 for (
unsigned int j = 0; j < nfebChans; ++j) {
219 (*subsetIt).second[j];
220 if (
ofc.OFC_aSize() == 0) {
221 if (!subsetIsSparse) {
223 subsetIsSparse =
true;
224 febsWithSparseData.push_back((*subsetIt).first);
232 nPhases =
ofc.OFC_aSize();
239 if (!foundOFCs && ncorrs>0) {
243 nPhases =
ofc.OFC_aSize();
254 unsigned int ndataTot = (nchans + ncorrs)*nPhases*
nSamples;
255 unsigned int nTime = (nchans + ncorrs);
256 persObj->
m_vOFC_a.reserve(ndataTot);
257 persObj->
m_vOFC_b.reserve(ndataTot);
265 if (febsWithSparseData.size())
269 unsigned int isparse = 0;
271 subsetIt != subsetEnd;
274 unsigned int nfebChans = (*subsetIt).second.size();
277 if (nfebChans == 0)
continue;
279 unsigned int febid = (*subsetIt).first;
283 bool isSparse =
false;
284 if (isparse < febsWithSparseData.size() &&
285 febsWithSparseData[isparse] == febid) {
294 unsigned int chansSet = 0;
295 unsigned int chansOffset = 0;
296 for (
unsigned int j = 0; j < nfebChans; ++j){
298 bool saveOFCs =
true;
301 if ((*subsetIt).second[j].OFC_aSize() > 0) {
303 assert (j >= chansOffset && (j - chansOffset) <= 31);
305 chansSet |= (1 << (j - chansOffset));
311 if (j == (chansOffset + 31) || j == nfebChans-1) {
320 for (
unsigned int k = 0;
k < nPhases; ++
k) {
323 if (
k >= (*subsetIt).second[j].OFC_aSize() ||
324 l >= (*subsetIt).second[j].OFC_a(
k).size())
331 persObj->
m_vOFC_a.push_back((*subsetIt).second[j].OFC_a(
k)[
l]);
332 persObj->
m_vOFC_b.push_back((*subsetIt).second[j].OFC_b(
k)[
l]);
340 persObj->
m_timeOffset.push_back((*subsetIt).second[j].timeOffset());
341 persObj->
m_timeBinWidth.push_back((*subsetIt).second[j].timeBinWidth());
343 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": OFC object too small. Expected "
344 << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;
369 for (
unsigned int k = 0;
k < nPhases; ++
k) {
372 if (
k >= corrIt->second.OFC_aSize() ||
373 l >= corrIt->second.OFC_a(
k).size())
380 persObj->
m_vOFC_a.push_back(corrIt->second.OFC_a(
k)[
l]);
381 persObj->
m_vOFC_b.push_back(corrIt->second.OFC_b(
k)[
l]);
386 persObj->
m_timeOffset.push_back(corrIt->second.timeOffset());
389 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
390 "): OFC object too small. Expected " << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;