ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloCalibConditions
src
L1CaloRxGainContainer.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 "
TrigT1CaloCalibConditions/L1CaloRxGainContainer.h
"
6
7
#include "CoralBase/AttributeListSpecification.h"
8
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
9
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
10
11
#include "GaudiKernel/MsgStream.h"
12
13
#include <string>
14
15
L1CaloRxGainContainer::L1CaloRxGainContainer
():
AbstractL1CaloPersistentCondition
(
"CondAttrListCollection"
) {
16
// Define DB rows names and types in order to construct the AttributeListSpecification object
17
//this->addSpecification(eIdentifier, std::string("Identifier"), std::string("unsigned int"));
18
//this->addSpecification(eCrate, std::string("RecCrate"), std::string("string"));
19
//this->addSpecification(eSlot, std::string("RecSlot"), std::string("unsigned int"));
20
//this->addSpecification(eChannel, std::string("RecChannel"), std::string("unsigned int"));
21
this->
addSpecification
(
eGain
, std::string(
"gains"
), std::string(
"int"
));
22
this->
addSpecification
(
eComment
, std::string(
"Comment"
), std::string(
"string"
));
23
24
m_mCoolFoldersKeysMap
[
L1CaloRxGainContainer::eRxGainFolder
] = std::string(
"/receivers/Gains"
);
25
}
26
27
L1CaloRxGainContainer::L1CaloRxGainContainer
(
const
std::map<L1CaloRxGainContainer::eCoolFolders, std::string>& folderKeysMap):
AbstractL1CaloPersistentCondition
(
"CondAttrListCollection"
),
28
m_mCoolFoldersKeysMap
(folderKeysMap)
29
{
30
// Define DB rows names and types in order to construct the AttributeListSpecification object
31
//this->addSpecification(eIdentifier, std::string("Identifier"), std::string("unsigned int"));
32
//this->addSpecification(eCrate, std::string("RecCrate"), std::string("string"));
33
//this->addSpecification(eSlot, std::string("RecSlot"), std::string("unsigned int"));
34
//this->addSpecification(eChannel, std::string("RecChannel"), std::string("unsigned int"));
35
this->
addSpecification
(
eGain
, std::string(
"gains"
), std::string(
"int"
));
36
this->
addSpecification
(
eComment
, std::string(
"Comment"
), std::string(
"string"
));
37
}
38
39
std::string
L1CaloRxGainContainer::coolFolderKey
(
L1CaloRxGainContainer::eCoolFolders
efolder)
const
{
40
41
std::map<L1CaloRxGainContainer::eCoolFolders, std::string>::const_iterator it =
m_mCoolFoldersKeysMap
.find(efolder);
42
if
(it!=
m_mCoolFoldersKeysMap
.end()) {
43
return
it->second;
44
}
else
{
45
return
std::string(
""
);
46
}
47
}
48
49
std::vector<std::string>
L1CaloRxGainContainer::coolInputKeys
()
const
{
50
std::vector<std::string> v;
51
v.push_back(this->
coolFolderKey
(
L1CaloRxGainContainer::eRxGainFolder
));
52
return
v;
53
}
54
55
std::string
L1CaloRxGainContainer::coolOutputKey
()
const
{
56
return
this->
coolFolderKey
(
L1CaloRxGainContainer::eRxGainFolder
);
57
}
58
59
DataObject*
L1CaloRxGainContainer::makePersistent
()
const
{
60
if
(
m_mRxGainMap
.size()==0)
return
0;
61
62
// Create AttributeListSpecification according to the attributes to be recorded
63
// this is required to create the AttributeList objs
64
coral::AttributeListSpecification* attrSpecification = this->
createAttributeListSpecification
();
65
if
(!attrSpecification->size())
return
0;
66
67
68
CondAttrListCollection
* attrListCollection =
new
CondAttrListCollection
(
true
);
69
70
L1CaloRxGainMap::const_iterator pos =
m_mRxGainMap
.begin();
71
for
(;pos!=
m_mRxGainMap
.end();++pos) {
72
const
unsigned
int
channelId = pos->first;
73
const
L1CaloRxGain
& p = pos->second;
74
75
AthenaAttributeList
attrList(*attrSpecification);
76
77
//attrList[ this->specificationName(eIdentifier) ].setValue(p->identifier());
78
//attrList[ this->specificationName(eCrate) ].setValue(p->crate());
79
//attrList[ this->specificationName(eSlot) ].setValue(p->slot());
80
//attrList[ this->specificationName(eChannel) ].setValue(p->channel());
81
attrList[ this->
specificationName
(
eGain
) ].setValue(p.gain());
82
attrList[ this->
specificationName
(
eComment
) ].setValue(p.comment());
83
84
// add AttributeList corresponding to channel iChanNumber to the CondAttrListCollection
85
attrListCollection->
add
(channelId, attrList);
86
}
87
88
return
attrListCollection;
89
}
90
91
void
L1CaloRxGainContainer::makeTransient
(
const
std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap) {
92
93
this->
clear
();
94
95
std::map<std::string, const CondAttrListCollection*>::const_iterator it_map;
96
97
it_map = condAttrListCollectionMap.find(this->
coolFolderKey
(
L1CaloRxGainContainer::eRxGainFolder
));
98
if
(it_map!=condAttrListCollectionMap.end()) {
99
100
const
CondAttrListCollection
* attrListCollection = it_map->second;
101
102
//loop over CondAttrListCollection
103
CondAttrListCollection::const_iterator
it = attrListCollection->
begin
();
104
for
(;it!=attrListCollection->
end
();++it) {
105
106
const
coral::AttributeList& attrList = it->second;
107
108
// Get value of each row for the current channel
109
CondAttrListCollection::ChanNum
chanNum = it->first;
110
111
//unsigned int identifier = attrList[ this->specificationName(eIdentifier) ].data<unsigned int>();
112
//std::string crate = attrList[ this->specificationName(eCrate) ].data<std::string>();
113
//unsigned int slot = attrList[ this->specificationName(eSlot) ].data<unsigned int>();
114
//unsigned int channel = attrList[ this->specificationName(eChannel) ].data<unsigned int>();
115
unsigned
int
gain = attrList[ this->
specificationName
(
eGain
) ].data<
int
>();
116
std::string comment = attrList[ this->
specificationName
(
eComment
) ].data<std::string>();
117
118
// Create transient L1CaloPedestal obj
119
//L1CaloRxGain* p = new L1CaloRxGain( chanNum, identifier, crate, slot, channel, gain, comment);
120
L1CaloRxGain
l1caloRxGain(chanNum, gain, comment);
121
m_mRxGainMap
[chanNum] = l1caloRxGain;
122
}
123
}
else
{
124
std::cout<<
"L1CaloRxGainContainer : Could not find requested CondAttrListCollection "
<< this->
coolFolderKey
(
L1CaloRxGainContainer::eRxGainFolder
) << std::endl;
125
}
126
}
127
128
const
L1CaloRxGain
*
L1CaloRxGainContainer::rxGain
(
unsigned
int
channelId)
const
{
129
L1CaloRxGainMap::const_iterator pos =
m_mRxGainMap
.find(channelId);
130
if
(pos==
m_mRxGainMap
.end())
return
0;
131
else
return
&(pos->second);
132
}
133
134
const
L1CaloRxGain
*
L1CaloRxGainContainer::rxGain
(
const
L1CaloRxCoolChannelId
& channelId)
const
{
135
return
this->
rxGain
(channelId.
id
());
136
}
137
138
void
L1CaloRxGainContainer::addRxGain
(
unsigned
int
channelId,
const
L1CaloRxGain
& pprLut) {
139
m_mRxGainMap
[channelId] = pprLut;
140
}
141
142
void
L1CaloRxGainContainer::addRxGain
(
const
L1CaloRxCoolChannelId
& channelId,
const
L1CaloRxGain
& pprLut) {
143
return
this->
addRxGain
(channelId.
id
(), pprLut);
144
}
145
146
void
L1CaloRxGainContainer::dump
()
const
{
147
L1CaloRxGainContainer::const_iterator
it = this->
begin
();
148
for
(;it!=this->
end
();++it) {
149
std::cout <<
" * item: "
<<it->first <<
" => "
<<it->second <<std::endl;
150
}
151
}
152
153
void
L1CaloRxGainContainer::clear
() {
154
m_mRxGainMap
.clear();
155
}
AthenaAttributeList.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloRxGainContainer.h
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition
AbstractL1CaloPersistentCondition.cxx:44
AbstractL1CaloPersistentCondition::AbstractL1CaloPersistentCondition
AbstractL1CaloPersistentCondition(const std::string &condType)
Definition
AbstractL1CaloPersistentCondition.h:45
AbstractL1CaloPersistentCondition::addSpecification
void addSpecification(int specId, const std::string &specName, const std::string &specType)
Definition
AbstractL1CaloPersistentCondition.cxx:26
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition
AbstractL1CaloPersistentCondition.cxx:31
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
CondAttrListCollection::end
const_iterator end() const
Definition
CondAttrListCollection.h:314
CondAttrListCollection::add
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
Definition
CondAttrListCollection.h:451
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition
CondAttrListCollection.h:308
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition
CondAttrListCollection.h:62
CondAttrListCollection::ChanNum
unsigned int ChanNum
Definition
CondAttrListCollection.h:54
L1CaloRxCoolChannelId
Encapsulates the ID of one Rx channel of conditions data in COOL, ie the ID of a row in a table.
Definition
L1CaloRxCoolChannelId.h:10
L1CaloRxCoolChannelId::id
unsigned int id() const
Definition
L1CaloRxCoolChannelId.h:27
L1CaloRxGainContainer::eCoolFolders
eCoolFolders
Definition
L1CaloRxGainContainer.h:33
L1CaloRxGainContainer::eRxGainFolder
@ eRxGainFolder
Definition
L1CaloRxGainContainer.h:33
L1CaloRxGainContainer::coolOutputKey
virtual std::string coolOutputKey() const
Definition
L1CaloRxGainContainer.cxx:55
L1CaloRxGainContainer::m_mCoolFoldersKeysMap
std::map< L1CaloRxGainContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
Definition
L1CaloRxGainContainer.h:66
L1CaloRxGainContainer::dump
void dump() const
Definition
L1CaloRxGainContainer.cxx:146
L1CaloRxGainContainer::coolFolderKey
std::string coolFolderKey(L1CaloRxGainContainer::eCoolFolders efolder) const
Definition
L1CaloRxGainContainer.cxx:39
L1CaloRxGainContainer::begin
L1CaloRxGainMap::const_iterator begin() const
Definition
L1CaloRxGainContainer.h:51
L1CaloRxGainContainer::clear
virtual void clear()
Definition
L1CaloRxGainContainer.cxx:153
L1CaloRxGainContainer::end
L1CaloRxGainMap::const_iterator end() const
Definition
L1CaloRxGainContainer.h:52
L1CaloRxGainContainer::coolInputKeys
virtual std::vector< std::string > coolInputKeys() const
Definition
L1CaloRxGainContainer.cxx:49
L1CaloRxGainContainer::const_iterator
std::map< unsignedint, L1CaloRxGain >::const_iterator const_iterator
Definition
L1CaloRxGainContainer.h:35
L1CaloRxGainContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &condAttrListCollectionMap)
Definition
L1CaloRxGainContainer.cxx:91
L1CaloRxGainContainer::addRxGain
void addRxGain(unsigned int channelId, const L1CaloRxGain &rxGain)
Definition
L1CaloRxGainContainer.cxx:138
L1CaloRxGainContainer::L1CaloRxGainContainer
L1CaloRxGainContainer()
Definition
L1CaloRxGainContainer.cxx:15
L1CaloRxGainContainer::rxGain
const L1CaloRxGain * rxGain(unsigned int channelId) const
Definition
L1CaloRxGainContainer.cxx:128
L1CaloRxGainContainer::eComment
@ eComment
Definition
L1CaloRxGainContainer.h:30
L1CaloRxGainContainer::eGain
@ eGain
Definition
L1CaloRxGainContainer.h:30
L1CaloRxGainContainer::m_mRxGainMap
L1CaloRxGainMap m_mRxGainMap
Definition
L1CaloRxGainContainer.h:65
L1CaloRxGainContainer::makePersistent
virtual DataObject * makePersistent() const
Definition
L1CaloRxGainContainer.cxx:59
L1CaloRxGain
Transient conditions class for objects defined by the online framework and retrieved from COOL.
Definition
L1CaloRxGain.h:24
Generated on
for ATLAS Offline Software by
1.17.0