ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloCalibConditions
src
L1CaloPpmDeadChannelsContainer.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1CaloCalibConditions/L1CaloPpmDeadChannelsContainer.h
"
6
7
#include <algorithm>
8
#include <memory>
9
10
#include "CoralBase/AttributeListSpecification.h"
11
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
12
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
13
14
#include "
TrigT1CaloCalibConditions/L1CaloPpmDeadChannels.h
"
15
16
L1CaloPpmDeadChannelsContainer::L1CaloPpmDeadChannelsContainer
()
17
:
AbstractL1CaloPersistentCondition
(
"CondAttrListCollection"
)
18
{
19
this->
addSpecification
(
eErrorCode
,
"ErrorCode"
,
"unsigned int"
);
20
this->
addSpecification
(
eNoiseCut
,
"NoiseCut"
,
"unsigned int"
);
21
}
22
23
L1CaloPpmDeadChannelsContainer::L1CaloPpmDeadChannelsContainer
(
const
std::string& folderKey)
24
:
L1CaloPpmDeadChannelsContainer
()
// delegating constructor
25
{
26
// cppcheck-suppress useInitializationList
27
m_coolFolderKey
= folderKey;
28
}
29
30
31
DataObject*
L1CaloPpmDeadChannelsContainer::makePersistent
()
const
32
{
33
using
std::make_unique;
34
35
if
(
m_coolFolderKey
.empty())
return
nullptr
;
36
37
auto
* attrSpecification = this->
createAttributeListSpecification
();
38
if
(!attrSpecification || !attrSpecification->size())
return
nullptr
;
39
40
auto
attrListCollection = make_unique<CondAttrListCollection>(
true
);
41
for
(
const
auto
& item :
m_ppmDeadChannelss
) {
42
AthenaAttributeList
attrList(*attrSpecification);
43
attrList[
specificationName
(
eErrorCode
)].setValue(item.errorCode());
44
attrList[
specificationName
(
eNoiseCut
)].setValue(item.noiseCut());
45
46
attrListCollection->add(item.channelId(), attrList);
47
}
48
return
static_cast<
DataObject*
>
(attrListCollection.release());
49
}
50
51
void
L1CaloPpmDeadChannelsContainer::makeTransient
(
const
std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
52
{
53
clear
();
54
55
// In the case of overlay, we need multiple instances of L1CaloPpmDeadChannelsContainer
56
// Take the last element in the map
57
if
(condAttrListCollectionMap.empty())
return
;
58
auto
it = condAttrListCollectionMap.rbegin();
59
60
auto
attrListCollection = it->second;
61
for
(
const
auto
& item : *attrListCollection) {
62
auto
chanNum = item.first;
63
const
auto
& attrList = item.second;
64
65
auto
errorCode = attrList[
specificationName
(
eErrorCode
)].data<
unsigned
int
>();
66
auto
noiseCut = attrList[
specificationName
(
eNoiseCut
)].data<
unsigned
int
>();
67
68
addPpmDeadChannels
(
L1CaloPpmDeadChannels
(chanNum, errorCode, noiseCut));
69
}
70
}
71
72
const
L1CaloPpmDeadChannels
*
L1CaloPpmDeadChannelsContainer::ppmDeadChannels
(
unsigned
int
channelId)
const
73
{
74
auto
it = std::lower_bound(std::begin(
m_ppmDeadChannelss
),
75
std::end(
m_ppmDeadChannelss
),
76
channelId,
77
[](
const
L1CaloPpmDeadChannels
& el,
unsigned
int
val) ->
bool
{
78
return
el.channelId() < val;
79
});
80
if
(it == std::end(
m_ppmDeadChannelss
))
return
nullptr
;
81
return
&(*it);
82
}
83
84
void
L1CaloPpmDeadChannelsContainer::addPpmDeadChannels
(
const
L1CaloPpmDeadChannels
&
ppmDeadChannels
)
85
{
86
// insert into the correct position mainting the sorted vector
87
m_ppmDeadChannelss
.insert(std::lower_bound(std::begin(
m_ppmDeadChannelss
),
88
std::end(
m_ppmDeadChannelss
),
89
ppmDeadChannels
.channelId(),
90
[](
const
L1CaloPpmDeadChannels
& el,
unsigned
int
va) ->
bool
{
91
return el.channelId() < va;
92
}),
93
ppmDeadChannels
);
94
}
AthenaAttributeList.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloPpmDeadChannelsContainer.h
L1CaloPpmDeadChannels.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
L1CaloPpmDeadChannelsContainer::L1CaloPpmDeadChannelsContainer
L1CaloPpmDeadChannelsContainer()
Definition
L1CaloPpmDeadChannelsContainer.cxx:16
L1CaloPpmDeadChannelsContainer::m_ppmDeadChannelss
std::vector< L1CaloPpmDeadChannels > m_ppmDeadChannelss
Definition
L1CaloPpmDeadChannelsContainer.h:57
L1CaloPpmDeadChannelsContainer::eNoiseCut
@ eNoiseCut
Definition
L1CaloPpmDeadChannelsContainer.h:29
L1CaloPpmDeadChannelsContainer::eErrorCode
@ eErrorCode
Definition
L1CaloPpmDeadChannelsContainer.h:29
L1CaloPpmDeadChannelsContainer::ppmDeadChannels
const L1CaloPpmDeadChannels * ppmDeadChannels(unsigned int channelId) const
Definition
L1CaloPpmDeadChannelsContainer.cxx:72
L1CaloPpmDeadChannelsContainer::clear
virtual void clear()
Definition
L1CaloPpmDeadChannelsContainer.h:41
L1CaloPpmDeadChannelsContainer::makePersistent
virtual DataObject * makePersistent() const
Definition
L1CaloPpmDeadChannelsContainer.cxx:31
L1CaloPpmDeadChannelsContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
Definition
L1CaloPpmDeadChannelsContainer.cxx:51
L1CaloPpmDeadChannelsContainer::addPpmDeadChannels
void addPpmDeadChannels(const L1CaloPpmDeadChannels &ppmDeadChannels)
Definition
L1CaloPpmDeadChannelsContainer.cxx:84
L1CaloPpmDeadChannelsContainer::m_coolFolderKey
std::string m_coolFolderKey
Definition
L1CaloPpmDeadChannelsContainer.h:58
L1CaloPpmDeadChannels
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Calibration/PpmDeadChannels .
Definition
L1CaloPpmDeadChannels.h:17
Generated on
for ATLAS Offline Software by
1.17.0