ATLAS Offline Software
L1CaloPprChanCalibV1Container.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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(ePedMean, "PedMean", "double");
21  this->addSpecification(ePedValue, "PedValue", "unsigned int");
22  this->addSpecification(eExtBcidThreshold, "ExtBcidThreshold", "unsigned short");
23  this->addSpecification(eSatBcidThreshLow, "SatBcidThreshLow", "unsigned short");
24  this->addSpecification(eSatBcidThreshHigh, "SatBcidThreshHigh", "unsigned short");
25  this->addSpecification(eSatBcidLevel, "SatBcidLevel", "unsigned short");
26  this->addSpecification(eBcidEnergyRangeLow, "BcidEnergyRangeLow", "unsigned short");
27  this->addSpecification(eBcidEnergyRangeHigh, "BcidEnergyRangeHigh", "unsigned short");
28  this->addSpecification(eFirStartBit, "FirStartBit", "unsigned short");
29  this->addSpecification(eFirCoeff1, "FirCoeff1", "short");
30  this->addSpecification(eFirCoeff2, "FirCoeff2", "short");
31  this->addSpecification(eFirCoeff3, "FirCoeff3", "short");
32  this->addSpecification(eFirCoeff4, "FirCoeff4", "short");
33  this->addSpecification(eFirCoeff5, "FirCoeff5", "short");
34  this->addSpecification(eLutStrategy, "LutStrategy", "unsigned short");
35  this->addSpecification(eLutOffset, "LutOffset", "unsigned short");
36  this->addSpecification(eLutNoiseCut, "LutNoiseCut", "unsigned short");
37  this->addSpecification(eLutSlope, "LutSlope", "unsigned short");
38 }
39 
41  : L1CaloPprChanCalibV1Container() // delegating constructor
42 {
43  // cppcheck-suppress useInitializationList
44  m_coolFolderKey = folderKey;
45 }
46 
48 {
49 }
50 
52 {
53  using std::make_unique;
54 
55  if(m_coolFolderKey.empty()) return nullptr;
56 
57  auto* attrSpecification = this->createAttributeListSpecification();
58  if(!attrSpecification || !attrSpecification->size()) return nullptr;
59 
60  auto attrListCollection = make_unique<CondAttrListCollection>(true);
61  for(const auto& item : m_pprChanCalibs) {
62  AthenaAttributeList attrList(*attrSpecification);
63  attrList[specificationName(eErrorCode)].setValue(item.errorCode());
64  attrList[specificationName(ePedMean)].setValue(item.pedMean());
65  attrList[specificationName(ePedValue)].setValue(item.pedValue());
66  attrList[specificationName(eExtBcidThreshold)].setValue(item.extBcidThreshold());
67  attrList[specificationName(eSatBcidThreshLow)].setValue(item.satBcidThreshLow());
68  attrList[specificationName(eSatBcidThreshHigh)].setValue(item.satBcidThreshHigh());
69  attrList[specificationName(eSatBcidLevel)].setValue(item.satBcidLevel());
70  attrList[specificationName(eBcidEnergyRangeLow)].setValue(item.bcidEnergyRangeLow());
71  attrList[specificationName(eBcidEnergyRangeHigh)].setValue(item.bcidEnergyRangeHigh());
72  attrList[specificationName(eFirStartBit)].setValue(item.firStartBit());
73  attrList[specificationName(eFirCoeff1)].setValue(item.firCoeff1());
74  attrList[specificationName(eFirCoeff2)].setValue(item.firCoeff2());
75  attrList[specificationName(eFirCoeff3)].setValue(item.firCoeff3());
76  attrList[specificationName(eFirCoeff4)].setValue(item.firCoeff4());
77  attrList[specificationName(eFirCoeff5)].setValue(item.firCoeff5());
78  attrList[specificationName(eLutStrategy)].setValue(item.lutStrategy());
79  attrList[specificationName(eLutOffset)].setValue(item.lutOffset());
80  attrList[specificationName(eLutNoiseCut)].setValue(item.lutNoiseCut());
81  attrList[specificationName(eLutSlope)].setValue(item.lutSlope());
82 
83  attrListCollection->add(item.channelId(), attrList);
84  }
85  return static_cast<DataObject*>(attrListCollection.release());
86 }
87 
88 void L1CaloPprChanCalibV1Container::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
89 {
90  clear();
91 
92  auto it = condAttrListCollectionMap.find(m_coolFolderKey);
93  if(it == std::end(condAttrListCollectionMap)) return;
94 
95  auto attrListCollection = it->second;
96  for(const auto& item : *attrListCollection) {
97  auto chanNum = item.first;
98  const auto& attrList = item.second;
99 
100  auto errorCode = attrList[specificationName(eErrorCode)].data<unsigned int>();
101  auto pedMean = attrList[specificationName(ePedMean)].data<double>();
102  auto pedValue = attrList[specificationName(ePedValue)].data<unsigned int>();
103  auto extBcidThreshold = attrList[specificationName(eExtBcidThreshold)].data<unsigned short>();
104  auto satBcidThreshLow = attrList[specificationName(eSatBcidThreshLow)].data<unsigned short>();
105  auto satBcidThreshHigh = attrList[specificationName(eSatBcidThreshHigh)].data<unsigned short>();
106  auto satBcidLevel = attrList[specificationName(eSatBcidLevel)].data<unsigned short>();
107  auto bcidEnergyRangeLow = attrList[specificationName(eBcidEnergyRangeLow)].data<unsigned short>();
108  auto bcidEnergyRangeHigh = attrList[specificationName(eBcidEnergyRangeHigh)].data<unsigned short>();
109  auto firStartBit = attrList[specificationName(eFirStartBit)].data<unsigned short>();
110  auto firCoeff1 = attrList[specificationName(eFirCoeff1)].data<short>();
111  auto firCoeff2 = attrList[specificationName(eFirCoeff2)].data<short>();
112  auto firCoeff3 = attrList[specificationName(eFirCoeff3)].data<short>();
113  auto firCoeff4 = attrList[specificationName(eFirCoeff4)].data<short>();
114  auto firCoeff5 = attrList[specificationName(eFirCoeff5)].data<short>();
115  auto lutStrategy = attrList[specificationName(eLutStrategy)].data<unsigned short>();
116  auto lutOffset = attrList[specificationName(eLutOffset)].data<unsigned short>();
117  auto lutNoiseCut = attrList[specificationName(eLutNoiseCut)].data<unsigned short>();
118  auto lutSlope = attrList[specificationName(eLutSlope)].data<unsigned short>();
119 
120  addPprChanCalibV1(L1CaloPprChanCalibV1(chanNum, errorCode, pedMean, pedValue, extBcidThreshold, satBcidThreshLow, satBcidThreshHigh, satBcidLevel, bcidEnergyRangeLow, bcidEnergyRangeHigh, firStartBit, firCoeff1, firCoeff2, firCoeff3, firCoeff4, firCoeff5, lutStrategy, lutOffset, lutNoiseCut, lutSlope));
121  }
122 }
123 
125 {
126  auto it = std::lower_bound(std::begin(m_pprChanCalibs),
128  channelId,
129  [](const L1CaloPprChanCalibV1& el, unsigned int val) -> bool {
130  return el.channelId() < val;
131  });
132  if(it == std::end(m_pprChanCalibs)) return nullptr;
133  return &(*it);
134 }
135 
137 {
138  // insert into the correct position mainting the sorted vector
139  m_pprChanCalibs.insert(std::lower_bound(std::begin(m_pprChanCalibs),
141  pprChanCalib.channelId(),
142  [](const L1CaloPprChanCalibV1& el, unsigned int va) -> bool {
143  return el.channelId() < va;
144  }),
145  pprChanCalib);
146 }
147 
149 {
150  m_pprChanCalibs.clear();
151 }
L1CaloPprChanCalibV1Container::eLutSlope
@ eLutSlope
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::clear
virtual void clear()
Definition: L1CaloPprChanCalibV1Container.cxx:148
L1CaloPprChanCalibV1Container.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloPprChanCalibV1Container::m_coolFolderKey
std::string m_coolFolderKey
Definition: L1CaloPprChanCalibV1Container.h:62
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
L1CaloPprChanCalibV1Container::m_pprChanCalibs
std::vector< L1CaloPprChanCalibV1 > m_pprChanCalibs
Definition: L1CaloPprChanCalibV1Container.h:61
L1CaloPprChanCalibV1Container::eExtBcidThreshold
@ eExtBcidThreshold
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::L1CaloPprChanCalibV1Container
L1CaloPprChanCalibV1Container()
Definition: L1CaloPprChanCalibV1Container.cxx:16
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
L1CaloPprChanCalibV1Container::eBcidEnergyRangeLow
@ eBcidEnergyRangeLow
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Calibration/Physics/PprChanCalib .
Definition: L1CaloPprChanCalibV1.h:17
L1CaloPprChanCalibV1Container::pprChanCalibV1
const L1CaloPprChanCalibV1 * pprChanCalibV1(unsigned int channelId) const
Definition: L1CaloPprChanCalibV1Container.cxx:124
AthenaAttributeList.h
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
L1CaloPprChanCalibV1Container
Definition: L1CaloPprChanCalibV1Container.h:27
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
L1CaloPprChanCalibV1Container::ePedValue
@ ePedValue
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::eLutStrategy
@ eLutStrategy
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
Definition: L1CaloPprChanCalibV1Container.cxx:88
L1CaloPprChanCalibV1Container::eErrorCode
@ eErrorCode
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::ePedMean
@ ePedMean
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::eFirCoeff3
@ eFirCoeff3
Definition: L1CaloPprChanCalibV1Container.h:37
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
L1CaloPprChanCalibV1Container::eLutNoiseCut
@ eLutNoiseCut
Definition: L1CaloPprChanCalibV1Container.h:37
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
L1CaloPprChanCalibV1Container::eSatBcidThreshHigh
@ eSatBcidThreshHigh
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::addPprChanCalibV1
void addPprChanCalibV1(const L1CaloPprChanCalibV1 &pprChanCalib)
Definition: L1CaloPprChanCalibV1Container.cxx:136
L1CaloPprChanCalibV1Container::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloPprChanCalibV1Container.cxx:51
L1CaloPprChanCalibV1Container::eSatBcidLevel
@ eSatBcidLevel
Definition: L1CaloPprChanCalibV1Container.h:37
item
Definition: ItemListSvc.h:43
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
L1CaloPprChanCalibV1Container::eFirCoeff5
@ eFirCoeff5
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::eFirCoeff2
@ eFirCoeff2
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1.h
L1CaloPprChanCalibV1Container::eFirCoeff4
@ eFirCoeff4
Definition: L1CaloPprChanCalibV1Container.h:37
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
L1CaloPprChanCalibV1Container::eLutOffset
@ eLutOffset
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1::channelId
unsigned int channelId() const
Definition: L1CaloPprChanCalibV1.h:22
L1CaloPprChanCalibV1Container::eFirCoeff1
@ eFirCoeff1
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::eSatBcidThreshLow
@ eSatBcidThreshLow
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::eFirStartBit
@ eFirStartBit
Definition: L1CaloPprChanCalibV1Container.h:37
L1CaloPprChanCalibV1Container::~L1CaloPprChanCalibV1Container
virtual ~L1CaloPprChanCalibV1Container()
Definition: L1CaloPprChanCalibV1Container.cxx:47
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22
L1CaloPprChanCalibV1Container::eBcidEnergyRangeHigh
@ eBcidEnergyRangeHigh
Definition: L1CaloPprChanCalibV1Container.h:37