ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloPprConditionsContainer.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 "CoralBase/AttributeListSpecification.h"
10
13
14#include <iostream>
15#include <set>
16
18
28{
29 // Define DB rows names and types in order to construct the AttributeListSpecification object
30 this->addSpecification(eExtBcidThreshold, std::string("ExtBcidThreshold"), std::string("UInt16"));
31 this->addSpecification(eSatBcidThreshLow, std::string("SatBcidThreshLow"), std::string("UInt16"));
32 this->addSpecification(eSatBcidThreshHigh, std::string("SatBcidThreshHigh"), std::string("UInt16"));
33 this->addSpecification(eSatBcidLevel, std::string("SatBcidLevel"), std::string("UInt16"));
34 this->addSpecification(eBcidEnergyRangeLow, std::string("BcidEnergyRangeLow"), std::string("UInt16"));
35 this->addSpecification(eBcidEnergyRangeHigh, std::string("BcidEnergyRangeHigh"), std::string("UInt16"));
36 this->addSpecification(eFirStartBit, std::string("FirStartBit"), std::string("UInt16"));
37 this->addSpecification(eBcidDecision1, std::string("CR12_BcidDecision1"), std::string("UInt32"));
38 this->addSpecification(eSatOverride1, std::string("CR12_SatOverride1"), std::string("UInt32"));
39 this->addSpecification(eBcidDecision2, std::string("CR13_BcidDecision2"), std::string("UInt32"));
40 this->addSpecification(eSatOverride2, std::string("CR13_SatOverride2"), std::string("UInt32"));
41 this->addSpecification(eBcidDecision3, std::string("CR14_BcidDecision3"), std::string("UInt32"));
42 this->addSpecification(eSatOverride3, std::string("CR14_SatOverride3"), std::string("UInt32"));
43 this->addSpecification(ePeakFinderCond, std::string("CR15_PeakFinderCond"), std::string("UInt32"));
44 this->addSpecification(eDecisionSource, std::string("CR15_DecisionSource"), std::string("UInt32"));
45
46 this->addSpecification(eFirCoeff1, std::string("FirCoeff1"), std::string("short"));
47 this->addSpecification(eFirCoeff2, std::string("FirCoeff2"), std::string("short"));
48 this->addSpecification(eFirCoeff3, std::string("FirCoeff3"), std::string("short"));
49 this->addSpecification(eFirCoeff4, std::string("FirCoeff4"), std::string("short"));
50 this->addSpecification(eFirCoeff5, std::string("FirCoeff5"), std::string("short"));
51
52 this->addSpecification(eLutStrategy, std::string("LutStrategy"), std::string("UInt16"));
53 this->addSpecification(eLutOffset, std::string("LutOffset"), std::string("UInt16"));
54 this->addSpecification(eLutSlope, std::string("LutSlope"), std::string("UInt16"));
55 this->addSpecification(eLutNoiseCut, std::string("LutNoiseCut"), std::string("UInt16"));
56 this->addSpecification(ePedValue, std::string("PedValue"), std::string("UInt32"));
57 this->addSpecification(ePedMean, std::string("PedMean"), std::string("Double"));
58
59 m_mCoolFoldersKeysMap[L1CaloPprConditionsContainer::ePprChanCalib] = std::string("/TRIGGER/L1Calo/V1/Calibration/Physics/PprChanCalib");
60 m_mCoolFoldersKeysMap[L1CaloPprConditionsContainer::ePprChanDefaults] = std::string("/TRIGGER/L1Calo/V1/Configuration/PprChanDefaults");
61
63 this->clear();
64}
65
66L1CaloPprConditionsContainer::L1CaloPprConditionsContainer(const std::map<L1CaloPprConditionsContainer::eCoolFolders, std::string>& folderKeysMap):AbstractL1CaloPersistentCondition("CondAttrListCollection"),
67 m_mCoolFoldersKeysMap(folderKeysMap),
76{
77 // Define DB rows names and types in order to construct the AttributeListSpecification object
78 this->addSpecification(eExtBcidThreshold, std::string("ExtBcidThreshold"), std::string("UInt16"));
79 this->addSpecification(eSatBcidThreshLow, std::string("SatBcidThreshLow"), std::string("UInt16"));
80 this->addSpecification(eSatBcidThreshHigh, std::string("SatBcidThreshHigh"), std::string("UInt16"));
81 this->addSpecification(eSatBcidLevel, std::string("SatBcidLevel"), std::string("UInt16"));
82 this->addSpecification(eBcidEnergyRangeLow, std::string("BcidEnergyRangeLow"), std::string("UInt16"));
83 this->addSpecification(eBcidEnergyRangeHigh, std::string("BcidEnergyRangeHigh"), std::string("UInt16"));
84 this->addSpecification(eFirStartBit, std::string("FirStartBit"), std::string("UInt16"));
85 this->addSpecification(eBcidDecision1, std::string("CR12_BcidDecision1"), std::string("UInt32"));
86 this->addSpecification(eSatOverride1, std::string("CR12_SatOverride1"), std::string("UInt32"));
87 this->addSpecification(eBcidDecision2, std::string("CR13_BcidDecision2"), std::string("UInt32"));
88 this->addSpecification(eSatOverride2, std::string("CR13_SatOverride2"), std::string("UInt32"));
89 this->addSpecification(eBcidDecision3, std::string("CR14_BcidDecision3"), std::string("UInt32"));
90 this->addSpecification(eSatOverride3, std::string("CR14_SatOverride3"), std::string("UInt32"));
91 this->addSpecification(ePeakFinderCond, std::string("CR15_PeakFinderCond"), std::string("UInt32"));
92 this->addSpecification(eDecisionSource, std::string("CR15_DecisionSource"), std::string("UInt32"));
93
94 this->addSpecification(eFirCoeff1, std::string("FirCoeff1"), std::string("short"));
95 this->addSpecification(eFirCoeff2, std::string("FirCoeff2"), std::string("short"));
96 this->addSpecification(eFirCoeff3, std::string("FirCoeff3"), std::string("short"));
97 this->addSpecification(eFirCoeff4, std::string("FirCoeff4"), std::string("short"));
98 this->addSpecification(eFirCoeff5, std::string("FirCoeff5"), std::string("short"));
99
100 this->addSpecification(eLutStrategy, std::string("LutStrategy"), std::string("UInt16"));
101 this->addSpecification(eLutOffset, std::string("LutOffset"), std::string("UInt16"));
102 this->addSpecification(eLutSlope, std::string("LutSlope"), std::string("UInt16"));
103 this->addSpecification(eLutNoiseCut, std::string("LutNoiseCut"), std::string("UInt16"));
104 this->addSpecification(ePedValue, std::string("PedValue"), std::string("UInt32"));
105 this->addSpecification(ePedMean, std::string("PedMean"), std::string("Double"));
106
108 this->clear();
109}
110
115
117
118 std::map<L1CaloPprConditionsContainer::eCoolFolders, std::string>::const_iterator it = m_mCoolFoldersKeysMap.find(efolder);
119 if(it!=m_mCoolFoldersKeysMap.end()) {
120 return it->second;
121 } else {
122 return std::string("");
123 }
124}
125
126std::vector<std::string> L1CaloPprConditionsContainer::coolInputKeys() const {
127 std::vector<std::string> v;
130 return v;
131}
132
136
138 // this container is not supposed to be saved to COOL
139 return 0;
140}
141
142void L1CaloPprConditionsContainer::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap) {
143
144 this->clear();
145
146 std::string chanCalibFolderKey(this->coolFolderKey(L1CaloPprConditionsContainer::ePprChanCalib));
147 std::map<std::string, const CondAttrListCollection*>::const_iterator it_pprChanCalibAttrListCollection = condAttrListCollectionMap.find(chanCalibFolderKey);
148 if(it_pprChanCalibAttrListCollection==condAttrListCollectionMap.end()) {
149 std::cout<<"L1CaloPprConditionsContainer : Could not find requested CondAttrListCollection "<< chanCalibFolderKey << std::endl;
150 return;
151 }
152
153 const CondAttrListCollection* chanCalibAttrListCollection = it_pprChanCalibAttrListCollection->second;
154
155 std::string chanDefaultsFolderKey(this->coolFolderKey(L1CaloPprConditionsContainer::ePprChanDefaults));
156 std::map<std::string, const CondAttrListCollection*>::const_iterator it_pprChanDefaultsAttrListCollection = condAttrListCollectionMap.find(chanDefaultsFolderKey);
157 if(it_pprChanDefaultsAttrListCollection==condAttrListCollectionMap.end()) {
158 std::cout<<"L1CaloPprConditionsContainer : Could not find requested CondAttrListCollection "<< chanDefaultsFolderKey << std::endl;
159 return;
160 }
161
162 const CondAttrListCollection* chanDefaultsAttrListCollection = it_pprChanDefaultsAttrListCollection->second;
163
164 // There should be only one channel (channel#1) in the Default folder
165 // we just retrieve that one, waiting for a better method to retrieve that information.
166 const int defaultChannel = 1;
167 const coral::AttributeList& chanDefaultAttrList(chanDefaultsAttrListCollection->attributeList(defaultChannel));
168
169 m_bcidDecision1 = chanDefaultAttrList[ this->specificationName(eBcidDecision1) ].data<unsigned int>();
170 m_satOverride1 = chanDefaultAttrList[ this->specificationName(eSatOverride1) ].data<unsigned int>();
171 m_bcidDecision2 = chanDefaultAttrList[ this->specificationName(eBcidDecision2) ].data<unsigned int>();
172 m_satOverride2 = chanDefaultAttrList[ this->specificationName(eSatOverride2) ].data<unsigned int>();
173 m_bcidDecision3 = chanDefaultAttrList[ this->specificationName(eBcidDecision3) ].data<unsigned int>();
174 m_satOverride3 = chanDefaultAttrList[ this->specificationName(eSatOverride3) ].data<unsigned int>();
175 m_peakFinderCond = chanDefaultAttrList[ this->specificationName(ePeakFinderCond) ].data<unsigned int>();
176 m_decisionSource = chanDefaultAttrList[ this->specificationName(eDecisionSource) ].data<unsigned int>();
177
178 //loop over CondAttrListCollection
179 CondAttrListCollection::const_iterator it_AttrListColl = chanCalibAttrListCollection->begin();
180 for(;it_AttrListColl!=chanCalibAttrListCollection->end();++it_AttrListColl) {
181
182 CondAttrListCollection::ChanNum chanNum(it_AttrListColl->first);
183 const coral::AttributeList& chanCalibAttrList(it_AttrListColl->second);
184
185 unsigned short extBcidThreshold = chanCalibAttrList[ this->specificationName(eExtBcidThreshold) ].data<unsigned short>();
186 unsigned short satBcidThreshLow = chanCalibAttrList[ this->specificationName(eSatBcidThreshLow) ].data<unsigned short>();
187 unsigned short satBcidThreshHigh = chanCalibAttrList[ this->specificationName(eSatBcidThreshHigh) ].data<unsigned short>();
188 unsigned short satBcidLevel = chanCalibAttrList[ this->specificationName(eSatBcidLevel) ].data<unsigned short>();
189
190 unsigned short bcidEnergyRangeLow = chanCalibAttrList[ this->specificationName(eBcidEnergyRangeLow) ].data<unsigned short>();
191 unsigned short bcidEnergyRangeHigh = chanCalibAttrList[ this->specificationName(eBcidEnergyRangeHigh) ].data<unsigned short>();
192
193 unsigned short firStartBit = chanCalibAttrList[ this->specificationName(eFirStartBit) ].data<unsigned short>();
194
195 short int firCoeff1 = chanCalibAttrList[ this->specificationName(eFirCoeff1) ].data<short>();
196 short int firCoeff2 = chanCalibAttrList[ this->specificationName(eFirCoeff2) ].data<short>();
197 short int firCoeff3 = chanCalibAttrList[ this->specificationName(eFirCoeff3) ].data<short>();
198 short int firCoeff4 = chanCalibAttrList[ this->specificationName(eFirCoeff4) ].data<short>();
199 short int firCoeff5 = chanCalibAttrList[ this->specificationName(eFirCoeff5) ].data<short>();
200
201 unsigned short lutStrategy = chanCalibAttrList[ this->specificationName(eLutStrategy) ].data<unsigned short>();
202 unsigned short lutOffset = chanCalibAttrList[ this->specificationName(eLutOffset) ].data<unsigned short>();
203 unsigned short lutSlope = chanCalibAttrList[ this->specificationName(eLutSlope) ].data<unsigned short>();
204 unsigned short lutNoiseCut = chanCalibAttrList[ this->specificationName(eLutNoiseCut) ].data<unsigned short>();
205 unsigned int pedValue = chanCalibAttrList[ this->specificationName(ePedValue) ].data<unsigned int>();
206 float pedMean = (float) chanCalibAttrList[ this->specificationName(ePedMean) ].data<double>();
207
208 L1CaloCoolChannelId coolId(chanNum);
209 unsigned int index = (coolId.crate()<<10)+(coolId.module()<<6)+(coolId.subModule()<<2)+coolId.channel();
210 if (index < s_vectorSize) {
211 L1CaloPprConditions* l1Calocond = new L1CaloPprConditions(extBcidThreshold, satBcidThreshLow, satBcidThreshHigh,
212 satBcidLevel, bcidEnergyRangeLow, bcidEnergyRangeHigh,
213 firStartBit, firCoeff1, firCoeff2, firCoeff3, firCoeff4, firCoeff5,
214 lutStrategy, lutOffset, lutSlope, lutNoiseCut, pedValue, pedMean);
215 m_mPprConditionsVec[index] = l1Calocond;
216 }
217 }
218}
219
221 L1CaloCoolChannelId coolId(channelId);
222 return pprConditions(coolId);
223}
224
226 unsigned int index = (channelId.crate()<<10)+(channelId.module()<<6)+(channelId.subModule()<<2)+channelId.channel();
228 else return 0;
229}
230
232 std::cout << "bcidDecision1: " << m_bcidDecision1 << ", "
233 << "satOverride1: " << m_satOverride1 << ", "
234 << "bcidDecision2: " << m_bcidDecision2 << ", "
235 << "satOverride2: " << m_satOverride2 << ", "
236 << "bcidDecision3: " << m_bcidDecision3 << ", "
237 << "satOverride3: " << m_satOverride3 << ", "
238 << "peakFinderCond: " << m_peakFinderCond << ", "
239 << "decisionSource: " << m_decisionSource << std::endl;
240 L1CaloPprConditionsVec::const_iterator it = m_mPprConditionsVec.begin();
241 L1CaloPprConditionsVec::const_iterator itE = m_mPprConditionsVec.end();
242 for (int index = 0; it != itE; ++it, ++index) {
243 if (*it) std::cout << "index " << index << " * item: " << *it << std::endl;
244 }
245}
246
248 L1CaloPprConditionsVec::const_iterator pos = m_mPprConditionsVec.begin();
249 L1CaloPprConditionsVec::const_iterator posE = m_mPprConditionsVec.end();
250 for(; pos != posE; ++pos) if (*pos) delete *pos;
251 L1CaloPprConditions* p = 0;
253}
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)
This class is a collection of AttributeLists where each one is associated with a channel number.
const AttributeList & attributeList(ChanNum chanNum) const
attribute list for a given channel number
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table.
std::map< L1CaloPprConditionsContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
const L1CaloPprConditions * pprConditions(unsigned int channelId) const
virtual std::vector< std::string > coolInputKeys() const
virtual DataObject * makePersistent() const
std::string coolFolderKey(L1CaloPprConditionsContainer::eCoolFolders efolder) const
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &condAttrListCollectionMap)
Transient conditions class for objects defined by the online framework and retrieved from COOL.
Definition index.py:1