12 MsgStream &
log)
const
24 unsigned int rampIndex = 0;
27 unsigned int ifebWithData = 0;
30 for (
unsigned int i = 0;
i < nfebids; ++
i, ++subsetIt){
32 unsigned int febid = subsetIt->first;
34 bool hasSparseData =
false;
35 unsigned int chansSet = 0;
36 unsigned int chansOffset = 0;
48 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
50 bool copyChannel =
true;
54 if (!(chansSet & (1 << (j - chansOffset)))) {
58 if (j%32 == 31 && j < nChannelsPerFeb-2) {
72 <<
"LArRampSubsetCnv_p1::persToTrans - ramp index too large: ramp/size "
73 << rampIndex <<
" " << persObj->
m_vRamp.size() <<
" "
79 subsetIt->second[j].m_vRamp.resize(nRamps);
82 subsetIt->second[j].m_vRamp[
k] = persObj->
m_vRamp[rampIndex];
106 std::vector<float> vRamp(nRamps,0.0);
113 for (
unsigned int i = 0;
i < ncorrs; ++
i){
117 <<
"LArRampSubsetCnv_p1::persToTrans - ramp index too large: ramp/size "
118 << rampIndex <<
" " << persObj->
m_vRamp.size() <<
" "
125 corrs[
i].second.m_vRamp[
k] = persObj->
m_vRamp[rampIndex];
139 MsgStream &
log)
const
173 unsigned int nsubsetsNotEmpty = 0;
176 unsigned int nchans = 0;
177 unsigned int nRamps = 0;
178 bool foundNRamps =
false;
179 std::vector<unsigned int> febsWithSparseData;
183 const auto subsetEnd = transObj->
subsetEnd();
185 subsetIt != subsetEnd;
188 unsigned int nfebChans = subsetIt->second.size();
190 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
192 <<
"LArRampSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
196 if (nfebChans) ++nsubsetsNotEmpty;
199 bool subsetIsSparse =
false;
200 for (
unsigned int j = 0; j < nfebChans; ++j) {
201 const LArRampP1& ramp = subsetIt->second[j];
202 if (ramp.
m_vRamp.size() == 0) {
203 if (!subsetIsSparse) {
205 subsetIsSparse =
true;
206 febsWithSparseData.push_back(subsetIt->first);
219 if (!foundNRamps && ncorrs>0) {
233 unsigned int nRampsTot = (nchans + ncorrs)*nRamps;
234 persObj->
m_vRamp.reserve(nRampsTot);
240 if (febsWithSparseData.size())
244 unsigned int isparse = 0;
246 subsetIt != subsetEnd;
249 unsigned int nfebChans = subsetIt->second.size();
252 if (nfebChans == 0)
continue;
254 unsigned int febid = subsetIt->first;
258 bool isSparse =
false;
259 if (isparse < febsWithSparseData.size() &&
260 febsWithSparseData[isparse] == febid) {
269 unsigned int chansSet = 0;
270 unsigned int chansOffset = 0;
271 for (
unsigned int j = 0; j < nfebChans; ++j){
273 bool saveRamps =
true;
277 if (subsetIt->second[j].m_vRamp.size() > 0) {
279 assert (j >= chansOffset && (j - chansOffset) <= 31);
281 chansSet |= (1 << (j - chansOffset));
287 if (j == (chansOffset + 31) || j == nfebChans-1 ) {
296 for (
unsigned int k = 0;
k < nRamps; ++
k){
297 if (
k>=subsetIt->second[j].m_vRamp.size()) {
299 persObj->
m_vRamp.push_back(0.0);
302 persObj->
m_vRamp.push_back(subsetIt->second[j].m_vRamp[
k]);
305 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": Ramp object too small. Expected a polynom of degree "
306 << nRamps <<
". Padded with 0.0" <<
endmsg;
330 for (
unsigned int k = 0;
k < nRamps; ++
k){
331 if (
k>=corrIt->second.m_vRamp.size()) {
333 persObj->
m_vRamp.push_back(0.0);
336 persObj->
m_vRamp.push_back(corrIt->second.m_vRamp[
k]);
339 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
340 "): Ramp object too small. Expected a polynom of degree " << nRamps <<
". Padded with 0.0" <<
endmsg;