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() &&
50 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
52 bool copyChannel =
true;
54 if (!(chansSet & (1 << (j - chansOffset)))) {
58 if (j%32 == 31 && j < nChannelsPerFeb-2) {
75 <<
"LArShapeSubsetCnv_p2::persToTrans - shape index too large: shapeIndex size shape, size shapeDer, timeIndex timeOffset size, timeBinWidth size "
76 << dataIndex <<
" " << persObj->
m_vShape.size() <<
" "
77 << persObj->
m_vShapeDer.size() <<
" " << timeIndex <<
" "
85 (*subsetIt).second[j];
99 (*subsetIt).second[j].assign
102 std::vector<std::vector<float> >(),
103 std::vector<std::vector<float> >()));
118 std::vector<float> vSamples(
nSamples, 0.0);
119 std::vector<std::vector<float> > vShape(nPhases, vSamples);
120 LArShapeP2 larShapeP2(0.0, 0.0, vShape, vShape);
126 for (
unsigned int i = 0;
i < ncorrs; ++
i){
133 <<
"LArShapeSubsetCnv_p2::persToTrans - data index too large: dataIndex size shape, size shapeDer, timeIndex timeOffset size, timeBinWidth size "
134 << dataIndex <<
" " << persObj->
m_vShape.size() <<
" "
135 << nPhases <<
" " <<
nSamples <<
" "
136 << persObj->
m_vShapeDer.size() <<
" " << timeIndex <<
" "
169 MsgStream &
log)
const
203 unsigned int nsubsetsNotEmpty = 0;
206 unsigned int nchans = 0;
207 unsigned int nPhases = 0;
209 bool foundShapes =
false;
210 std::vector<unsigned int> febsWithSparseData;
214 const auto subsetEnd = transObj->
subsetEnd();
216 subsetIt != subsetEnd;
219 unsigned int nfebChans = (*subsetIt).second.size();
221 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
223 <<
"LArShapeSubsetCnv_p2::transToPers - found incorrect number of channels per feb: " << nfebChans
227 if (nfebChans) ++nsubsetsNotEmpty;
230 bool subsetIsSparse =
false;
231 for (
unsigned int j = 0; j < nfebChans; ++j) {
233 (*subsetIt).second[j];
234 if (shapes.shapeSize() == 0) {
235 if (!subsetIsSparse) {
237 subsetIsSparse =
true;
238 febsWithSparseData.push_back((*subsetIt).first);
246 nPhases = shapes.shapeSize();
253 if (!foundShapes && ncorrs>0) {
268 unsigned int ndataTot = (nchans + ncorrs)*nPhases*
nSamples;
269 unsigned int nTime = (nchans + ncorrs);
270 persObj->
m_vShape.reserve(ndataTot);
279 if (febsWithSparseData.size())
283 unsigned int isparse = 0;
285 subsetIt != subsetEnd;
288 unsigned int nfebChans = (*subsetIt).second.size();
291 if (nfebChans == 0)
continue;
293 unsigned int febid = (*subsetIt).first;
297 bool isSparse =
false;
298 if (isparse < febsWithSparseData.size() &&
299 febsWithSparseData[isparse] == febid) {
308 unsigned int chansSet = 0;
309 unsigned int chansOffset = 0;
310 for (
unsigned int j = 0; j < nfebChans; ++j){
312 bool saveShapes =
true;
315 if ((*subsetIt).second[j].shapeSize() > 0) {
317 assert (j >= chansOffset && (j - chansOffset) <= 31);
318 chansSet |= (1 << (j - chansOffset));
324 if (j == (chansOffset + 31) || j == nfebChans-1 ) {
333 for (
unsigned int k = 0;
k < nPhases; ++
k) {
336 if (
k>=(*subsetIt).second[j].shapeSize() ||
337 l>=(*subsetIt).second[j].shape(
k).size())
344 persObj->
m_vShape.push_back((*subsetIt).second[j].shape(
k)[
l]);
345 persObj->
m_vShapeDer.push_back((*subsetIt).second[j].shapeDer(
k)[
l]);
353 persObj->
m_timeOffset.push_back((*subsetIt).second[j].timeOffset());
354 persObj->
m_timeBinWidth.push_back((*subsetIt).second[j].timeBinWidth());
356 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": Shape object too small. Expected "
357 << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;
382 for (
unsigned int k = 0;
k < nPhases; ++
k) {
384 if (
k>=corrIt->second.shapeSize() ||
385 l>=corrIt->second.shape(
k).size())
392 persObj->
m_vShape.push_back(corrIt->second.shape(
k)[
l]);
393 persObj->
m_vShapeDer.push_back(corrIt->second.shapeDer(
k)[
l]);
398 persObj->
m_timeOffset.push_back(corrIt->second.timeOffset());
401 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
402 "): Shape object too small. Expected " << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;