ATLAS Offline Software
Loading...
Searching...
No Matches
LArPedestalSubsetCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8void
10 LArPedestalTransType* transObj,
11 MsgStream & log) const
12{
13 transObj->initialize (persObj->m_subset.m_febIds, persObj->m_subset.m_gain);
14
15 // Copy conditions
16 unsigned int nfebids = persObj->m_subset.m_febIds.size();
17 unsigned int nPedestals = persObj->m_vPedestalSize;
18 unsigned int nPedestalRMSs = persObj->m_vPedestalRMSSize;
19 unsigned int pedestalIndex = 0;
20 unsigned int pedestalrmsIndex = 0;
21 const unsigned int nChannelsPerFeb = persObj->m_subset.subsetSize();
22 // Loop over febs
23 unsigned int ifebWithData = 0; // counter for febs with data
24
25 auto subsetIt = transObj->subsetBegin();
26 for (unsigned int i = 0; i < nfebids; ++i, ++subsetIt){
27 // Set febid
28 unsigned int febid = subsetIt->first;
29 bool hasSparseData = false;
30 unsigned int chansSet = 0;
31 unsigned int chansOffset = 0;
32 if (ifebWithData+1 < persObj->m_subset.m_febsWithSparseData.size() &&
33 febid == persObj->m_subset.m_febsWithSparseData[ifebWithData]) {
34 // Found feb with sparse data
35 hasSparseData = true;
36 ifebWithData++;
37 chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData];
38 chansOffset = 0;
39 ifebWithData++;
40 }
41
42 // Loop over channels in feb - only some channels are filled
43 for (unsigned int j = 0; j < nChannelsPerFeb; ++j){
44
45 bool copyChannel = true;
46 if (hasSparseData) {
47 // coverity[bad_shift]
48 // coverity[integer_overflow]
49 if (!(chansSet & (1 << (j - chansOffset)))) {
50 // Channel is missing data - skip
51 copyChannel = false;
52 }
53 if (j%32 == 31 && j < nChannelsPerFeb-2) {
54 chansSet = persObj->m_subset.m_febsWithSparseData[ifebWithData];
55 chansOffset += 32;
56 ifebWithData++;
57 }
58 }
59 if (copyChannel) {
60
61 // Channel has pedestals - loop over pedestals per channel
62 // and copy to the persistent object
63
64 // check indexes
65 if (pedestalIndex >= persObj->m_vPedestal.size() ||
66 pedestalrmsIndex >= persObj->m_vPedestalRMS.size()) {
67 log << MSG::ERROR
68 << "LArPedestalSubsetCnv_p1::persToTrans - pedestal index too large: pedestal/size, pedestalrms/size "
69 << pedestalIndex << " " << persObj->m_vPedestal.size() << " "
70 << pedestalrmsIndex << " " << persObj->m_vPedestalRMS.size()
71 << endmsg;
72 return;
73 }
74
75 // This channel has pedestals, resize vectors
76 //subsetIt->second[j].m_vPedestal.resize(nPedestals);
77 //subsetIt->second[j].m_vPedestalRMS.resize(nPedestalRMSs);
78 if (nPedestals)
79 subsetIt->second[j].m_Pedestal = persObj->m_vPedestal[pedestalIndex];
80 pedestalIndex+=nPedestals;
81
82 if (nPedestalRMSs)
83 subsetIt->second[j].m_PedestalRMS = persObj->m_vPedestalRMS[pedestalrmsIndex];
84 pedestalrmsIndex+=nPedestalRMSs;
85 }//end if copychannel
86
87 }//end loop over channels in feb
88 }// end loop over febs
89
90 // Copy corrections
91
92 unsigned int ncorrs = persObj->m_subset.m_corrChannels.size();
94 corrs.resize (ncorrs);
95 if (ncorrs) {
96 // Loop over corrections
97 for (unsigned int i = 0; i < ncorrs; ++i){
98 // check indexes
99 if (pedestalIndex >= persObj->m_vPedestal.size() ||
100 pedestalrmsIndex >= persObj->m_vPedestalRMS.size()) {
101 log << MSG::ERROR
102 << "LArPedestalSubsetCnv_p1::persToTrans - pedestal index too large: pedestal/size, pedestalrms/size "
103 << pedestalIndex << " " << persObj->m_vPedestal.size() << " "
104 << pedestalrmsIndex << " " << persObj->m_vPedestalRMS.size()
105 << endmsg;
106 return;
107 }
108 corrs[i].first = persObj->m_subset.m_corrChannels[i];
109
110 if (nPedestals)
111 corrs[i].second.m_Pedestal = persObj->m_vPedestal[pedestalIndex];
112 pedestalIndex+=nPedestals;
113
114
115 if (nPedestalRMSs)
116 corrs[i].second.m_PedestalRMS = persObj->m_vPedestalRMS[pedestalrmsIndex];
117 pedestalrmsIndex+=nPedestalRMSs;
118
119 }// end loop over corrections
120
121 }//end if ncorr
122 transObj->insertCorrections (std::move (corrs));
123
124 // Copy the rest
125 transObj->setChannel (persObj->m_subset.m_channel);
126 transObj->setGroupingType (persObj->m_subset.m_groupingType);
127}
128
129
130
131
132void
134 LArPedestalPersType* /*persObj*/,
135 MsgStream &log) const
136{
137
138 log << MSG::ERROR << "LArPedestalSubset_p1 is obsolete and can't be written out any more." << endmsg;
139 return;
140}
141
#define endmsg
This file defines the template class used for I/O of conditions data.
LArConditionsSubset< LArPedestalP1 > LArPedestalTransType
LArPedestalSubset_p1 LArPedestalPersType
std::vector< unsigned int > m_febIds
std::vector< unsigned int > m_corrChannels
unsigned int subsetSize() const
std::vector< unsigned int > m_febsWithSparseData
void initialize(const std::vector< FebId > &ids, unsigned int gain)
Initialize with set of FEB ids.
void setGroupingType(unsigned int type)
set the type of grouping - defined in LArConditionsContainerBase.h
ConstSubsetIt subsetBegin() const
Iterators over subset.
std::vector< CorrectionPair > CorrectionVec
void insertCorrections(CorrectionVec &&corrs)
Insert a group of corrections.
void setChannel(unsigned int channel)
set the COOL channel number
virtual void transToPers(const LArPedestalTransType *transObj, LArPedestalPersType *persObj, MsgStream &log) const override
virtual void persToTrans(const LArPedestalPersType *persObj, LArPedestalTransType *transObj, MsgStream &log) const override
std::vector< float > m_vPedestal
LArConditionsSubset_p1 m_subset
std::vector< float > m_vPedestalRMS