ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloPprChanDefaultsV1Container.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <algorithm>
8#include <memory>
9
10#include "CoralBase/AttributeListSpecification.h"
13
15
17 : AbstractL1CaloPersistentCondition("CondAttrListCollection")
18{
19 this->addSpecification(eBcidDecision1, "CR12_BcidDecision1", "unsigned int");
20 this->addSpecification(eSatOverride1, "CR12_SatOverride1", "unsigned int");
21 this->addSpecification(eBcidDecision2, "CR13_BcidDecision2", "unsigned int");
22 this->addSpecification(eSatOverride2, "CR13_SatOverride2", "unsigned int");
23 this->addSpecification(eBcidDecision3, "CR14_BcidDecision3", "unsigned int");
24 this->addSpecification(eSatOverride3, "CR14_SatOverride3", "unsigned int");
25 this->addSpecification(ePeakFinderCond, "CR15_PeakFinderCond", "unsigned int");
26 this->addSpecification(eDecisionSource, "CR15_DecisionSource", "unsigned int");
27}
28
30 : L1CaloPprChanDefaultsV1Container() // delegating constructor
31{
32 // cppcheck-suppress useInitializationList
33 m_coolFolderKey = folderKey;
34}
35
36
38{
39 using std::make_unique;
40
41 if(m_coolFolderKey.empty()) return nullptr;
42
43 auto* attrSpecification = this->createAttributeListSpecification();
44 if(!attrSpecification || !attrSpecification->size()) return nullptr;
45
46 auto attrListCollection = make_unique<CondAttrListCollection>(true);
47 for(const auto& item : m_pprChanDefaultsV1s) {
48 AthenaAttributeList attrList(*attrSpecification);
49 attrList[specificationName(eBcidDecision1)].setValue(item.bcidDecision1());
50 attrList[specificationName(eSatOverride1)].setValue(item.satOverride1());
51 attrList[specificationName(eBcidDecision2)].setValue(item.bcidDecision2());
52 attrList[specificationName(eSatOverride2)].setValue(item.satOverride2());
53 attrList[specificationName(eBcidDecision3)].setValue(item.bcidDecision3());
54 attrList[specificationName(eSatOverride3)].setValue(item.satOverride3());
55 attrList[specificationName(ePeakFinderCond)].setValue(item.peakFinderCond());
56 attrList[specificationName(eDecisionSource)].setValue(item.decisionSource());
57
58 attrListCollection->add(item.channelId(), attrList);
59 }
60 return static_cast<DataObject*>(attrListCollection.release());
61}
62
63void L1CaloPprChanDefaultsV1Container::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
64{
65 clear();
66
67 auto it = condAttrListCollectionMap.find(m_coolFolderKey);
68 if(it == std::end(condAttrListCollectionMap)) return;
69
70 auto attrListCollection = it->second;
71 for(const auto& item : *attrListCollection) {
72 auto chanNum = item.first;
73 const auto& attrList = item.second;
74
75 auto BcidDecision1 = attrList[specificationName(eBcidDecision1)].data<unsigned int>();
76 auto SatOverride1 = attrList[specificationName(eSatOverride1)].data<unsigned int>();
77 auto BcidDecision2 = attrList[specificationName(eBcidDecision2)].data<unsigned int>();
78 auto SatOverride2 = attrList[specificationName(eSatOverride2)].data<unsigned int>();
79 auto BcidDecision3 = attrList[specificationName(eBcidDecision3)].data<unsigned int>();
80 auto SatOverride3 = attrList[specificationName(eSatOverride3)].data<unsigned int>();
81 auto PeakFinderCond = attrList[specificationName(ePeakFinderCond)].data<unsigned int>();
82 auto DecisionSource = attrList[specificationName(eDecisionSource)].data<unsigned int>();
83
84 addPprChanDefaultsV1(L1CaloPprChanDefaultsV1(chanNum, BcidDecision1, SatOverride1, BcidDecision2, SatOverride2, BcidDecision3, SatOverride3, PeakFinderCond, DecisionSource));
85 }
86}
87
89{
90 auto it = std::lower_bound(std::begin(m_pprChanDefaultsV1s),
91 std::end(m_pprChanDefaultsV1s),
92 channelId,
93 [](const L1CaloPprChanDefaultsV1& el, unsigned int val) -> bool {
94 return el.channelId() < val;
95 });
96 if(it == std::end(m_pprChanDefaultsV1s)) return nullptr;
97 return &(*it);
98}
99
101{
102 // insert into the correct position mainting the sorted vector
103 m_pprChanDefaultsV1s.insert(std::lower_bound(std::begin(m_pprChanDefaultsV1s),
104 std::end(m_pprChanDefaultsV1s),
105 pprChanDefaultsV1.channelId(),
106 [](const L1CaloPprChanDefaultsV1& el, unsigned int va) -> bool {
107 return el.channelId() < va;
108 }),
110}
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
AbstractL1CaloPersistentCondition(const std::string &condType)
void addSpecification(int specId, const std::string &specName, const std::string &specType)
coral::AttributeListSpecification * createAttributeListSpecification() const
An AttributeList represents a logical row of attributes in a metadata table.
std::vector< L1CaloPprChanDefaultsV1 > m_pprChanDefaultsV1s
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
void addPprChanDefaultsV1(const L1CaloPprChanDefaultsV1 &pprChanDefaultsV1)
const L1CaloPprChanDefaultsV1 * pprChanDefaultsV1(unsigned int channelId) const
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Configuration/PprChanDefaults .