ATLAS Offline Software
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 
63 void 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),
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),
106  [](const L1CaloPprChanDefaultsV1& el, unsigned int va) -> bool {
107  return el.channelId() < va;
108  }),
110 }
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
L1CaloPprChanDefaultsV1Container::clear
virtual void clear()
Definition: L1CaloPprChanDefaultsV1Container.h:45
L1CaloPprChanDefaultsV1Container::eSatOverride1
@ eSatOverride1
Definition: L1CaloPprChanDefaultsV1Container.h:37
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AbstractL1CaloPersistentCondition::addSpecification
void addSpecification(int specId, const std::string &specName, const std::string &specType)
Definition: AbstractL1CaloPersistentCondition.cxx:26
L1CaloPprChanDefaultsV1Container::m_pprChanDefaultsV1s
std::vector< L1CaloPprChanDefaultsV1 > m_pprChanDefaultsV1s
Definition: L1CaloPprChanDefaultsV1Container.h:61
AthenaAttributeList.h
L1CaloPprChanDefaultsV1Container::pprChanDefaultsV1
const L1CaloPprChanDefaultsV1 * pprChanDefaultsV1(unsigned int channelId) const
Definition: L1CaloPprChanDefaultsV1Container.cxx:88
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
L1CaloPprChanDefaultsV1Container::eSatOverride3
@ eSatOverride3
Definition: L1CaloPprChanDefaultsV1Container.h:37
L1CaloPprChanDefaultsV1Container::eBcidDecision1
@ eBcidDecision1
Definition: L1CaloPprChanDefaultsV1Container.h:37
L1CaloPprChanDefaultsV1.h
L1CaloPprChanDefaultsV1Container::eBcidDecision3
@ eBcidDecision3
Definition: L1CaloPprChanDefaultsV1Container.h:37
L1CaloPprChanDefaultsV1Container::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
Definition: L1CaloPprChanDefaultsV1Container.cxx:63
L1CaloPprChanDefaultsV1Container::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloPprChanDefaultsV1Container.cxx:37
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
L1CaloPprChanDefaultsV1Container::m_coolFolderKey
std::string m_coolFolderKey
Definition: L1CaloPprChanDefaultsV1Container.h:62
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
L1CaloPprChanDefaultsV1
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Configuration/PprChanDefaults .
Definition: L1CaloPprChanDefaultsV1.h:17
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
L1CaloPprChanDefaultsV1Container::ePeakFinderCond
@ ePeakFinderCond
Definition: L1CaloPprChanDefaultsV1Container.h:37
L1CaloPprChanDefaultsV1Container.h
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
L1CaloPprChanDefaultsV1Container::eBcidDecision2
@ eBcidDecision2
Definition: L1CaloPprChanDefaultsV1Container.h:37
L1CaloPprChanDefaultsV1Container
Definition: L1CaloPprChanDefaultsV1Container.h:27
item
Definition: ItemListSvc.h:43
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
L1CaloPprChanDefaultsV1Container::addPprChanDefaultsV1
void addPprChanDefaultsV1(const L1CaloPprChanDefaultsV1 &pprChanDefaultsV1)
Definition: L1CaloPprChanDefaultsV1Container.cxx:100
L1CaloPprChanDefaultsV1Container::eDecisionSource
@ eDecisionSource
Definition: L1CaloPprChanDefaultsV1Container.h:37
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
L1CaloPprChanDefaultsV1Container::L1CaloPprChanDefaultsV1Container
L1CaloPprChanDefaultsV1Container()
Definition: L1CaloPprChanDefaultsV1Container.cxx:16
L1CaloPprChanDefaultsV1Container::eSatOverride2
@ eSatOverride2
Definition: L1CaloPprChanDefaultsV1Container.h:37
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22
L1CaloPprChanDefaultsV1::channelId
unsigned int channelId() const
Definition: L1CaloPprChanDefaultsV1.h:22