ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloPedestalContainer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <string>
8
9#include "CoralBase/AttributeListSpecification.h"
12
13using std::cout;
14using 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 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
69 CondAttrListCollection::ChanNum chanNum = it->first;
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
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.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
const_iterator end() const noexcept
const_iterator begin() const noexcept
size_type size() const noexcept
virtual void makeTransient(const CondAttrListCollection *&condAttrListCollection)
virtual DataObject * makePersistent() const
L1CaloPedestal class.
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="")