11 MsgStream & log)
const
19 unsigned int shapeIndex = 0;
20 unsigned int shapederIndex = 0;
23 unsigned int ifebWithData = 0;
26 for (
unsigned int i = 0; i < nfebids; ++i, ++subsetIt){
28 unsigned int febid = subsetIt->first;
30 bool hasSparseData =
false;
31 unsigned int chansSet = 0;
32 unsigned int chansOffset = 0;
44 for (
unsigned int j = 0; j < nChannelsPerFeb; ++j){
46 bool copyChannel =
true;
50 if (!(chansSet & (1 << (j - chansOffset)))) {
54 if (j%32 == 31 && j < nChannelsPerFeb-2) {
66 if (shapeIndex >= persObj->
m_vShape.size() ||
69 <<
"LArShapeSubsetCnv_p1::persToTrans - shape index too large: shape/size, shapeder/size "
70 << shapeIndex <<
" " << persObj->
m_vShape.size() <<
" "
71 << shapederIndex <<
" " << persObj->
m_vShapeDer.size()
77 subsetIt->second[j].m_vShape.resize(nShapes);
78 subsetIt->second[j].m_vShapeDer.resize(nShapeDers);
80 for (
unsigned int k = 0; k < persObj->
m_vShapeSize; ++k){
81 subsetIt->second[j].m_vShape[k] = persObj->
m_vShape[shapeIndex];
86 subsetIt->second[j].m_vShapeDer[k] = persObj->
m_vShapeDer[shapederIndex];
112 std::vector<float> vShape(nShapes,0.0);
113 std::vector<float> vShapeDer(nShapeDers,0.0);
120 for (
unsigned int i = 0; i < ncorrs; ++i){
122 if (shapeIndex >= persObj->
m_vShape.size() ||
125 <<
"LArShapeSubsetCnv_p1::persToTrans - shape index too large: shape/size, shapeder/size "
126 << shapeIndex <<
" " << persObj->
m_vShape.size() <<
" "
127 << shapederIndex <<
" " << persObj->
m_vShapeDer.size()
133 for (
unsigned int k = 0; k < persObj->
m_vShapeSize; ++k){
134 corrs[i].second.m_vShape[k] = persObj->
m_vShape[shapeIndex];
139 corrs[i].second.m_vShapeDer[k] = persObj->
m_vShapeDer[shapederIndex];
156 MsgStream &log)
const
191 unsigned int nsubsetsNotEmpty = 0;
193 unsigned int nchans = 0;
194 unsigned int nShapes = 0;
195 unsigned int nShapeDers = 0;
196 bool foundNShapes =
false;
197 std::vector<unsigned int> febsWithSparseData;
201 const auto subsetEnd = transObj->
subsetEnd();
203 subsetIt != subsetEnd;
206 unsigned int nfebChans = subsetIt->second.size();
208 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
210 <<
"LArShapeSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
214 if (nfebChans) ++nsubsetsNotEmpty;
217 bool subsetIsSparse =
false;
218 for (
unsigned int j = 0; j < nfebChans; ++j) {
219 const LArShapeP1& shape = subsetIt->second[j];
221 if (!subsetIsSparse) {
223 subsetIsSparse =
true;
224 febsWithSparseData.push_back(subsetIt->first);
238 if (!foundNShapes && ncorrs > 0) {
245 if (nShapes == 0 && nShapeDers == 0) {
247 <<
"LArShapeSubsetCnv_p1::transToPers - cannot get number of shapes and shape derivatives"
259 unsigned int nShapesTot = (nchans + ncorrs)*nShapes;
260 unsigned int nShapeDersTot = (nchans + ncorrs)*nShapeDers;
261 persObj->
m_vShape.reserve(nShapesTot);
268 if (febsWithSparseData.size())
272 unsigned int isparse = 0;
274 subsetIt != subsetEnd;
277 unsigned int nfebChans = subsetIt->second.size();
280 if (nfebChans == 0)
continue;
282 unsigned int febid = subsetIt->first;
286 bool isSparse =
false;
287 if (isparse < febsWithSparseData.size() &&
288 febsWithSparseData[isparse] == febid) {
298 unsigned int chansSet = 0;
299 unsigned int chansOffset = 0;
300 for (
unsigned int j = 0; j < nfebChans; ++j){
302 bool saveShapes =
true;
306 if (subsetIt->second[j].m_vShape.size() > 0) {
308 assert (j >= chansOffset && (j - chansOffset) <= 31);
310 chansSet |= (1 << (j - chansOffset));
316 if (j == (chansOffset + 31) || j == nfebChans-1) {
324 for (
unsigned int k = 0; k < nShapes; ++k){
325 persObj->
m_vShape.push_back(subsetIt->second[j].m_vShape[k]);
328 for (
unsigned int k = 0; k < nShapeDers; ++k){
329 persObj->
m_vShapeDer.push_back(subsetIt->second[j].m_vShapeDer[k]);
353 for (
unsigned int k = 0; k < nShapes; ++k){
354 persObj->
m_vShape.push_back(corrIt->second.m_vShape[k]);
357 for (
unsigned int k = 0; k < nShapeDers; ++k){
358 persObj->
m_vShapeDer.push_back(corrIt->second.m_vShapeDer[k]);
This file defines the template class used for I/O of conditions data.
LArShapeSubset_p1 LArShapePersType1
LArConditionsSubset< LArShapeP1 > LArShapeTransType1
std::vector< unsigned int > m_febIds
std::vector< unsigned int > m_corrChannels
unsigned int subsetSize() const
std::vector< unsigned int > m_febsWithSparseData
unsigned int m_groupingType
std::pair< ChannelId, LArShapeP1 > CorrectionPair
void initialize(const std::vector< FebId > &ids, unsigned int gain)
Initialize with set of FEB ids.
ConstSubsetIt subsetEnd() const
unsigned channelVectorSize() const
ConstCorrectionVecIt correctionVecBegin() const
Iterators over channel set.
unsigned int groupingType() const
Type of grouping - defined in LArConditionsContainerBase.h.
ConstCorrectionVecIt correctionVecEnd() const
void setGroupingType(unsigned int type)
set the type of grouping - defined in LArConditionsContainerBase.h
ConstSubsetIt subsetBegin() const
Iterators over subset.
unsigned int gain() const
Access to gain.
size_type correctionVecSize() const
Size of channel set.
std::vector< CorrectionPair > CorrectionVec
unsigned int channel() const
Access to the COOL channel number.
void insertCorrections(CorrectionVec &&corrs)
Insert a group of corrections.
void setChannel(unsigned int channel)
set the COOL channel number
c-struct reproducing the structure of the persistent data
std::vector< float > m_vShapeDer
std::vector< float > m_vShape
virtual void persToTrans(const LArShapePersType1 *persObj, LArShapeTransType1 *transObj, MsgStream &log) const override
virtual void transToPers(const LArShapeTransType1 *transObj, LArShapePersType1 *persObj, MsgStream &log) const override
unsigned int m_vShapeDerSize
std::vector< float > m_vShape
unsigned int m_vShapeSize
std::vector< float > m_vShapeDer
LArConditionsSubset_p1 m_subset