ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArCondTPCnv
src
LArOFCBinSubsetCnv_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/LArOFCBinSubsetCnv_p1.h
"
6
7
void
8
LArOFCBinSubsetCnv_p1::persToTrans
(
const
OFCBinPersType
* persObj,
9
OFCBinTransType
* transObj,
10
MsgStream &
/*log*/
)
const
11
{
12
// Copy basic metadata
13
transObj->
setChannel
(persObj->
m_subset
.
m_channel
);
14
transObj->
setGroupingType
(persObj->
m_subset
.
m_groupingType
);
15
transObj->
initialize
(persObj->
m_subset
.
m_febIds
, persObj->
m_subset
.
m_gain
);
16
17
// Copy conditions
18
unsigned
int
nfebids = persObj->
m_subset
.
m_febIds
.size();
19
const
unsigned
int
nChannelsPerFeb = persObj->
m_subset
.
subsetSize
();
20
unsigned
index
=0;
21
22
auto
subsetIt = transObj->
subsetBegin
();
23
for
(
unsigned
int
i = 0; i < nfebids; ++i, ++subsetIt){
24
// Loop over channels in feb
25
for
(
unsigned
int
j = 0; j < nChannelsPerFeb; ++j){
26
(*subsetIt).second[j].m_bin=persObj->
m_values
[
index
];
27
// std::cout << "WL Data: FEB=" << std::hex << febid << std::dec << " [" << i << "] Channel="
28
// << j << " Payload= <<
29
++
index
;
30
}
31
}
32
33
unsigned
int
ncorrs = persObj->
m_subset
.
m_corrChannels
.size();
34
OFCBinTransType::CorrectionVec
corrs;
35
corrs.resize(ncorrs);
36
37
// Loop over corrections
38
for
(
unsigned
int
i = 0; i < ncorrs; ++i){
39
corrs[i].first = persObj->
m_subset
.
m_corrChannels
[i];
40
corrs[i].second.m_bin=persObj->
m_values
[
index
];
41
++
index
;
42
}
43
transObj->
insertCorrections
(std::move (corrs));
44
45
}
46
47
48
49
50
51
void
52
LArOFCBinSubsetCnv_p1::transToPers
(
const
OFCBinTransType
* transObj,
53
OFCBinPersType
* persObj,
54
MsgStream &log)
const
55
{
56
// Get the number of channels, corrections and the size of pedestal and pedestalrms
57
unsigned
int
ncorrs = transObj->
correctionVecSize
();
58
const
unsigned
int
nChannelsPerFeb = transObj->
channelVectorSize
();
59
unsigned
int
nsubsetsNotEmpty = 0;
60
61
const
auto
subsetEnd = transObj->
subsetEnd
();
62
for
(
auto
subsetIt = transObj->
subsetBegin
();
63
subsetIt != subsetEnd;
64
++subsetIt)
65
{
66
unsigned
int
nfebChans = (*subsetIt).second.size();
67
if
(nfebChans != 0 && nfebChans != nChannelsPerFeb) {
68
log << MSG::ERROR
69
<<
"LArOFCBinSubsetCnv_p1::transToPers - found incorrect number of channels per feb: "
<< nfebChans
70
<<
endmsg
;
71
return
;
72
}
73
if
(nfebChans) ++nsubsetsNotEmpty;
// count number of non-empty subsets
74
}
75
76
// Reserve space in vectors
77
persObj->
m_subset
.
m_febIds
.reserve(nsubsetsNotEmpty);
78
persObj->
m_subset
.
m_corrChannels
.reserve(ncorrs);
79
persObj->
m_values
.reserve(ncorrs+nsubsetsNotEmpty*nChannelsPerFeb);
80
81
//Copy subsets
82
for
(
auto
subsetIt = transObj->
subsetBegin
();
83
subsetIt != subsetEnd;
84
++subsetIt)
85
{
86
unsigned
int
nfebChans = (*subsetIt).second.size();
87
if
(nfebChans==0)
continue
;
88
unsigned
int
febid = (*subsetIt).first;
89
persObj->
m_subset
.
m_febIds
.push_back(febid);
90
for
(
unsigned
int
j=0; j<nfebChans;++j)
//Loop over channels in FEB
91
persObj->
m_values
.push_back((*subsetIt).second[j].m_bin);
92
}
93
94
// Copy corrections
95
const
auto
corrEnd = transObj->
correctionVecEnd
();
96
for
(
auto
corrIt = transObj->
correctionVecBegin
();
97
corrIt != corrEnd;
98
++corrIt)
99
{
100
persObj->
m_subset
.
m_corrChannels
.push_back(corrIt->first);
101
persObj->
m_values
.push_back(corrIt->second.m_bin);
102
}
103
104
// Copy the rest
105
persObj->
m_subset
.
m_gain
= transObj->
gain
();
106
persObj->
m_subset
.
m_channel
= transObj->
channel
();
107
persObj->
m_subset
.
m_groupingType
= transObj->
groupingType
();
108
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
LArOFCBinSubsetCnv_p1.h
OFCBinTransType
LArConditionsSubset< LArOFCBinP > OFCBinTransType
Definition
LArOFCBinSubsetCnv_p1.h:16
OFCBinPersType
LArSingleIntSubset_p1 OFCBinPersType
Definition
LArOFCBinSubsetCnv_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< LArOFCBinP >::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
LArOFCBinSubsetCnv_p1::transToPers
virtual void transToPers(const OFCBinTransType *transObj, OFCBinPersType *persObj, MsgStream &log) const override
Definition
LArOFCBinSubsetCnv_p1.cxx:52
LArOFCBinSubsetCnv_p1::persToTrans
virtual void persToTrans(const OFCBinPersType *persObj, OFCBinTransType *transObj, MsgStream &log) const override
Definition
LArOFCBinSubsetCnv_p1.cxx:8
LArSingleIntSubset_p1::m_values
std::vector< int > m_values
Definition
LArSingleIntSubset_p1.h:35
LArSingleIntSubset_p1::m_subset
LArConditionsSubset_p1 m_subset
Definition
LArSingleIntSubset_p1.h:34
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0