ATLAS Offline Software
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 
7 void
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 
49 void
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 }
LArConditionsSubset::setGroupingType
void setGroupingType(unsigned int type)
set the type of grouping - defined in LArConditionsContainerBase.h
Definition: LArConditionsSubset.h:575
LArConditionsSubset_p1::m_channel
unsigned int m_channel
Definition: LArConditionsSubset_p1.h:79
LArConditionsSubset_p1::m_corrChannels
std::vector< unsigned int > m_corrChannels
Definition: LArConditionsSubset_p1.h:76
index
Definition: index.py:1
LArConditionsSubset::channelVectorSize
unsigned channelVectorSize() const
Definition: LArConditionsSubset.h:608
LArDSPThresholdsSubsetCnv_p1::persToTrans
virtual void persToTrans(const DSPThresholdsPersType *persObj, DSPThresholdsTransType *transObj, MsgStream &log) const override
Definition: LArDSPThresholdsSubsetCnv_p1.cxx:8
LArConditionsSubset_p1::subsetSize
unsigned int subsetSize() const
Definition: LArConditionsSubset_p1.h:82
LArDSPThresholdsSubsetCnv_p1::transToPers
virtual void transToPers(const DSPThresholdsTransType *transObj, DSPThresholdsPersType *persObj, MsgStream &log) const override
Definition: LArDSPThresholdsSubsetCnv_p1.cxx:50
LArConditionsSubset_p1::m_gain
unsigned int m_gain
Definition: LArConditionsSubset_p1.h:78
LArConditionsSubset::correctionVecEnd
ConstCorrectionVecIt correctionVecEnd() const
Definition: LArConditionsSubset.h:472
LArDSPThresholdsSubset_p1
persistent class container of LArConditionsSubset for LArDSPThresholds data.
Definition: LArDSPThresholdsSubset_p1.h:30
LArConditionsSubset_p1::m_febIds
std::vector< unsigned int > m_febIds
Definition: LArConditionsSubset_p1.h:75
LArConditionsSubset::initialize
void initialize(const std::vector< FebId > &ids, unsigned int gain)
Initialize with set of FEB ids.
Definition: LArConditionsSubset.h:529
LArConditionsSubset::CorrectionVec
std::vector< CorrectionPair > CorrectionVec
Definition: LArConditionsSubset.h:144
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArConditionsSubset_p1::m_groupingType
unsigned int m_groupingType
Definition: LArConditionsSubset_p1.h:80
LArConditionsSubset::channel
unsigned int channel() const
Access to the COOL channel number.
Definition: LArConditionsSubset.h:498
LArDSPThresholdsSubset_p1::m_samplesThr
std::vector< float > m_samplesThr
Definition: LArDSPThresholdsSubset_p1.h:36
LArDSPThresholdsSubset_p1::m_subset
LArConditionsSubset_p1 m_subset
Definition: LArDSPThresholdsSubset_p1.h:34
LArConditionsSubset::setChannel
void setChannel(unsigned int channel)
set the COOL channel number
Definition: LArConditionsSubset.h:567
LArDSPThresholdsSubsetCnv_p1.h
LArConditionsSubset
template class for use for I/O of conditions data
Definition: LArConditionsSubset.h:122
LArDSPThresholdsSubset_p1::m_trigSumThr
std::vector< float > m_trigSumThr
Definition: LArDSPThresholdsSubset_p1.h:37
LArConditionsSubset::gain
unsigned int gain() const
Access to gain.
Definition: LArConditionsSubset.h:490
DeMoScan.index
string index
Definition: DeMoScan.py:364
LArConditionsSubset::correctionVecSize
size_type correctionVecSize() const
Size of channel set.
Definition: LArConditionsSubset.h:481
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArConditionsSubset::subsetBegin
ConstSubsetIt subsetBegin() const
Iterators over subset.
Definition: LArConditionsSubset.h:412
LArConditionsSubset::subsetEnd
ConstSubsetIt subsetEnd() const
Definition: LArConditionsSubset.h:420
LArDSPThresholdsSubset_p1::m_tQThr
std::vector< float > m_tQThr
Definition: LArDSPThresholdsSubset_p1.h:35
LArConditionsSubset::correctionVecBegin
ConstCorrectionVecIt correctionVecBegin() const
Iterators over channel set.
Definition: LArConditionsSubset.h:465
LArConditionsSubset::insertCorrections
void insertCorrections(CorrectionVec &&corrs)
Insert a group of corrections.
Definition: LArConditionsSubset.h:593
LArConditionsSubset::groupingType
unsigned int groupingType() const
Type of grouping - defined in LArConditionsContainerBase.h.
Definition: LArConditionsSubset.h:507