ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArCondTPCnv
src
LArSingleFloatSubsetCnv_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
5
#include "
LArCondTPCnv/LArSingleFloatSubsetCnv_p1.h
"
6
7
#include "
LArElecCalib/LArCalibErrorCode.h
"
8
#include "
CopyFloatWithErrorcode.h
"
9
10
void
11
LArSingleFloatSubsetCnv_p1::persToTrans
(
const
SingleFloatPersType
* persObj,
12
SingleFloatTransType
* transObj,
13
MsgStream &
/*log*/
)
const
14
{
15
16
// Copy basic metadata
17
transObj->
setChannel
(persObj->
m_subset
.
m_channel
);
18
transObj->
setGroupingType
(persObj->
m_subset
.
m_groupingType
);
19
20
transObj->
initialize
(persObj->
m_subset
.
m_febIds
, persObj->
m_subset
.
m_gain
);
21
22
unsigned
int
nfebids = persObj->
m_subset
.
m_febIds
.size();
23
const
unsigned
int
nChannelsPerFeb = persObj->
m_subset
.
subsetSize
();
24
unsigned
index
=0;
25
26
auto
subsetIt = transObj->
subsetBegin
();
27
for
(
unsigned
int
i = 0; i < nfebids; ++i, ++subsetIt){
28
// Loop over channels in feb
29
for
(
unsigned
int
j = 0; j < nChannelsPerFeb; ++j){
30
const
float
& data=persObj->
m_values
[
index
];
31
if
(data<=1.0+
LArElecCalib::ERRORCODE
)
32
subsetIt->second[j].m_data=
LArElecCalib::ERRORCODE
;
33
else
34
subsetIt->second[j].m_data=data;
35
++
index
;
36
}
37
}
38
39
unsigned
int
ncorrs = persObj->
m_subset
.
m_corrChannels
.size();
40
SingleFloatTransType::CorrectionVec
corrs;
41
corrs.resize(ncorrs);
42
43
// Loop over corrections
44
for
(
unsigned
int
i = 0; i < ncorrs; ++i){
45
corrs[i].first = persObj->
m_subset
.
m_corrChannels
[i];
46
const
float
& data=persObj->
m_values
[
index
];
47
if
(data<=1.0+
LArElecCalib::ERRORCODE
)
48
corrs[i].second.m_data=
LArElecCalib::ERRORCODE
;
49
else
50
corrs[i].second.m_data=data;
51
++
index
;
52
}
53
transObj->
insertCorrections
(std::move (corrs));
54
return
;
55
}
56
57
58
59
60
61
void
62
LArSingleFloatSubsetCnv_p1::transToPers
(
const
SingleFloatTransType
* transObj,
63
SingleFloatPersType
* persObj,
64
MsgStream &log)
const
65
{
66
// Get the number of channels, corrections and the size of pedestal and pedestalrms
67
unsigned
int
ncorrs = transObj->
correctionVecSize
();
68
unsigned
int
nsubsetsNotEmpty = 0;
69
const
unsigned
int
nChannelsPerFeb = transObj->
channelVectorSize
();
70
71
const
auto
subsetEnd = transObj->
subsetEnd
();
72
for
(
auto
subsetIt = transObj->
subsetBegin
();
73
subsetIt != subsetEnd;
74
++subsetIt)
75
{
76
unsigned
int
nfebChans = subsetIt->second.size();
77
if
(nfebChans != 0 && nfebChans != nChannelsPerFeb) {
78
log << MSG::ERROR
79
<<
"LArSingleFloatSubsetCnv_p1::transToPers - found incorrect number of channels per feb: "
<< nfebChans
80
<<
endmsg
;
81
return
;
82
}
83
if
(nfebChans) ++nsubsetsNotEmpty;
// count number of non-empty subsets
84
}
85
86
// Reserve space in vectors
87
persObj->
m_subset
.
m_febIds
.reserve(nsubsetsNotEmpty);
88
persObj->
m_subset
.
m_corrChannels
.reserve(ncorrs);
89
persObj->
m_values
.reserve(ncorrs+nsubsetsNotEmpty*nChannelsPerFeb);
90
91
//Copy subsets
92
for
(
auto
subsetIt = transObj->
subsetBegin
();
93
subsetIt != subsetEnd;
94
++subsetIt)
95
{
96
unsigned
int
nfebChans = subsetIt->second.size();
97
if
(nfebChans==0)
continue
;
98
unsigned
int
febid = subsetIt->first;
99
persObj->
m_subset
.
m_febIds
.push_back(febid);
100
for
(
unsigned
int
j=0; j<nfebChans;++j)
//Loop over channels in FEB
101
persObj->
m_values
.push_back(subsetIt->second[j].m_data);
102
}
103
104
// Copy corrections
105
const
auto
corrEnd = transObj->
correctionVecEnd
();
106
for
(
auto
corrIt = transObj->
correctionVecBegin
();
107
corrIt != corrEnd;
108
++corrIt)
109
{
110
persObj->
m_subset
.
m_corrChannels
.push_back(corrIt->first);
111
persObj->
m_values
.push_back(corrIt->second.m_data);
112
}
113
114
// Copy the rest
115
persObj->
m_subset
.
m_gain
= transObj->
gain
();
116
persObj->
m_subset
.
m_channel
= transObj->
channel
();
117
persObj->
m_subset
.
m_groupingType
= transObj->
groupingType
();
118
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
CopyFloatWithErrorcode.h
Copies a single float from a persistent LAr calibration object, protected against roundoff errors.
LArCalibErrorCode.h
Defines a common ERRORCODE enum for LAr-Calibration objects.
LArSingleFloatSubsetCnv_p1.h
SingleFloatTransType
LArConditionsSubset< LArSingleFloatP > SingleFloatTransType
Definition
LArSingleFloatSubsetCnv_p1.h:16
SingleFloatPersType
LArSingleFloatSubset_p1 SingleFloatPersType
Definition
LArSingleFloatSubsetCnv_p1.h:17
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_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::subsetEnd
ConstSubsetIt subsetEnd() const
Definition
LArConditionsSubset.h:420
LArConditionsSubset::channelVectorSize
unsigned channelVectorSize() const
Definition
LArConditionsSubset.h:608
LArConditionsSubset::correctionVecBegin
ConstCorrectionVecIt correctionVecBegin() const
Iterators over channel set.
Definition
LArConditionsSubset.h:465
LArConditionsSubset::groupingType
unsigned int groupingType() const
Type of grouping - defined in LArConditionsContainerBase.h.
Definition
LArConditionsSubset.h:507
LArConditionsSubset::correctionVecEnd
ConstCorrectionVecIt correctionVecEnd() const
Definition
LArConditionsSubset.h:472
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::gain
unsigned int gain() const
Access to gain.
Definition
LArConditionsSubset.h:490
LArConditionsSubset::correctionVecSize
size_type correctionVecSize() const
Size of channel set.
Definition
LArConditionsSubset.h:481
LArConditionsSubset< LArSingleFloatP >::CorrectionVec
std::vector< CorrectionPair > CorrectionVec
Definition
LArConditionsSubset.h:144
LArConditionsSubset::channel
unsigned int channel() const
Access to the COOL channel number.
Definition
LArConditionsSubset.h:498
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
LArSingleFloatSubsetCnv_p1::persToTrans
virtual void persToTrans(const SingleFloatPersType *persObj, SingleFloatTransType *transObj, MsgStream &log) const override
Definition
LArSingleFloatSubsetCnv_p1.cxx:11
LArSingleFloatSubsetCnv_p1::transToPers
virtual void transToPers(const SingleFloatTransType *transObj, SingleFloatPersType *persObj, MsgStream &log) const override
Definition
LArSingleFloatSubsetCnv_p1.cxx:62
LArSingleFloatSubset_p1::m_values
std::vector< float > m_values
Definition
LArSingleFloatSubset_p1.h:35
LArSingleFloatSubset_p1::m_subset
LArConditionsSubset_p1 m_subset
Definition
LArSingleFloatSubset_p1.h:34
LArElecCalib::ERRORCODE
@ ERRORCODE
Definition
LArCalibErrorCode.h:17
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0