ATLAS Offline Software
L1CaloPprChanExtraContainer.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(eErrorCode, "ErrorCode", "unsigned int");
20  this->addSpecification(ePedCorrEnable, "PedCorrEnable", "unsigned short");
21  this->addSpecification(eSat80BcidThreshHigh, "Sat80BcidThreshHigh", "unsigned short");
22  this->addSpecification(eSat80BcidThreshLow, "Sat80BcidThreshLow", "unsigned short");
23  this->addSpecification(eThreshNumSamplesPeak, "ThreshNumSamplesPeak", "unsigned short");
24  this->addSpecification(eThreshNumSamplesSat, "ThreshNumSamplesSat", "unsigned short");
25  this->addSpecification(eSatOverride1, "SatOverride1", "unsigned short");
26  this->addSpecification(eSatOverride2, "SatOverride2", "unsigned short");
27  this->addSpecification(eSatOverride3, "SatOverride3", "unsigned short");
28  this->addSpecification(eLutCpPar5, "LutCpPar5", "short");
29  this->addSpecification(eLutCpPar6, "LutCpPar6", "short");
30  this->addSpecification(eLutCpPar7, "LutCpPar7", "short");
31  this->addSpecification(eLutJepPar5, "LutJepPar5", "short");
32  this->addSpecification(eLutJepPar6, "LutJepPar6", "short");
33  this->addSpecification(eLutJepPar7, "LutJepPar7", "short");
34 }
35 
38 {
39  // cppcheck-suppress useInitializationList
40  m_coolFolderKey = folderKey;
41 }
42 
43 
45 {
46  using std::make_unique;
47 
48  if(m_coolFolderKey.empty()) return nullptr;
49 
50  auto* attrSpecification = this->createAttributeListSpecification();
51  if(!attrSpecification || !attrSpecification->size()) return nullptr;
52 
53  auto attrListCollection = make_unique<CondAttrListCollection>(true);
54  for(const auto& item : m_pprChanExtras) {
55  AthenaAttributeList attrList(*attrSpecification);
56  attrList[specificationName(eErrorCode)].setValue(item.errorCode());
57  attrList[specificationName(ePedCorrEnable)].setValue(item.pedCorrEnable());
58  attrList[specificationName(eSat80BcidThreshHigh)].setValue(item.sat80BcidThreshHigh());
59  attrList[specificationName(eSat80BcidThreshLow)].setValue(item.sat80BcidThreshLow());
60  attrList[specificationName(eThreshNumSamplesPeak)].setValue(item.threshNumSamplesPeak());
61  attrList[specificationName(eThreshNumSamplesSat)].setValue(item.threshNumSamplesSat());
62  attrList[specificationName(eSatOverride1)].setValue(item.satOverride1());
63  attrList[specificationName(eSatOverride2)].setValue(item.satOverride2());
64  attrList[specificationName(eSatOverride3)].setValue(item.satOverride3());
65  attrList[specificationName(eLutCpPar5)].setValue(item.lutCpPar5());
66  attrList[specificationName(eLutCpPar6)].setValue(item.lutCpPar6());
67  attrList[specificationName(eLutCpPar7)].setValue(item.lutCpPar7());
68  attrList[specificationName(eLutJepPar5)].setValue(item.lutJepPar5());
69  attrList[specificationName(eLutJepPar6)].setValue(item.lutJepPar6());
70  attrList[specificationName(eLutJepPar7)].setValue(item.lutJepPar7());
71 
72  attrListCollection->add(item.channelId(), attrList);
73  }
74  return static_cast<DataObject*>(attrListCollection.release());
75 }
76 
77 void L1CaloPprChanExtraContainer::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
78 {
79  clear();
80 
81  auto it = condAttrListCollectionMap.find(m_coolFolderKey);
82  if(it == std::end(condAttrListCollectionMap)) return;
83 
84  auto attrListCollection = it->second;
85  for(const auto& item : *attrListCollection) {
86  auto chanNum = item.first;
87  const auto& attrList = item.second;
88 
89  auto errorCode = attrList[specificationName(eErrorCode)].data<unsigned int>();
90  auto pedCorrEnable = attrList[specificationName(ePedCorrEnable)].data<unsigned short>();
91  auto sat80BcidThreshHigh = attrList[specificationName(eSat80BcidThreshHigh)].data<unsigned short>();
92  auto sat80BcidThreshLow = attrList[specificationName(eSat80BcidThreshLow)].data<unsigned short>();
93  auto threshNumSamplesPeak = attrList[specificationName(eThreshNumSamplesPeak)].data<unsigned short>();
94  auto threshNumSamplesSat = attrList[specificationName(eThreshNumSamplesSat)].data<unsigned short>();
95  auto satOverride1 = attrList[specificationName(eSatOverride1)].data<unsigned short>();
96  auto satOverride2 = attrList[specificationName(eSatOverride1)].data<unsigned short>();
97  auto satOverride3 = attrList[specificationName(eSatOverride1)].data<unsigned short>();
98  auto lutCpPar5 = attrList[specificationName(eLutCpPar5)].data<short>();
99  auto lutCpPar6 = attrList[specificationName(eLutCpPar6)].data<short>();
100  auto lutCpPar7 = attrList[specificationName(eLutCpPar7)].data<short>();
101  auto lutJepPar5 = attrList[specificationName(eLutJepPar5)].data<short>();
102  auto lutJepPar6 = attrList[specificationName(eLutJepPar6)].data<short>();
103  auto lutJepPar7 = attrList[specificationName(eLutJepPar7)].data<short>();
104 
105  addPprChanExtra(L1CaloPprChanExtra(chanNum, errorCode, pedCorrEnable, sat80BcidThreshHigh, sat80BcidThreshLow, threshNumSamplesPeak, threshNumSamplesSat, satOverride1, satOverride2, satOverride3, lutCpPar5, lutCpPar6, lutCpPar7, lutJepPar5, lutJepPar6, lutJepPar7));
106  }
107 }
108 
110 {
111  auto it = std::lower_bound(std::begin(m_pprChanExtras),
113  channelId,
114  [](const L1CaloPprChanExtra& el, unsigned int val) -> bool {
115  return el.channelId() < val;
116  });
117  if(it == std::end(m_pprChanExtras)) return nullptr;
118  return &(*it);
119 }
120 
122 {
123  // insert into the correct position mainting the sorted vector
124  m_pprChanExtras.insert(std::lower_bound(std::begin(m_pprChanExtras),
127  [](const L1CaloPprChanExtra& el, unsigned int va) -> bool {
128  return el.channelId() < va;
129  }),
130  pprChanExtra);
131 }
L1CaloPprChanExtraContainer::eSatOverride2
@ eSatOverride2
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::eLutJepPar5
@ eLutJepPar5
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::clear
virtual void clear()
Definition: L1CaloPprChanExtraContainer.h:45
L1CaloPprChanExtraContainer::eLutCpPar7
@ eLutCpPar7
Definition: L1CaloPprChanExtraContainer.h:37
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloPprChanExtraContainer::eThreshNumSamplesPeak
@ eThreshNumSamplesPeak
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::m_pprChanExtras
std::vector< L1CaloPprChanExtra > m_pprChanExtras
Definition: L1CaloPprChanExtraContainer.h:64
L1CaloPprChanExtraContainer::eErrorCode
@ eErrorCode
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::eLutJepPar7
@ eLutJepPar7
Definition: L1CaloPprChanExtraContainer.h:37
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
L1CaloPprChanExtraContainer::addPprChanExtra
void addPprChanExtra(const L1CaloPprChanExtra &pprChanExtra)
Definition: L1CaloPprChanExtraContainer.cxx:121
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
AbstractL1CaloPersistentCondition::addSpecification
void addSpecification(int specId, const std::string &specName, const std::string &specType)
Definition: AbstractL1CaloPersistentCondition.cxx:26
L1CaloPprChanExtra
Folder <-> Object mapping for /TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCalib .
Definition: L1CaloPprChanExtra.h:17
L1CaloPprChanExtraContainer::eSatOverride1
@ eSatOverride1
Definition: L1CaloPprChanExtraContainer.h:37
AthenaAttributeList.h
L1CaloPprChanExtraContainer::ePedCorrEnable
@ ePedCorrEnable
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::m_coolFolderKey
std::string m_coolFolderKey
Definition: L1CaloPprChanExtraContainer.h:65
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
L1CaloPprChanExtra.h
L1CaloPprChanExtraContainer::eLutCpPar6
@ eLutCpPar6
Definition: L1CaloPprChanExtraContainer.h:37
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
L1CaloPprChanExtra::channelId
unsigned int channelId() const
Definition: L1CaloPprChanExtra.h:22
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
L1CaloPprChanExtraContainer::eSat80BcidThreshLow
@ eSat80BcidThreshLow
Definition: L1CaloPprChanExtraContainer.h:37
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
L1CaloPprChanExtraContainer::eSatOverride3
@ eSatOverride3
Definition: L1CaloPprChanExtraContainer.h:37
item
Definition: ItemListSvc.h:43
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
L1CaloPprChanExtraContainer::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloPprChanExtraContainer.cxx:44
L1CaloPprChanExtraContainer.h
L1CaloPprChanExtraContainer::pprChanExtra
const L1CaloPprChanExtra * pprChanExtra(unsigned int channelId) const
Definition: L1CaloPprChanExtraContainer.cxx:109
L1CaloPprChanExtraContainer::eSat80BcidThreshHigh
@ eSat80BcidThreshHigh
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::L1CaloPprChanExtraContainer
L1CaloPprChanExtraContainer()
Definition: L1CaloPprChanExtraContainer.cxx:16
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
L1CaloPprChanExtraContainer::eLutCpPar5
@ eLutCpPar5
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::eLutJepPar6
@ eLutJepPar6
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::eThreshNumSamplesSat
@ eThreshNumSamplesSat
Definition: L1CaloPprChanExtraContainer.h:37
L1CaloPprChanExtraContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
Definition: L1CaloPprChanExtraContainer.cxx:77
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22
L1CaloPprChanExtraContainer
Definition: L1CaloPprChanExtraContainer.h:27