ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloReadoutConfigContainer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
6#include <algorithm>
7#include <memory>
8
9#include "CoralBase/AttributeListSpecification.h"
12
13
15 : AbstractL1CaloPersistentCondition("CondAttrListCollection")
16{
17 this->addSpecification(edescription, "description", "string");
18 this->addSpecification(ebaselinePointer, "baselinePointer", "unsigned int");
19 this->addSpecification(enumFadcSlices, "numFadcSlices", "unsigned int");
20 this->addSpecification(el1aFadcSlice, "l1aFadcSlice", "unsigned int");
21 this->addSpecification(enumLutSlices, "numLutSlices", "unsigned int");
22 this->addSpecification(el1aLutSlice, "l1aLutSlice", "unsigned int");
23 this->addSpecification(enumProcSlices, "numProcSlices", "unsigned int");
24 this->addSpecification(el1aProcSlice, "l1aProcSlice", "unsigned int");
25 this->addSpecification(enumTopoSlices, "numTopoSlices", "unsigned int");
26 this->addSpecification(el1aTopoSlice, "l1aTopoSlice", "unsigned int");
27 this->addSpecification(elatencyPpmFadc, "latencyPpmFadc", "unsigned int");
28 this->addSpecification(elatencyPpmLut, "latencyPpmLut", "unsigned int");
29 this->addSpecification(elatencyCpmInput, "latencyCpmInput", "unsigned int");
30 this->addSpecification(elatencyCpmHits, "latencyCpmHits", "unsigned int");
31 this->addSpecification(elatencyCpmRoi, "latencyCpmRoi", "unsigned int");
32 this->addSpecification(elatencyJemInput, "latencyJemInput", "unsigned int");
33 this->addSpecification(elatencyJemRoi, "latencyJemRoi", "unsigned int");
34 this->addSpecification(elatencyCpCmxBackplane, "latencyCpCmxBackplane", "unsigned int");
35 this->addSpecification(elatencyCpCmxLocal, "latencyCpCmxLocal", "unsigned int");
36 this->addSpecification(elatencyCpCmxCable, "latencyCpCmxCable", "unsigned int");
37 this->addSpecification(elatencyCpCmxSystem, "latencyCpCmxSystem", "unsigned int");
38 this->addSpecification(elatencyCpCmxInfo, "latencyCpCmxInfo", "unsigned int");
39 this->addSpecification(elatencyJetCmxBackplane, "latencyJetCmxBackplane", "unsigned int");
40 this->addSpecification(elatencyJetCmxLocal, "latencyJetCmxLocal", "unsigned int");
41 this->addSpecification(elatencyJetCmxCable, "latencyJetCmxCable", "unsigned int");
42 this->addSpecification(elatencyJetCmxSystem, "latencyJetCmxSystem", "unsigned int");
43 this->addSpecification(elatencyJetCmxInfo, "latencyJetCmxInfo", "unsigned int");
44 this->addSpecification(elatencyJetCmxRoi, "latencyJetCmxRoi", "unsigned int");
45 this->addSpecification(elatencyEnergyCmxBackplane, "latencyEnergyCmxBackplane", "unsigned int");
46 this->addSpecification(elatencyEnergyCmxLocal, "latencyEnergyCmxLocal", "unsigned int");
47 this->addSpecification(elatencyEnergyCmxCable, "latencyEnergyCmxCable", "unsigned int");
48 this->addSpecification(elatencyEnergyCmxSystem, "latencyEnergyCmxSystem", "unsigned int");
49 this->addSpecification(elatencyEnergyCmxInfo, "latencyEnergyCmxInfo", "unsigned int");
50 this->addSpecification(elatencyEnergyCmxRoi, "latencyEnergyCmxRoi", "unsigned int");
51 this->addSpecification(elatencyTopo, "latencyTopo", "unsigned int");
52 this->addSpecification(einternalLatencyJemJet, "internalLatencyJemJet", "unsigned int");
53 this->addSpecification(einternalLatencyJemSum, "internalLatencyJemSum", "unsigned int");
54 this->addSpecification(ebcOffsetJemJet, "bcOffsetJemJet", "unsigned int");
55 this->addSpecification(ebcOffsetJemSum, "bcOffsetJemSum", "unsigned int");
56 this->addSpecification(ebcOffsetCmx, "bcOffsetCmx", "int");
57 this->addSpecification(ebcOffsetTopo, "bcOffsetTopo", "int");
58 this->addSpecification(eformatTypePpm, "formatTypePpm", "string");
59 this->addSpecification(eformatTypeCpJep, "formatTypeCpJep", "string");
60 this->addSpecification(eformatTypeTopo, "formatTypeTopo", "string");
61 this->addSpecification(ecompressionThresholdPpm, "compressionThresholdPpm", "unsigned int");
62 this->addSpecification(ecompressionThresholdCpJep, "compressionThresholdCpJep", "unsigned int");
63 this->addSpecification(ecompressionThresholdTopo, "compressionThresholdTopo", "unsigned int");
64 this->addSpecification(ecompressionBaselinePpm, "compressionBaselinePpm", "unsigned int");
65 this->addSpecification(ereadout80ModePpm, "readout80ModePpm", "unsigned int");
66}
67
69 : L1CaloReadoutConfigContainer() // delegating constructor
70{
71 // cppcheck-suppress useInitializationList
72 m_coolFolderKey = folderKey;
73}
74
75
77{
78 using std::make_unique;
79
80 if(m_coolFolderKey.empty()) return nullptr;
81
82 auto* attrSpecification = this->createAttributeListSpecification();
83 if(!attrSpecification || !attrSpecification->size()) return nullptr;
84
85 auto attrListCollection = make_unique<CondAttrListCollection>(true);
86 for(const auto& item : m_readoutConfigs) {
87 AthenaAttributeList attrList(*attrSpecification);
88 attrList[specificationName(edescription)].setValue(item.description());
89 attrList[specificationName(ebaselinePointer)].setValue(item.baselinePointer());
90 attrList[specificationName(enumFadcSlices)].setValue(item.numFadcSlices());
91 attrList[specificationName(el1aFadcSlice)].setValue(item.l1aFadcSlice());
92 attrList[specificationName(enumLutSlices)].setValue(item.numLutSlices());
93 attrList[specificationName(el1aLutSlice)].setValue(item.l1aLutSlice());
94 attrList[specificationName(enumProcSlices)].setValue(item.numProcSlices());
95 attrList[specificationName(el1aProcSlice)].setValue(item.l1aProcSlice());
96 attrList[specificationName(enumTopoSlices)].setValue(item.numTopoSlices());
97 attrList[specificationName(el1aTopoSlice)].setValue(item.l1aTopoSlice());
98 attrList[specificationName(elatencyPpmFadc)].setValue(item.latencyPpmFadc());
99 attrList[specificationName(elatencyPpmLut)].setValue(item.latencyPpmLut());
100 attrList[specificationName(elatencyCpmInput)].setValue(item.latencyCpmInput());
101 attrList[specificationName(elatencyCpmHits)].setValue(item.latencyCpmHits());
102 attrList[specificationName(elatencyCpmRoi)].setValue(item.latencyCpmRoi());
103 attrList[specificationName(elatencyJemInput)].setValue(item.latencyJemInput());
104 attrList[specificationName(elatencyJemRoi)].setValue(item.latencyJemRoi());
105 attrList[specificationName(elatencyCpCmxBackplane)].setValue(item.latencyCpCmxBackplane());
106 attrList[specificationName(elatencyCpCmxLocal)].setValue(item.latencyCpCmxLocal());
107 attrList[specificationName(elatencyCpCmxCable)].setValue(item.latencyCpCmxCable());
108 attrList[specificationName(elatencyCpCmxSystem)].setValue(item.latencyCpCmxSystem());
109 attrList[specificationName(elatencyCpCmxInfo)].setValue(item.latencyCpCmxInfo());
110 attrList[specificationName(elatencyJetCmxBackplane)].setValue(item.latencyJetCmxBackplane());
111 attrList[specificationName(elatencyJetCmxLocal)].setValue(item.latencyJetCmxLocal());
112 attrList[specificationName(elatencyJetCmxCable)].setValue(item.latencyJetCmxCable());
113 attrList[specificationName(elatencyJetCmxSystem)].setValue(item.latencyJetCmxSystem());
114 attrList[specificationName(elatencyJetCmxInfo)].setValue(item.latencyJetCmxInfo());
115 attrList[specificationName(elatencyJetCmxRoi)].setValue(item.latencyJetCmxRoi());
116 attrList[specificationName(elatencyEnergyCmxBackplane)].setValue(item.latencyEnergyCmxBackplane());
117 attrList[specificationName(elatencyEnergyCmxLocal)].setValue(item.latencyEnergyCmxLocal());
118 attrList[specificationName(elatencyEnergyCmxCable)].setValue(item.latencyEnergyCmxCable());
119 attrList[specificationName(elatencyEnergyCmxSystem)].setValue(item.latencyEnergyCmxSystem());
120 attrList[specificationName(elatencyEnergyCmxInfo)].setValue(item.latencyEnergyCmxInfo());
121 attrList[specificationName(elatencyEnergyCmxRoi)].setValue(item.latencyEnergyCmxRoi());
122 attrList[specificationName(elatencyTopo)].setValue(item.latencyTopo());
123 attrList[specificationName(einternalLatencyJemJet)].setValue(item.internalLatencyJemJet());
124 attrList[specificationName(einternalLatencyJemSum)].setValue(item.internalLatencyJemSum());
125 attrList[specificationName(ebcOffsetJemJet)].setValue(item.bcOffsetJemJet());
126 attrList[specificationName(ebcOffsetJemSum)].setValue(item.bcOffsetJemSum());
127 attrList[specificationName(ebcOffsetCmx)].setValue(item.bcOffsetCmx());
128 attrList[specificationName(ebcOffsetTopo)].setValue(item.bcOffsetTopo());
129 attrList[specificationName(eformatTypePpm)].setValue(item.formatTypePpm());
130 attrList[specificationName(eformatTypeCpJep)].setValue(item.formatTypeCpJep());
131 attrList[specificationName(eformatTypeTopo)].setValue(item.formatTypeTopo());
132 attrList[specificationName(ecompressionThresholdPpm)].setValue(item.compressionThresholdPpm());
133 attrList[specificationName(ecompressionThresholdCpJep)].setValue(item.compressionThresholdCpJep());
134 attrList[specificationName(ecompressionThresholdTopo)].setValue(item.compressionThresholdTopo());
135 attrList[specificationName(ecompressionBaselinePpm)].setValue(item.compressionBaselinePpm());
136 attrList[specificationName(ereadout80ModePpm)].setValue(item.readout80ModePpm());
137
138 attrListCollection->add(item.channelId(), attrList);
139 }
140 return static_cast<DataObject*>(attrListCollection.release());
141}
142
143void L1CaloReadoutConfigContainer::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap)
144{
145 clear();
146
147 auto it = condAttrListCollectionMap.find(m_coolFolderKey);
148 if(it == std::end(condAttrListCollectionMap)) return;
149
150 auto attrListCollection = it->second;
151 for(const auto& item : *attrListCollection) {
152 auto chanNum = item.first;
153 const auto& attrList = item.second;
154
155 const auto & description = attrList[specificationName(edescription)].data<std::string>();
156 auto baselinePointer = attrList[specificationName(ebaselinePointer)].data<unsigned int>();
157 auto numFadcSlices = attrList[specificationName(enumFadcSlices)].data<unsigned int>();
158 auto l1aFadcSlice = attrList[specificationName(el1aFadcSlice)].data<unsigned int>();
159 auto numLutSlices = attrList[specificationName(enumLutSlices)].data<unsigned int>();
160 auto l1aLutSlice = attrList[specificationName(el1aLutSlice)].data<unsigned int>();
161 auto numProcSlices = attrList[specificationName(enumProcSlices)].data<unsigned int>();
162 auto l1aProcSlice = attrList[specificationName(el1aProcSlice)].data<unsigned int>();
163 auto numTopoSlices = attrList[specificationName(enumTopoSlices)].data<unsigned int>();
164 auto l1aTopoSlice = attrList[specificationName(el1aTopoSlice)].data<unsigned int>();
165 auto latencyPpmFadc = attrList[specificationName(elatencyPpmFadc)].data<unsigned int>();
166 auto latencyPpmLut = attrList[specificationName(elatencyPpmLut)].data<unsigned int>();
167 auto latencyCpmInput = attrList[specificationName(elatencyCpmInput)].data<unsigned int>();
168 auto latencyCpmHits = attrList[specificationName(elatencyCpmHits)].data<unsigned int>();
169 auto latencyCpmRoi = attrList[specificationName(elatencyCpmRoi)].data<unsigned int>();
170 auto latencyJemInput = attrList[specificationName(elatencyJemInput)].data<unsigned int>();
171 auto latencyJemRoi = attrList[specificationName(elatencyJemRoi)].data<unsigned int>();
172 auto latencyCpCmxBackplane = attrList[specificationName(elatencyCpCmxBackplane)].data<unsigned int>();
173 auto latencyCpCmxLocal = attrList[specificationName(elatencyCpCmxLocal)].data<unsigned int>();
174 auto latencyCpCmxCable = attrList[specificationName(elatencyCpCmxCable)].data<unsigned int>();
175 auto latencyCpCmxSystem = attrList[specificationName(elatencyCpCmxSystem)].data<unsigned int>();
176 auto latencyCpCmxInfo = attrList[specificationName(elatencyCpCmxInfo)].data<unsigned int>();
177 auto latencyJetCmxBackplane = attrList[specificationName(elatencyJetCmxBackplane)].data<unsigned int>();
178 auto latencyJetCmxLocal = attrList[specificationName(elatencyJetCmxLocal)].data<unsigned int>();
179 auto latencyJetCmxCable = attrList[specificationName(elatencyJetCmxCable)].data<unsigned int>();
180 auto latencyJetCmxSystem = attrList[specificationName(elatencyJetCmxSystem)].data<unsigned int>();
181 auto latencyJetCmxInfo = attrList[specificationName(elatencyJetCmxInfo)].data<unsigned int>();
182 auto latencyJetCmxRoi = attrList[specificationName(elatencyJetCmxRoi)].data<unsigned int>();
183 auto latencyEnergyCmxBackplane = attrList[specificationName(elatencyEnergyCmxBackplane)].data<unsigned int>();
184 auto latencyEnergyCmxLocal = attrList[specificationName(elatencyEnergyCmxLocal)].data<unsigned int>();
185 auto latencyEnergyCmxCable = attrList[specificationName(elatencyEnergyCmxCable)].data<unsigned int>();
186 auto latencyEnergyCmxSystem = attrList[specificationName(elatencyEnergyCmxSystem)].data<unsigned int>();
187 auto latencyEnergyCmxInfo = attrList[specificationName(elatencyEnergyCmxInfo)].data<unsigned int>();
188 auto latencyEnergyCmxRoi = attrList[specificationName(elatencyEnergyCmxRoi)].data<unsigned int>();
189 auto latencyTopo = attrList[specificationName(elatencyTopo)].data<unsigned int>();
190 auto internalLatencyJemJet = attrList[specificationName(einternalLatencyJemJet)].data<unsigned int>();
191 auto internalLatencyJemSum = attrList[specificationName(einternalLatencyJemSum)].data<unsigned int>();
192 auto bcOffsetJemJet = attrList[specificationName(ebcOffsetJemJet)].data<unsigned int>();
193 auto bcOffsetJemSum = attrList[specificationName(ebcOffsetJemSum)].data<unsigned int>();
194 auto bcOffsetCmx = attrList[specificationName(ebcOffsetCmx)].data<int>();
195 auto bcOffsetTopo = attrList[specificationName(ebcOffsetTopo)].data<int>();
196 const auto & formatTypePpm = attrList[specificationName(eformatTypePpm)].data<std::string>();
197 const auto & formatTypeCpJep = attrList[specificationName(eformatTypeCpJep)].data<std::string>();
198 const auto & formatTypeTopo = attrList[specificationName(eformatTypeTopo)].data<std::string>();
199 auto compressionThresholdPpm = attrList[specificationName(ecompressionThresholdPpm)].data<unsigned int>();
200 auto compressionThresholdCpJep = attrList[specificationName(ecompressionThresholdCpJep)].data<unsigned int>();
201 auto compressionThresholdTopo = attrList[specificationName(ecompressionThresholdTopo)].data<unsigned int>();
202 auto compressionBaselinePpm = attrList[specificationName(ecompressionBaselinePpm)].data<unsigned int>();
203 auto readout80ModePpm = attrList[specificationName(ereadout80ModePpm)].data<unsigned int>();
204
205 addReadoutConfig(L1CaloReadoutConfig(chanNum, description, baselinePointer, numFadcSlices, l1aFadcSlice, numLutSlices, l1aLutSlice, numProcSlices, l1aProcSlice, numTopoSlices, l1aTopoSlice, latencyPpmFadc, latencyPpmLut, latencyCpmInput, latencyCpmHits, latencyCpmRoi, latencyJemInput, latencyJemRoi, latencyCpCmxBackplane, latencyCpCmxLocal, latencyCpCmxCable, latencyCpCmxSystem, latencyCpCmxInfo, latencyJetCmxBackplane, latencyJetCmxLocal, latencyJetCmxCable, latencyJetCmxSystem, latencyJetCmxInfo, latencyJetCmxRoi, latencyEnergyCmxBackplane, latencyEnergyCmxLocal, latencyEnergyCmxCable, latencyEnergyCmxSystem, latencyEnergyCmxInfo, latencyEnergyCmxRoi, latencyTopo, internalLatencyJemJet, internalLatencyJemSum, bcOffsetJemJet, bcOffsetJemSum, bcOffsetCmx, bcOffsetTopo, formatTypePpm, formatTypeCpJep, formatTypeTopo, compressionThresholdPpm, compressionThresholdCpJep, compressionThresholdTopo, compressionBaselinePpm, readout80ModePpm));
206 }
207}
208
210{
211 auto it = std::lower_bound(std::begin(m_readoutConfigs),
212 std::end(m_readoutConfigs),
213 channelId,
214 [](const L1CaloReadoutConfig& el, unsigned int val) -> bool {
215 return el.channelId() < val;
216 });
217 if(it == std::end(m_readoutConfigs)) return nullptr;
218 return &(*it);
219}
220
222{
223 // insert into the correct position mainting the sorted vector
224 m_readoutConfigs.insert(std::lower_bound(std::begin(m_readoutConfigs),
225 std::end(m_readoutConfigs),
226 readoutConfig.channelId(),
227 [](const L1CaloReadoutConfig& el, unsigned int va) -> bool {
228 return el.channelId() < va;
229 }),
231}
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
AbstractL1CaloPersistentCondition(const std::string &condType)
void addSpecification(int specId, const std::string &specName, const std::string &specType)
coral::AttributeListSpecification * createAttributeListSpecification() const
An AttributeList represents a logical row of attributes in a metadata table.
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &)
std::vector< L1CaloReadoutConfig > m_readoutConfigs
const L1CaloReadoutConfig * readoutConfig(unsigned int channelId) const
virtual DataObject * makePersistent() const
void addReadoutConfig(const L1CaloReadoutConfig &readoutConfig)
Folder <-> Object mapping for /TRIGGER/L1Calo/V2/Configuration/ReadoutConfig .
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91