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;
37 if (ifebWithData < persObj->m_subset.m_febsWithSparseData.size() &&
48 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
50 bool copyChannel =
true;
52 if (!(chansSet & (1 << (j - chansOffset)))) {
56 if (j%32 == 31 && j < nChannelsPerFeb-2) {
70 <<
"LArRampSubsetCnv_p1::persToTrans - ramp index too large: ramp/size "
71 << rampIndex <<
" " << persObj->
m_vRamp.size() <<
" "
77 subsetIt->second[j].m_vRamp.resize(nRamps);
80 subsetIt->second[j].m_vRamp[
k] = persObj->
m_vRamp[rampIndex];
104 std::vector<float> vRamp(nRamps,0.0);
111 for (
unsigned int i = 0;
i < ncorrs; ++
i){
115 <<
"LArRampSubsetCnv_p1::persToTrans - ramp index too large: ramp/size "
116 << rampIndex <<
" " << persObj->
m_vRamp.size() <<
" "
123 corrs[
i].second.m_vRamp[
k] = persObj->
m_vRamp[rampIndex];
137 MsgStream &
log)
const
171 unsigned int nsubsetsNotEmpty = 0;
174 unsigned int nchans = 0;
175 unsigned int nRamps = 0;
176 bool foundNRamps =
false;
177 std::vector<unsigned int> febsWithSparseData;
181 const auto subsetEnd = transObj->
subsetEnd();
183 subsetIt != subsetEnd;
186 unsigned int nfebChans = subsetIt->second.size();
188 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
190 <<
"LArRampSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
194 if (nfebChans) ++nsubsetsNotEmpty;
197 bool subsetIsSparse =
false;
198 for (
unsigned int j = 0; j < nfebChans; ++j) {
199 const LArRampP1& ramp = subsetIt->second[j];
200 if (ramp.
m_vRamp.size() == 0) {
201 if (!subsetIsSparse) {
203 subsetIsSparse =
true;
204 febsWithSparseData.push_back(subsetIt->first);
217 if (!foundNRamps && ncorrs>0) {
231 unsigned int nRampsTot = (nchans + ncorrs)*nRamps;
232 persObj->
m_vRamp.reserve(nRampsTot);
238 if (febsWithSparseData.size())
242 unsigned int isparse = 0;
244 subsetIt != subsetEnd;
247 unsigned int nfebChans = subsetIt->second.size();
250 if (nfebChans == 0)
continue;
252 unsigned int febid = subsetIt->first;
256 bool isSparse =
false;
257 if (isparse < febsWithSparseData.size() &&
258 febsWithSparseData[isparse] == febid) {
267 unsigned int chansSet = 0;
268 unsigned int chansOffset = 0;
269 for (
unsigned int j = 0; j < nfebChans; ++j){
271 bool saveRamps =
true;
275 if (subsetIt->second[j].m_vRamp.size() > 0) {
277 assert (j >= chansOffset && (j - chansOffset) <= 31);
278 chansSet |= (1 << (j - chansOffset));
284 if (j == (chansOffset + 31) || j == nfebChans-1 ) {
293 for (
unsigned int k = 0;
k < nRamps; ++
k){
294 if (
k>=subsetIt->second[j].m_vRamp.size()) {
296 persObj->
m_vRamp.push_back(0.0);
299 persObj->
m_vRamp.push_back(subsetIt->second[j].m_vRamp[
k]);
302 log << MSG::ERROR <<
"Feb 0x" << std::hex << febid << std::dec <<
" channel " << j <<
": Ramp object too small. Expected a polynom of degree "
303 << nRamps <<
". Padded with 0.0" <<
endmsg;
327 for (
unsigned int k = 0;
k < nRamps; ++
k){
328 if (
k>=corrIt->second.m_vRamp.size()) {
330 persObj->
m_vRamp.push_back(0.0);
333 persObj->
m_vRamp.push_back(corrIt->second.m_vRamp[
k]);
336 log << MSG::ERROR <<
"Correction (channel 0x" << std::hex << corrIt->first << std::dec <<
337 "): Ramp object too small. Expected a polynom of degree " << nRamps <<
". Padded with 0.0" <<
endmsg;