ATLAS Offline Software
L1CaloPedestalContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <string>
8 
9 #include "CoralBase/AttributeListSpecification.h"
12 
13 using std::cout;
14 using std::endl;
15 
17  // Define DB rows names and types in order to construct the AttributeListSpecification object
18  this->addSpecification(eMean, std::string("Mean"), std::string("double"));
19  this->addSpecification(eRMS, std::string("RMS"), std::string("double"));
20 }
21 
22 
24 
25  // return null if DataVector<> is empty
26  if(this->size()==0) return NULL;
27 
28  // Create AttributeListSpecification according to the attributes to be recorded
29  // this is required to create the AttributeList objs
30  coral::AttributeListSpecification* attrSpecification = this->createAttributeListSpecification();
31  if(!attrSpecification->size()) return NULL;
32 
33 
34  CondAttrListCollection* attrListCollection = new CondAttrListCollection(true);
35 
36  //loop on pedestals in the container to create AttributeList objs to fill the CondAttrListCollection with
39 
40  for(;pos!=pos_end;++pos) {
41  const L1CaloPedestal* ped = (*pos);
42 
43  AthenaAttributeList attrList(*attrSpecification);
44 
45  // Set value of each row for the current channel
46  attrList[ this->specificationName(eMean) ].setValue(ped->get_mean());
47  attrList[ this->specificationName(eRMS) ].setValue(ped->get_rms());
48  unsigned int iChanNumber = ped->channelId();
49 
50  //std::ostringstream attrStream;
51  //attrList.toOutputStream(attrStream);
52  //cout << " ChanNum: " << iChanNumber << ", Attribute list: " << attrStream.str() << endl;
53 
54  // add AttributeList corresponding to channel iChanNumber to the CondAttrListCollection
55  attrListCollection->add(iChanNumber, attrList);
56  }
57  return (DataObject*) attrListCollection;
58 }
59 
61 
62  //loop over CondAttrListCollection
63  CondAttrListCollection::const_iterator it = attrListCollection->begin();
64  for(;it!=attrListCollection->end();++it) {
65 
66  const coral::AttributeList& attrList = it->second;
67 
68  // Get value of each row for the current channel
70  double mean = attrList[ this->specificationName(eMean) ].data<double>();
71  double rms = attrList[ this->specificationName(eRMS) ].data<double>();
72 
73  // Create transient L1CaloPedestal obj
74  L1CaloPedestal* pedestal = new L1CaloPedestal(chanNum, mean, rms);
75 
76  // Add L1CaloPedestal to DataVector<L1CaloPedestal>
77  this->push_back(pedestal);
78  }
79 }
80 
L1CaloPedestalContainer::makeTransient
virtual void makeTransient(const CondAttrListCollection *&condAttrListCollection)
Definition: L1CaloPedestalContainer.cxx:60
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
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
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
AthenaAttributeList.h
L1CaloPedestal
L1CaloPedestal class.
Definition: L1CaloPedestal.h:17
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
L1CaloPedestal::get_rms
double get_rms() const
Definition: L1CaloPedestal.h:24
L1CaloPedestal::get_mean
double get_mean() const
Definition: L1CaloPedestal.h:23
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
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
L1CaloPedestalContainer::eMean
@ eMean
Definition: L1CaloPedestalContainer.h:40
L1CaloPedestalContainer::L1CaloPedestalContainer
L1CaloPedestalContainer()
Definition: L1CaloPedestalContainer.cxx:16
CondAttrListCollection::ChanNum
unsigned int ChanNum
Definition: CondAttrListCollection.h:55
L1CaloPedestalContainer::eRMS
@ eRMS
Definition: L1CaloPedestalContainer.h:40
DataVector< L1CaloPedestal >::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Example_ReadSampleNoise.ped
ped
Definition: Example_ReadSampleNoise.py:45
DataVector< L1CaloPedestal >::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
L1CaloPedestalContainer.h
L1CaloPedestalContainer::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloPedestalContainer.cxx:23
CondAttrListCollection::add
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
Definition: CondAttrListCollection.h:452
DataVector< L1CaloPedestal >::size
size_type size() const noexcept
Returns the number of elements in the collection.
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22
DataVector< L1CaloPedestal >::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.