ATLAS Offline Software
L1CaloDisabledTowersContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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(edisabledBits, "disabledBits", "unsigned int");
20 }
21 
23  : L1CaloDisabledTowersContainer() // delegating constructor
24 {
25  // cppcheck-suppress useInitializationList
26  m_coolFolderKey = folderKey;
27 }
28 
29 
31 {
32  using std::make_unique;
33 
34  if(m_coolFolderKey.empty()) return nullptr;
35 
36  auto* attrSpecification = this->createAttributeListSpecification();
37  if(!attrSpecification || !attrSpecification->size()) return nullptr;
38 
39  auto attrListCollection = make_unique<CondAttrListCollection>(true);
40  for(const auto& item : m_disabledTowerss) {
41  AthenaAttributeList attrList(*attrSpecification);
42  attrList[specificationName(edisabledBits)].setValue(item.disabledBits());
43 
44  attrListCollection->add(item.channelId(), attrList);
45  }
46  return static_cast<DataObject*>(attrListCollection.release());
47 }
48 
49 void L1CaloDisabledTowersContainer::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
50 {
51  clear();
52 
53  // In the case of overlay, we need multiple instances of L1CaloPprChanDefaultsContainer
54  // Take the last element in the map
55  if (condAttrListCollectionMap.empty()) return;
56  auto it = condAttrListCollectionMap.rbegin();
57 
58  auto attrListCollection = it->second;
59  for(const auto& item : *attrListCollection) {
60  auto chanNum = item.first;
61  const auto& attrList = item.second;
62 
63  auto disabledBits = attrList[specificationName(edisabledBits)].data<unsigned int>();
64 
66  }
67 }
68 
70 {
71  auto it = std::lower_bound(std::begin(m_disabledTowerss),
73  channelId,
74  [](const L1CaloDisabledTowers& el, unsigned int val) -> bool {
75  return el.channelId() < val;
76  });
77  if(it == std::end(m_disabledTowerss)) return nullptr;
78  return &(*it);
79 }
80 
82 {
83  // insert into the correct position mainting the sorted vector
84  m_disabledTowerss.insert(std::lower_bound(std::begin(m_disabledTowerss),
87  [](const L1CaloDisabledTowers& el, unsigned int va) -> bool {
88  return el.channelId() < va;
89  }),
91 }
L1CaloDisabledTowers::channelId
unsigned int channelId() const
Definition: L1CaloDisabledTowers.h:22
L1CaloDisabledTowersContainer::m_coolFolderKey
std::string m_coolFolderKey
Definition: L1CaloDisabledTowersContainer.h:62
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloDisabledTowersContainer
Definition: L1CaloDisabledTowersContainer.h:27
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
L1CaloDisabledTowersContainer::clear
virtual void clear()
Definition: L1CaloDisabledTowersContainer.h:45
L1CaloDisabledTowersContainer::addDisabledTowers
void addDisabledTowers(const L1CaloDisabledTowers &disabledTowers)
Definition: L1CaloDisabledTowersContainer.cxx:81
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
L1CaloDisabledTowersContainer.h
AthenaAttributeList.h
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
L1CaloDisabledTowersContainer::disabledTowers
const L1CaloDisabledTowers * disabledTowers(unsigned int channelId) const
Definition: L1CaloDisabledTowersContainer.cxx:69
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
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
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
L1CaloDisabledTowersContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
Definition: L1CaloDisabledTowersContainer.cxx:49
L1CaloDisabledTowers.h
L1CaloDisabledTowersContainer::m_disabledTowerss
std::vector< L1CaloDisabledTowers > m_disabledTowerss
Definition: L1CaloDisabledTowersContainer.h:61
item
Definition: ItemListSvc.h:43
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
L1CaloDisabledTowers
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Conditions/DisabledTowers .
Definition: L1CaloDisabledTowers.h:17
L1CaloDisabledTowersContainer::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloDisabledTowersContainer.cxx:30
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22
L1CaloDisabledTowersContainer::edisabledBits
@ edisabledBits
Definition: L1CaloDisabledTowersContainer.h:37
L1CaloDisabledTowersContainer::L1CaloDisabledTowersContainer
L1CaloDisabledTowersContainer()
Definition: L1CaloDisabledTowersContainer.cxx:16