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;
50 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
52 bool copyChannel =
true;
56 if (!(chansSet & (1 << (j - chansOffset)))) {
60 if (j%32 == 31 && j < nChannelsPerFeb-2) {
77 <<
"LArShapeSubsetCnv_p2::persToTrans - shape index too large: shapeIndex size shape, size shapeDer, timeIndex timeOffset size, timeBinWidth size "
78 << dataIndex <<
" " << persObj->
m_vShape.size() <<
" "
79 << persObj->
m_vShapeDer.size() <<
" " << timeIndex <<
" "
87 (*subsetIt).second[j];
101 (*subsetIt).second[j].assign
104 std::vector<std::vector<float> >(),
105 std::vector<std::vector<float> >()));
120 std::vector<float> vSamples(
nSamples, 0.0);
121 std::vector<std::vector<float> > vShape(nPhases, vSamples);
122 LArShapeP2 larShapeP2(0.0, 0.0, vShape, vShape);
128 for (
unsigned int i = 0;
i < ncorrs; ++
i){
135 <<
"LArShapeSubsetCnv_p2::persToTrans - data index too large: dataIndex size shape, size shapeDer, timeIndex timeOffset size, timeBinWidth size "
136 << dataIndex <<
" " << persObj->
m_vShape.size() <<
" "
137 << nPhases <<
" " <<
nSamples <<
" "
138 << persObj->
m_vShapeDer.size() <<
" " << timeIndex <<
" "
171 MsgStream &
log)
const
205 unsigned int nsubsetsNotEmpty = 0;
208 unsigned int nchans = 0;
209 unsigned int nPhases = 0;
211 bool foundShapes =
false;
212 std::vector<unsigned int> febsWithSparseData;
216 const auto subsetEnd = transObj->
subsetEnd();
218 subsetIt != subsetEnd;
221 unsigned int nfebChans = (*subsetIt).second.size();
223 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
225 <<
"LArShapeSubsetCnv_p2::transToPers - found incorrect number of channels per feb: " << nfebChans
229 if (nfebChans) ++nsubsetsNotEmpty;
232 bool subsetIsSparse =
false;
233 for (
unsigned int j = 0; j < nfebChans; ++j) {
235 (*subsetIt).second[j];
236 if (shapes.shapeSize() == 0) {
237 if (!subsetIsSparse) {
239 subsetIsSparse =
true;
240 febsWithSparseData.push_back((*subsetIt).first);
248 nPhases = shapes.shapeSize();
255 if (!foundShapes && ncorrs>0) {
270 unsigned int ndataTot = (nchans + ncorrs)*nPhases*
nSamples;
271 unsigned int nTime = (nchans + ncorrs);
272 persObj->
m_vShape.reserve(ndataTot);
281 if (febsWithSparseData.size())
285 unsigned int isparse = 0;
287 subsetIt != subsetEnd;
290 unsigned int nfebChans = (*subsetIt).second.size();
293 if (nfebChans == 0)
continue;
295 unsigned int febid = (*subsetIt).first;
299 bool isSparse =
false;
300 if (isparse < febsWithSparseData.size() &&
301 febsWithSparseData[isparse] == febid) {
310 unsigned int chansSet = 0;
311 unsigned int chansOffset = 0;
312 for (
unsigned int j = 0; j < nfebChans; ++j){
314 bool saveShapes =
true;
317 if ((*subsetIt).second[j].shapeSize() > 0) {
319 assert (j >= chansOffset && (j - chansOffset) <= 31);
321 chansSet |= (1 << (j - chansOffset));
327 if (j == (chansOffset + 31) || j == nfebChans-1 ) {
336 for (
unsigned int k = 0;
k < nPhases; ++
k) {
339 if (
k>=(*subsetIt).second[j].shapeSize() ||
340 l>=(*subsetIt).second[j].shape(
k).size())
347 persObj->
m_vShape.push_back((*subsetIt).second[j].shape(
k)[
l]);
348 persObj->
m_vShapeDer.push_back((*subsetIt).second[j].shapeDer(
k)[
l]);
356 persObj->
m_timeOffset.push_back((*subsetIt).second[j].timeOffset());
357 persObj->
m_timeBinWidth.push_back((*subsetIt).second[j].timeBinWidth());
359 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": Shape object too small. Expected "
360 << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;
385 for (
unsigned int k = 0;
k < nPhases; ++
k) {
387 if (
k>=corrIt->second.shapeSize() ||
388 l>=corrIt->second.shape(
k).size())
395 persObj->
m_vShape.push_back(corrIt->second.shape(
k)[
l]);
396 persObj->
m_vShapeDer.push_back(corrIt->second.shapeDer(
k)[
l]);
401 persObj->
m_timeOffset.push_back(corrIt->second.timeOffset());
404 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
405 "): Shape object too small. Expected " << nPhases <<
" phases and " <<
nSamples <<
" samples. Padded with 0.0" <<
endmsg;