ATLAS Offline Software
Loading...
Searching...
No Matches
LArDSPThresholdsSubsetCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7void
9 DSPThresholdsTransType* transObj,
10 MsgStream & /*log*/) const
11{
12 transObj->initialize (persObj->m_subset.m_febIds, persObj->m_subset.m_gain);
13
14 unsigned int nfebids = persObj->m_subset.m_febIds.size();
15 unsigned index =0;
16 const unsigned int nChannelsPerFeb = persObj->m_subset.subsetSize();
17 auto subsetIt = transObj->subsetBegin();
18 for (unsigned int i = 0; i < nfebids; ++i, ++subsetIt){
19 // Loop over channels in feb
20 for (unsigned int j = 0; j < nChannelsPerFeb; ++j){
21 subsetIt->second[j].set(persObj->m_tQThr[index],persObj->m_samplesThr[index],persObj->m_trigSumThr[index]);
22 ++index;
23 }
24 }
25
26 unsigned int ncorrs = persObj->m_subset.m_corrChannels.size();
28 corrs.resize(ncorrs);
29
30 // Loop over corrections
31 for (unsigned int i = 0; i < ncorrs; ++i){
32 corrs[i].first = persObj->m_subset.m_corrChannels[i];
33 corrs[i].second.set(persObj->m_tQThr[index],persObj->m_samplesThr[index],persObj->m_trigSumThr[index]);
34 ++index;
35 }
36 transObj->insertCorrections (std::move (corrs));
37
38 // Copy the rest
39 transObj->setChannel (persObj->m_subset.m_channel);
40 transObj->setGroupingType (persObj->m_subset.m_groupingType);
41
42 return;
43}
44
45
46
47
48
49void
51 DSPThresholdsPersType* persObj,
52 MsgStream &log) const
53{
54 // Get the number of channels, corrections and the size of pedestal and pedestalrms
55 unsigned int ncorrs = transObj->correctionVecSize();
56 unsigned int nsubsetsNotEmpty = 0;
57 const unsigned int nChannelsPerFeb = transObj->channelVectorSize();
58 const auto subsetEnd = transObj->subsetEnd();
59 for (auto subsetIt = transObj->subsetBegin();
60 subsetIt != subsetEnd;
61 ++subsetIt)
62 {
63 unsigned int nfebChans = subsetIt->second.size();
64 if (nfebChans != 0 && nfebChans != nChannelsPerFeb) {
65 log << MSG::ERROR
66 << "LArDSPThresholdsSubsetCnv_p1::transToPers - found incorrect number of channels per feb: " << nfebChans
67 << endmsg;
68 return;
69 }
70 if (nfebChans) ++nsubsetsNotEmpty; // count number of non-empty subsets
71 }
72
73 // Reserve space in vectors
74 persObj->m_subset.m_febIds.reserve(nsubsetsNotEmpty);
75 persObj->m_subset.m_corrChannels.reserve(ncorrs);
76 persObj->m_tQThr.reserve(ncorrs+nsubsetsNotEmpty*nChannelsPerFeb);
77 persObj->m_samplesThr.reserve(ncorrs+nsubsetsNotEmpty*nChannelsPerFeb);
78 persObj->m_trigSumThr.reserve(ncorrs+nsubsetsNotEmpty*nChannelsPerFeb);
79
80 //Copy subsets
81 for (auto subsetIt = transObj->subsetBegin();
82 subsetIt != subsetEnd;
83 ++subsetIt)
84 {
85 unsigned int nfebChans = subsetIt->second.size();
86 if (nfebChans==0) continue;
87 unsigned int febid = subsetIt->first;
88 persObj->m_subset.m_febIds.push_back(febid);
89 for (unsigned int j=0; j<nfebChans;++j) { //Loop over channels in FEB
90 persObj->m_tQThr.push_back(subsetIt->second[j].tQThr());
91 persObj->m_samplesThr.push_back(subsetIt->second[j].samplesThr());
92 persObj->m_trigSumThr.push_back(subsetIt->second[j].trigSumThr());
93 }
94 }
95
96 // Copy corrections
97 const auto corrEnd = transObj->correctionVecEnd();
98 for (auto corrIt = transObj->correctionVecBegin();
99 corrIt != corrEnd;
100 ++corrIt)
101 {
102 persObj->m_subset.m_corrChannels.push_back(corrIt->first);
103 persObj->m_tQThr.push_back(corrIt->second.tQThr());
104 persObj->m_samplesThr.push_back(corrIt->second.samplesThr());
105 persObj->m_trigSumThr.push_back(corrIt->second.trigSumThr());
106 }
107
108 // Copy the rest
109 persObj->m_subset.m_gain = transObj->gain();
110 persObj->m_subset.m_channel = transObj->channel();
111 persObj->m_subset.m_groupingType = transObj->groupingType();
112}
#define endmsg
LArConditionsSubset< LArDSPThresholdsP > DSPThresholdsTransType
LArDSPThresholdsSubset_p1 DSPThresholdsPersType
std::vector< unsigned int > m_febIds
std::vector< unsigned int > m_corrChannels
unsigned int subsetSize() const
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
virtual void transToPers(const DSPThresholdsTransType *transObj, DSPThresholdsPersType *persObj, MsgStream &log) const override
virtual void persToTrans(const DSPThresholdsPersType *persObj, DSPThresholdsTransType *transObj, MsgStream &log) const override
Definition index.py:1