ATLAS Offline Software
L1CaloPprChanStrategyContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 #include <algorithm>
7 #include <memory>
8 
9 #include "CoralBase/AttributeListSpecification.h"
12 
13 //#include "TrigT1CaloCalibConditions/L1CaloPprChanStrategy.h"
14 
16  : AbstractL1CaloPersistentCondition("CondAttrListCollection")
17 {
18  this->addSpecification(eStrategy, "Strategy", "string");
19  this->addSpecification(eCode, "Code", "unsigned int");
20  this->addSpecification(eTimingRegime, "TimingRegime", "string");
21  this->addSpecification(eDescription, "Description", "string");
22 }
23 
25  : L1CaloPprChanStrategyContainer() // delegating constructor
26 {
27  // cppcheck-suppress useInitializationList
28  m_coolFolderKey = folderKey;
29 }
30 
31 
33 {
34  using std::make_unique;
35 
36  if(m_coolFolderKey.empty()) return nullptr;
37 
38  auto* attrSpecification = this->createAttributeListSpecification();
39  if(!attrSpecification || !attrSpecification->size()) return nullptr;
40 
41  auto attrListCollection = make_unique<CondAttrListCollection>(true);
42  for(const auto& item : m_pprChanStrategys) {
43  AthenaAttributeList attrList(*attrSpecification);
44  attrList[specificationName(eStrategy)].setValue(item.strategy());
45  attrList[specificationName(eCode)].setValue(item.code());
46  attrList[specificationName(eTimingRegime)].setValue(item.timingRegime());
47  attrList[specificationName(eDescription)].setValue(item.description());
48 
49  attrListCollection->add(item.channelId(), attrList);
50  }
51  return static_cast<DataObject*>(attrListCollection.release());
52 }
53 
54 void L1CaloPprChanStrategyContainer::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
55 {
56  clear();
57 
58  auto it = condAttrListCollectionMap.find(m_coolFolderKey);
59  if(it == std::end(condAttrListCollectionMap)) return;
60 
61  auto attrListCollection = it->second;
62  for(const auto& item : *attrListCollection) {
63  auto chanNum = item.first;
64  const auto& attrList = item.second;
65 
66  auto strategy = attrList[specificationName(eStrategy)].data<std::string>();
67  auto code = attrList[specificationName(eCode)].data<unsigned int>();
68  auto timingRegime = attrList[specificationName(eTimingRegime)].data<std::string>();
69  auto description = attrList[specificationName(eDescription)].data<std::string>();
70 
72  }
73 }
74 
76 {
77  auto it = std::lower_bound(std::begin(m_pprChanStrategys),
79  channelId,
80  [](const L1CaloPprChanStrategy& el, unsigned int val) -> bool {
81  return el.channelId() < val;
82  });
83  if(it == std::end(m_pprChanStrategys)) return nullptr;
84  return &(*it);
85 }
86 
88 {
89  // insert into the correct position mainting the sorted vector
90  m_pprChanStrategys.insert(std::lower_bound(std::begin(m_pprChanStrategys),
93  [](const L1CaloPprChanStrategy& el, unsigned int va) -> bool {
94  return el.channelId() < va;
95  }),
97 }
98 
101  for(;it!=this->end();++it) {
102  std::cout << " * item: " << *it <<std::endl;
103  }
104 }
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
L1CaloPprChanStrategyContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
Definition: L1CaloPprChanStrategyContainer.cxx:54
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloPprChanStrategyContainer::pprChanStrategy
const L1CaloPprChanStrategy * pprChanStrategy(unsigned int channelId) const
Definition: L1CaloPprChanStrategyContainer.cxx:75
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
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
L1CaloPprChanStrategyContainer::eDescription
@ eDescription
Definition: L1CaloPprChanStrategyContainer.h:35
AthenaAttributeList.h
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
L1CaloPprChanStrategyContainer::begin
const_iterator begin() const
Definition: L1CaloPprChanStrategyContainer.h:52
L1CaloPprChanStrategyContainer.h
L1CaloPprChanStrategyContainer::const_iterator
std::vector< L1CaloPprChanStrategy >::const_iterator const_iterator
Definition: L1CaloPprChanStrategyContainer.h:51
histSizes.code
code
Definition: histSizes.py:129
L1CaloPprChanStrategy::channelId
unsigned int channelId() const
Definition: L1CaloPprChanStrategy.h:23
L1CaloPprChanStrategyContainer::clear
virtual void clear()
Definition: L1CaloPprChanStrategyContainer.h:43
L1CaloPprChanStrategy
Folder <-> Object mapping for /TRIGGER/L1Calo/V2/Configuration/PprChanStrategy .
Definition: L1CaloPprChanStrategy.h:17
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
L1CaloPprChanStrategyContainer::eCode
@ eCode
Definition: L1CaloPprChanStrategyContainer.h:35
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
L1CaloPprChanStrategyContainer::m_pprChanStrategys
std::vector< L1CaloPprChanStrategy > m_pprChanStrategys
Definition: L1CaloPprChanStrategyContainer.h:61
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
L1CaloPprChanStrategyContainer::addPprChanStrategy
void addPprChanStrategy(const L1CaloPprChanStrategy &pprChanStrategy)
Definition: L1CaloPprChanStrategyContainer.cxx:87
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
L1CaloPprChanStrategyContainer
Definition: L1CaloPprChanStrategyContainer.h:25
item
Definition: ItemListSvc.h:43
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
L1CaloPprChanStrategyContainer::m_coolFolderKey
std::string m_coolFolderKey
Definition: L1CaloPprChanStrategyContainer.h:62
L1CaloPprChanStrategyContainer::eStrategy
@ eStrategy
Definition: L1CaloPprChanStrategyContainer.h:35
L1CaloPprChanStrategyContainer::end
const_iterator end() const
Definition: L1CaloPprChanStrategyContainer.h:53
L1CaloPprChanStrategyContainer::eTimingRegime
@ eTimingRegime
Definition: L1CaloPprChanStrategyContainer.h:35
L1CaloPprChanStrategyContainer::L1CaloPprChanStrategyContainer
L1CaloPprChanStrategyContainer()
Definition: L1CaloPprChanStrategyContainer.cxx:15
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
L1CaloPprChanStrategyContainer::dump
void dump() const
Definition: L1CaloPprChanStrategyContainer.cxx:99
L1CaloPprChanStrategyContainer::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloPprChanStrategyContainer.cxx:32
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88