ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArCondTPCnv
src
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
5
#include "
LArRawConditions/LArConditionsSubset.h
"
6
#include "
LArCondTPCnv/LArPedestalSubsetCnv_p1.h
"
7
8
void
9
LArPedestalSubsetCnv_p1::persToTrans
(
const
LArPedestalPersType
* persObj,
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();
93
LArPedestalTransType::CorrectionVec
corrs;
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
132
void
133
LArPedestalSubsetCnv_p1::transToPers
(
const
LArPedestalTransType
*
/*transObj*/
,
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
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
LArConditionsSubset.h
This file defines the template class used for I/O of conditions data.
LArPedestalSubsetCnv_p1.h
LArPedestalTransType
LArConditionsSubset< LArPedestalP1 > LArPedestalTransType
Definition
LArPedestalSubsetCnv_p1.h:15
LArPedestalPersType
LArPedestalSubset_p1 LArPedestalPersType
Definition
LArPedestalSubsetCnv_p1.h:16
LArConditionsSubset_p1::m_febIds
std::vector< unsigned int > m_febIds
Definition
LArConditionsSubset_p1.h:75
LArConditionsSubset_p1::m_gain
unsigned int m_gain
Definition
LArConditionsSubset_p1.h:78
LArConditionsSubset_p1::m_corrChannels
std::vector< unsigned int > m_corrChannels
Definition
LArConditionsSubset_p1.h:76
LArConditionsSubset_p1::subsetSize
unsigned int subsetSize() const
Definition
LArConditionsSubset_p1.h:82
LArConditionsSubset_p1::m_febsWithSparseData
std::vector< unsigned int > m_febsWithSparseData
Definition
LArConditionsSubset_p1.h:77
LArConditionsSubset_p1::m_channel
unsigned int m_channel
Definition
LArConditionsSubset_p1.h:79
LArConditionsSubset_p1::m_groupingType
unsigned int m_groupingType
Definition
LArConditionsSubset_p1.h:80
LArConditionsSubset::initialize
void initialize(const std::vector< FebId > &ids, unsigned int gain)
Initialize with set of FEB ids.
Definition
LArConditionsSubset.h:529
LArConditionsSubset::setGroupingType
void setGroupingType(unsigned int type)
set the type of grouping - defined in LArConditionsContainerBase.h
Definition
LArConditionsSubset.h:575
LArConditionsSubset::subsetBegin
ConstSubsetIt subsetBegin() const
Iterators over subset.
Definition
LArConditionsSubset.h:412
LArConditionsSubset< LArPedestalP1 >::CorrectionVec
std::vector< CorrectionPair > CorrectionVec
Definition
LArConditionsSubset.h:144
LArConditionsSubset::insertCorrections
void insertCorrections(CorrectionVec &&corrs)
Insert a group of corrections.
Definition
LArConditionsSubset.h:593
LArConditionsSubset::setChannel
void setChannel(unsigned int channel)
set the COOL channel number
Definition
LArConditionsSubset.h:567
LArPedestalSubsetCnv_p1::transToPers
virtual void transToPers(const LArPedestalTransType *transObj, LArPedestalPersType *persObj, MsgStream &log) const override
Definition
LArPedestalSubsetCnv_p1.cxx:133
LArPedestalSubsetCnv_p1::persToTrans
virtual void persToTrans(const LArPedestalPersType *persObj, LArPedestalTransType *transObj, MsgStream &log) const override
Definition
LArPedestalSubsetCnv_p1.cxx:9
LArPedestalSubset_p1::m_vPedestal
std::vector< float > m_vPedestal
Definition
LArPedestalSubset_p1.h:36
LArPedestalSubset_p1::m_subset
LArConditionsSubset_p1 m_subset
Definition
LArPedestalSubset_p1.h:35
LArPedestalSubset_p1::m_vPedestalRMSSize
unsigned int m_vPedestalRMSSize
Definition
LArPedestalSubset_p1.h:39
LArPedestalSubset_p1::m_vPedestalRMS
std::vector< float > m_vPedestalRMS
Definition
LArPedestalSubset_p1.h:37
LArPedestalSubset_p1::m_vPedestalSize
unsigned int m_vPedestalSize
Definition
LArPedestalSubset_p1.h:38
Generated on
for ATLAS Offline Software by
1.17.0