ATLAS Offline Software
L1CaloEnergyScanRunInfoContainer.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"
9 
10 #include <string>
11 #include <iostream>
12 
14  AbstractL1CaloPersistentCondition("AthenaAttributeList"),
15  m_runNumber(0),
16  m_gainStrategy("")
17 {
18  // Define DB rows names and types in order to construct the AttributeListSpecification object
19  this->addSpecification(eRunNumber, std::string("RunNumber"), std::string("unsigned int"));
20  this->addSpecification(eGainStrategy,std::string("GainStrategy"),std::string("string"));
21 
22  m_mCoolFoldersKeysMap[L1CaloEnergyScanRunInfoContainer::eEnergyScanRunInfo] = std::string("/TRIGGER/L1Calo/V1/Results/EnergyScanRunInfo");
23 }
24 
25 L1CaloEnergyScanRunInfoContainer::L1CaloEnergyScanRunInfoContainer(const std::map<L1CaloEnergyScanRunInfoContainer::eCoolFolders, std::string>& folderKeysMap) :
26  AbstractL1CaloPersistentCondition("AthenaAttributeList"),
27  m_mCoolFoldersKeysMap(folderKeysMap),
28  m_runNumber(0),
29  m_gainStrategy("")
30 {
31  // Define DB rows names and types in order to construct the AttributeListSpecification object
32  this->addSpecification(eRunNumber, std::string("RunNumber"), std::string("unsigned int"));
33  this->addSpecification(eGainStrategy,std::string("GainStrategy"),std::string("string"));
34 }
35 
37 
38  std::map<L1CaloEnergyScanRunInfoContainer::eCoolFolders, std::string>::const_iterator it = m_mCoolFoldersKeysMap.find(efolder);
39  if(it!=m_mCoolFoldersKeysMap.end()) {
40  return it->second;
41  } else {
42  return std::string("");
43  }
44 }
45 
46 std::vector<std::string> L1CaloEnergyScanRunInfoContainer::coolInputKeys() const {
47  std::vector<std::string> v;
49  return v;
50 }
51 
54 }
55 
57 
58  // Create AttributeListSpecification according to the attributes to be recorded
59  // this is required to create the AttributeList objs
60  coral::AttributeListSpecification* attrSpecification = this->createAttributeListSpecification();
61  if(!attrSpecification->size()) return NULL;
62 
63  AthenaAttributeList* attrList = new AthenaAttributeList(*attrSpecification);
64 
65  (*attrList)[ this->specificationName(eRunNumber) ].setValue(m_runNumber);
66  (*attrList)[ this->specificationName(eGainStrategy) ].setValue(m_gainStrategy);
67 
68  return (DataObject*) attrList;
69 }
70 
71 void L1CaloEnergyScanRunInfoContainer::makeTransient(const std::map<std::string, AthenaAttributeList*>& athenaAttributeListMap) {
72 
73  std::map<std::string, AthenaAttributeList*>::const_iterator
74  it_map(athenaAttributeListMap.find(this->coolFolderKey(L1CaloEnergyScanRunInfoContainer::eEnergyScanRunInfo)));
75 
76  if(it_map!=athenaAttributeListMap.end()) {
77 
78  const AthenaAttributeList& attrList(*(it_map->second));
79 
80  m_runNumber = attrList[ this->specificationName(eRunNumber) ].data<unsigned int>();
81  m_gainStrategy = attrList[ this->specificationName(eGainStrategy) ].data<std::string>();
82 
83  } else {
84  std::cout << "L1CaloEnergyScanRunInfoContainer : Could not find requested AthenaAttributeList "
86  }
87 }
L1CaloEnergyScanRunInfoContainer::makePersistent
virtual DataObject * makePersistent() const
Definition: L1CaloEnergyScanRunInfoContainer.cxx:56
L1CaloEnergyScanRunInfoContainer::coolFolderKey
std::string coolFolderKey(L1CaloEnergyScanRunInfoContainer::eCoolFolders efolder) const
Definition: L1CaloEnergyScanRunInfoContainer.cxx:36
L1CaloEnergyScanRunInfoContainer::eRunNumber
@ eRunNumber
Definition: L1CaloEnergyScanRunInfoContainer.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AbstractL1CaloPersistentCondition::addSpecification
void addSpecification(int specId, const std::string &specName, const std::string &specType)
Definition: AbstractL1CaloPersistentCondition.cxx:26
L1CaloEnergyScanRunInfoContainer::eCoolFolders
eCoolFolders
Definition: L1CaloEnergyScanRunInfoContainer.h:34
L1CaloEnergyScanRunInfoContainer::coolInputKeys
virtual std::vector< std::string > coolInputKeys() const
Definition: L1CaloEnergyScanRunInfoContainer.cxx:46
L1CaloEnergyScanRunInfoContainer::eEnergyScanRunInfo
@ eEnergyScanRunInfo
Definition: L1CaloEnergyScanRunInfoContainer.h:34
AthenaAttributeList.h
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition: AbstractL1CaloPersistentCondition.cxx:31
L1CaloEnergyScanRunInfoContainer::makeTransient
virtual void makeTransient(const std::map< std::string, AthenaAttributeList * > &athenaAttributeListMap)
Definition: L1CaloEnergyScanRunInfoContainer.cxx:71
L1CaloEnergyScanRunInfoContainer::coolOutputKey
virtual std::string coolOutputKey() const
Definition: L1CaloEnergyScanRunInfoContainer.cxx:52
L1CaloEnergyScanRunInfoContainer::eGainStrategy
@ eGainStrategy
Definition: L1CaloEnergyScanRunInfoContainer.h:30
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
L1CaloEnergyScanRunInfoContainer::m_runNumber
unsigned int m_runNumber
Definition: L1CaloEnergyScanRunInfoContainer.h:60
L1CaloEnergyScanRunInfoContainer::m_mCoolFoldersKeysMap
std::map< L1CaloEnergyScanRunInfoContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
Definition: L1CaloEnergyScanRunInfoContainer.h:59
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition: AbstractL1CaloPersistentCondition.cxx:44
L1CaloEnergyScanRunInfoContainer.h
L1CaloEnergyScanRunInfoContainer::L1CaloEnergyScanRunInfoContainer
L1CaloEnergyScanRunInfoContainer()
Definition: L1CaloEnergyScanRunInfoContainer.cxx:13
python.PyAthena.v
v
Definition: PyAthena.py:154
L1CaloEnergyScanRunInfoContainer::m_gainStrategy
std::string m_gainStrategy
Definition: L1CaloEnergyScanRunInfoContainer.h:61
AbstractL1CaloPersistentCondition
AbstractL1CaloConditionContainer abstract base class for L1Calo persistent conditions container objec...
Definition: AbstractL1CaloPersistentCondition.h:22