ATLAS Offline Software
L1CaloPprDisabledChannelContainer.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 "CoralBase/AttributeListSpecification.h"
10 
13 
14 #include <string>
15 #include <iostream>
16 
17 
19  // Define DB rows names and types in order to construct the AttributeListSpecification object
20  this->addSpecification(eChanDeadErrorCode, std::string("ErrorCode"), std::string("UInt32"));
21  this->addSpecification(eChanCalibErrorCode, std::string("ErrorCode"), std::string("UInt32"));
22 
23  // noiseCut from PpmDeadChannels db
24  this->addSpecification(eNoiseCut, std::string("NoiseCut"), std::string("UInt16"));
25 
26  // disabledBits from DisabledTowers db
27  this->addSpecification(eDisabledBits, std::string("disabledBits"), std::string("UInt32"));
28 
29  //OKS stuff
30  this->addSpecification(eCaloDisableMask, std::string("caloDisableMask"), std::string("Int64"));
31  this->addSpecification(eEtaDisableMask, std::string("etaDisableMask"), std::string("Int64"));
32  this->addSpecification(ePhiDisableMask, std::string("phiDisableMask"), std::string("Int64"));
33  this->addSpecification(eChanDisableMask, std::string("chanDisableMask"), std::string("Int64"));
34 
35 
36 }
37 
38 L1CaloPprDisabledChannelContainer::L1CaloPprDisabledChannelContainer(const std::map<L1CaloPprDisabledChannelContainer::eCoolFolders, std::string>& folderKeysMap):AbstractL1CaloPersistentCondition("CondAttrListCollection"),
39  m_mCoolFoldersKeysMap(folderKeysMap)
40 {
41  // Define DB rows names and types in order to construct the AttributeListSpecification object
42  this->addSpecification(eChanDeadErrorCode, std::string("ErrorCode"), std::string("UInt32"));
43  this->addSpecification(eChanCalibErrorCode, std::string("ErrorCode"), std::string("UInt32"));
44  this->addSpecification(eNoiseCut, std::string("NoiseCut"), std::string("UInt16"));
45  this->addSpecification(eDisabledBits, std::string("disabledBits"), std::string("UInt32"));
46 
47  //OKS stuff
48  this->addSpecification(eCaloDisableMask, std::string("caloDisableMask"), std::string("Int64"));
49  this->addSpecification(eEtaDisableMask, std::string("etaDisableMask"), std::string("Int64"));
50  this->addSpecification(ePhiDisableMask, std::string("phiDisableMask"), std::string("Int64"));
51  this->addSpecification(eChanDisableMask, std::string("chanDisableMask"), std::string("Int64"));
52 }
53 
55 
56  std::map<L1CaloPprDisabledChannelContainer::eCoolFolders, std::string>::const_iterator it = m_mCoolFoldersKeysMap.find(efolder);
57  if(it!=m_mCoolFoldersKeysMap.end()) {
58  return it->second;
59  } else {
60  return std::string("");
61  }
62 }
63 
64 std::vector<std::string> L1CaloPprDisabledChannelContainer::coolInputKeys() const {
65  std::vector<std::string> v;
69  //v.push_back(this->coolFolderKey(L1CaloPprDisabledChannelContainer::eOKS2COOL));
70  return v;
71 }
72 
74  //return this->coolFolderKey(L1CaloPprDisabledChannelContainer::ePpmDeadChannels);
75  return std::string("");
76 }
77 
79  return 0;
80 /*
81  if(m_mPprDisabledChannelMap.size()==0) return 0;
82 
83  // Create AttributeListSpecification according to the attributes to be recorded
84  // this is required to create the AttributeList objs
85  coral::AttributeListSpecification* attrSpecification = this->createAttributeListSpecification();
86  if(!attrSpecification->size()) return NULL;
87 
88  CondAttrListCollection* attrListCollection = new CondAttrListCollection(true);
89 
90  L1CaloPprDisabledChannelMap::const_iterator pos = m_mPprDisabledChannelMap.begin();
91  for(;pos!=m_mPprDisabledChannelMap.end();++pos) {
92  const unsigned int channelId = pos->first;
93  const L1CaloPprDisabledChannel& p = pos->second;
94 
95  AthenaAttributeList attrList(*attrSpecification);
96 
97  // Set value of each row for the current channel
98  attrList[ this->specificationName(eChanDeadErrorCode) ].setValue(p.deadErrorCode().errorCode());
99  attrList[ this->specificationName(eChanCalibErrorCode) ].setValue(p.calibErrorCode.errorCode());
100 
101  attrListCollection->add(channelId, attrList);
102  }
103 
104  return (DataObject*) attrListCollection;
105 */
106 }
107 
108 void L1CaloPprDisabledChannelContainer::makeTransient(const std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap) {
109 
112 
113  if (condAttrListCollectionMap.empty()) return;
114 
115  // Reading cool paths and reading attributes
116 
117  for (const auto& [name, coll] : condAttrListCollectionMap) {
118  if (name.find("PpmDeadChannels")!=std::string::npos){
119  auto it_deadChannelsAttrListCollection = condAttrListCollectionMap.find(name);
120  const CondAttrListCollection* deadChannelsAttrListCollection = it_deadChannelsAttrListCollection->second;
121 
122 
123  //Dead channel
124  it_attr = deadChannelsAttrListCollection->begin();
125  it_attrE = deadChannelsAttrListCollection->end();
126  for(;it_attr!=it_attrE;++it_attr) {
127 
128  const coral::AttributeList& attrList(it_attr->second);
129 
130  // Get value of each row for the current channel
132 
133  ChanDeadErrorCode errorCode(attrList[ this->specificationName(eChanDeadErrorCode) ].data<unsigned int>());
134 
135  unsigned int noiseCut = attrList[this->specificationName(eNoiseCut)].data<unsigned int>();
136 
137  // test if the channel is really bad for the given IOV
138  if(!errorCode.chanValid() || noiseCut > 0) {
140  if(it_chan==m_mPprDisabledChannelMap.end()) {
142  }
143  m_mPprDisabledChannelMap[chanNum].deadErrorCode(errorCode);
144  m_mPprDisabledChannelMap[chanNum].setNoiseCut(noiseCut);
145  }
146  }
147 
148 
149 
150  } // End PpmDeadChannels
151 
152  if(name.find("PprChanCalib")!=std::string::npos){
153  auto it_calibChannelsAttrListCollection = condAttrListCollectionMap.find(name);
154  const CondAttrListCollection* calibChannelsAttrListCollection = it_calibChannelsAttrListCollection->second;
155 
156 
157 
158  // calib channels
159  it_attr = calibChannelsAttrListCollection->begin();
160  it_attrE = calibChannelsAttrListCollection->end();
161  for(;it_attr!=it_attrE;++it_attr) {
162 
163  const coral::AttributeList& attrList(it_attr->second);
164 
165  // Get value of each row for the current channel
167 
168  ChanCalibErrorCode errorCode(attrList[ this->specificationName(eChanCalibErrorCode) ].data<unsigned int>());
169 
170  // test if the channel is correctly calibrated for the given IOV
171  if(!errorCode.chanValid()) {
173  if(it_chan==m_mPprDisabledChannelMap.end()) {
175  }
176  m_mPprDisabledChannelMap[chanNum].calibErrorCode(errorCode);
177  }
178  }
179 
180 
181 
182 
183  } // End PprChanCalib
184 
185  if(name.find("DisabledTowers")!=std::string::npos){
186  auto it_disabledTowersAttrListCollection = condAttrListCollectionMap.find(name);
187  const CondAttrListCollection* disabledTowersAttrListCollection = it_disabledTowersAttrListCollection->second;
188 
189  // disabled towers
190  it_attr = disabledTowersAttrListCollection->begin();
191  it_attrE = disabledTowersAttrListCollection->end();
192  for(;it_attr!=it_attrE;++it_attr) {
193 
194  const coral::AttributeList& attrList(it_attr->second);
195 
196  // Get value of each row for the current channel
198 
199  unsigned int disabledBits = attrList[this->specificationName(eDisabledBits)].data<unsigned int>();
200 
201  if(disabledBits) {
203  if(it_chan==m_mPprDisabledChannelMap.end()) {
205  }
206  m_mPprDisabledChannelMap[chanNum].setDisabledBits(disabledBits);
207  }
208  }
209 
210 
211 
212 
213  } // End DisabledTowers
214 
215  } // End cool loop
216 
217 
218 
219 
220 
221 
222 }
223 
225  L1CaloPprDisabledChannelMap::const_iterator pos = m_mPprDisabledChannelMap.find(channelId);
226  if(pos==m_mPprDisabledChannelMap.end()) return 0;
227  else return &(pos->second);
228 }
229 
231  return this->pprDisabledChannel(channelId.id());
232 }
233 
236 }
237 
239  return this->addPprDisabledChannel(channelId.id(), pprDisabledChannel);
240 }
241 
244  for(;it!=this->end();++it) {
245  std::cout << " * item: " <<it->first << " => "<<it->second <<std::endl;
246  }
247 }
248 
250  m_mPprDisabledChannelMap.clear();
251 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
L1CaloPprDisabledChannelContainer::m_mPprDisabledChannelMap
L1CaloPprDisabledChannelMap m_mPprDisabledChannelMap
Definition: L1CaloPprDisabledChannelContainer.h:64
L1CaloPprDisabledChannel
Transient conditions class for objects defined by the online framework and retrieved from COOL.
Definition: L1CaloPprDisabledChannel.h:25
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloPprDisabledChannelContainer::pprDisabledChannel
const L1CaloPprDisabledChannel * pprDisabledChannel(unsigned int channelId) const
Definition: L1CaloPprDisabledChannelContainer.cxx:224
L1CaloPprDisabledChannelContainer::L1CaloPprDisabledChannelContainer
L1CaloPprDisabledChannelContainer()
Definition: L1CaloPprDisabledChannelContainer.cxx:18
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
L1CaloPprDisabledChannelContainer::eChanCalibErrorCode
@ eChanCalibErrorCode
Definition: L1CaloPprDisabledChannelContainer.h:30
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
ChanCalibErrorCode::chanValid
bool chanValid() const
Checks if channel is valid, ie.
Definition: ChanCalibErrorCode.cxx:46
ChanCalibErrorCode
ChanCalibErrorCode class for L1Calo error codes Adapted from /LVL1/l1calo/coolL1Calo/coolL1Calo/ChanE...
Definition: ChanCalibErrorCode.h:20
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
L1CaloPprDisabledChannelContainer::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloPprDisabledChannelContainer.cxx:78
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
AthenaAttributeList.h
ChanDeadErrorCode
ChanDeadErrorCode class for L1Calo error codes Adapted from /LVL1/l1calo/coolL1Calo/coolL1Calo/ChanDe...
Definition: ChanDeadErrorCode.h:20
L1CaloPprDisabledChannelContainer::coolInputKeys
virtual std::vector< std::string > coolInputKeys() const
Definition: L1CaloPprDisabledChannelContainer.cxx:64
L1CaloPprDisabledChannelContainer::end
L1CaloPprDisabledChannelMap::const_iterator end() const
Definition: L1CaloPprDisabledChannelContainer.h:52
L1CaloPprDisabledChannelContainer::eCaloDisableMask
@ eCaloDisableMask
Definition: L1CaloPprDisabledChannelContainer.h:30
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
L1CaloPprDisabledChannelContainer::eChanDeadErrorCode
@ eChanDeadErrorCode
Definition: L1CaloPprDisabledChannelContainer.h:30
L1CaloPprDisabledChannelContainer::eNoiseCut
@ eNoiseCut
Definition: L1CaloPprDisabledChannelContainer.h:30
L1CaloPprDisabledChannelContainer::eChanDisableMask
@ eChanDisableMask
Definition: L1CaloPprDisabledChannelContainer.h:30
L1CaloPprDisabledChannelContainer::ePprChanCalib
@ ePprChanCalib
Definition: L1CaloPprDisabledChannelContainer.h:33
L1CaloCoolChannelId::id
unsigned int id() const
Definition: L1CaloCoolChannelId.h:32
L1CaloPprDisabledChannelContainer::m_mCoolFoldersKeysMap
std::map< L1CaloPprDisabledChannelContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
Definition: L1CaloPprDisabledChannelContainer.h:65
L1CaloPprDisabledChannelContainer::ePpmDeadChannels
@ ePpmDeadChannels
Definition: L1CaloPprDisabledChannelContainer.h:33
L1CaloPprDisabledChannelContainer::begin
L1CaloPprDisabledChannelMap::const_iterator begin() const
Definition: L1CaloPprDisabledChannelContainer.h:51
ChanDeadErrorCode::chanValid
bool chanValid() const
Definition: ChanDeadErrorCode.h:62
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
CondAttrListCollection::ChanNum
unsigned int ChanNum
Definition: CondAttrListCollection.h:55
L1CaloPprDisabledChannelContainer::coolOutputKey
virtual std::string coolOutputKey() const
Definition: L1CaloPprDisabledChannelContainer.cxx:73
L1CaloPprDisabledChannelContainer::const_iterator
std::map< unsigned int, L1CaloPprDisabledChannel >::const_iterator const_iterator
Definition: L1CaloPprDisabledChannelContainer.h:35
L1CaloPprDisabledChannelContainer.h
ChanDeadErrorCode.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
L1CaloPprDisabledChannelContainer::coolFolderKey
virtual std::string coolFolderKey(L1CaloPprDisabledChannelContainer::eCoolFolders efolder) const
Definition: L1CaloPprDisabledChannelContainer.cxx:54
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
L1CaloPprDisabledChannelContainer::eEtaDisableMask
@ eEtaDisableMask
Definition: L1CaloPprDisabledChannelContainer.h:30
python.PyAthena.v
v
Definition: PyAthena.py:157
L1CaloCoolChannelId
Definition: L1CaloCoolChannelId.h:10
L1CaloPprDisabledChannelContainer::ePhiDisableMask
@ ePhiDisableMask
Definition: L1CaloPprDisabledChannelContainer.h:30
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
L1CaloPprDisabledChannelContainer::eDisabledTowers
@ eDisabledTowers
Definition: L1CaloPprDisabledChannelContainer.h:33
L1CaloPprDisabledChannelContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &condAttrListCollectionMap)
Definition: L1CaloPprDisabledChannelContainer.cxx:108
L1CaloPprDisabledChannelContainer::addPprDisabledChannel
void addPprDisabledChannel(unsigned int channelId, const L1CaloPprDisabledChannel &pprDisabledChannel)
Definition: L1CaloPprDisabledChannelContainer.cxx:234
L1CaloPprDisabledChannelContainer::eCoolFolders
eCoolFolders
Definition: L1CaloPprDisabledChannelContainer.h:33
L1CaloPprDisabledChannelContainer::clear
virtual void clear()
Definition: L1CaloPprDisabledChannelContainer.cxx:249
L1CaloPprDisabledChannelContainer::dump
void dump() const
Definition: L1CaloPprDisabledChannelContainer.cxx:242
L1CaloPprDisabledChannelContainer::eDisabledBits
@ eDisabledBits
Definition: L1CaloPprDisabledChannelContainer.h:30
ChanCalibErrorCode.h
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22