ATLAS Offline Software
ReadFromFileMetaData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ReadFromFileMetaData.h"
6 #include "CoralBase/AttributeList.h"
7 #include "IOVDbCoolFunctions.h"
13 
15 
16 namespace IOVDbNamespace{
18  const IOVTime & refTime, const bool useEpochTimestamp) :
19  m_metaContainer(container),
20  m_referenceTime(refTime) {
21  m_payload = (container) ? (container->payloadContainer()) : (nullptr);
22  if (m_payload){
24  if (pitr!=m_payload->end()){
25  m_pptr=*pitr;
26  } else {
27  m_pptr = new CondAttrListCollection(not useEpochTimestamp);
28  m_newedPtr=true;
29  }
31  }
32  }
33  //
35  const cool::ValidityKey & refTimeKey, const bool useEpochTimestamp)
36  : ReadFromFileMetaData( container,
37  makeEpochOrRunLumi(refTimeKey,useEpochTimestamp),
38  useEpochTimestamp )
39  { }
40  //
42  if (m_newedPtr) delete m_pptr;
43  }
44 
45  //
46  bool
48  return (m_metaContainer and m_payload);
49  }
50 
51  //
54  return m_folderType;
55  }
56  //
57  unsigned int
59  return m_pptr->size();
60  }
61  //
62  std::string
64  std::string strAddress{};
66  const coral::AttributeList& payload1=m_pptr->begin()->second;
67  if (m_folderType==PoolRef) {
68  // single channel with PoolRef
69  strAddress=payload1[0].data<std::string>();
70  } else {
71  // create an AthenaAttributeList for this data
72  strAddress="POOLContainer_AthenaAttributeList][CLID=x";
73  }
74  }
75  return strAddress;
76  }
77 
78  //
79  bool
82  }
83 
84  IOVRange
87  return (m_pptr->iov_begin())->second;
88  } else {
89  return m_pptr->minRange();
90  }
91  }
92 
95  if ((m_folderType!=PoolRef) and (m_folderType!=AttrList)) {
97  }
98  return m_attrListColl;
99  }
100 
104  return m_attrList;
105  }
106 
107 //-----------------------------------------------------------------------
109  : m_metadatatool(metadatatool)
110  {
112  }
113 
115  {
117  }
118 
121  }
122 
123 
125  const std::string& folderName,
126  IIOVDbMetaDataTool* metadatatool,
127  const IOVTime & refTime, const bool useEpochTimestamp )
128  : FMDReadLock(metadatatool),
129  ReadFromFileMetaData( FMDReadLock::findFolder(folderName), refTime, useEpochTimestamp )
130  { }
131 
133  const std::string& folderName,
134  IIOVDbMetaDataTool* metadatatool,
135  const cool::ValidityKey & refTimeKey, const bool useEpochTimestamp)
136  : FMDReadLock(metadatatool),
137  ReadFromFileMetaData( FMDReadLock::findFolder(folderName), refTimeKey, useEpochTimestamp )
138  { }
139 }
CondAttrListCollection::minRange
const IOVRange & minRange() const
Current minimal IOVRange.
Definition: CondAttrListCollection.h:438
IOVDbNamespace::ReadFromFileMetaData::~ReadFromFileMetaData
~ReadFromFileMetaData()
Definition: ReadFromFileMetaData.cxx:41
IOVDbNamespace::ReadFromFileMetaData::numberOfObjects
unsigned int numberOfObjects()
Definition: ReadFromFileMetaData.cxx:58
IOVPayloadContainer.h
This class is a container for the payload of conditions data. It is intended to be used to store cond...
IOVMetaDataContainer::payloadContainer
const IOVPayloadContainer * payloadContainer() const
Access to payload container.
Definition: IOVMetaDataContainer.h:141
IOVDbNamespace::ReadFromFileMetaData::attrListCollection
CondAttrListCollection * attrListCollection()
Definition: ReadFromFileMetaData.cxx:94
IOVMetaDataContainer
This class is a container for conditions data. It is intended to be used to store conditions data fro...
Definition: IOVMetaDataContainer.h:37
IOVRange
Validity Range object. Holds two IOVTimes (start and stop)
Definition: IOVRange.h:30
IOVDbNamespace::ReadFromFileMetaData::poolPayloadRequested
bool poolPayloadRequested()
Definition: ReadFromFileMetaData.cxx:80
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
IOVDbNamespace::ReadFromFileMetaData::range
IOVRange range()
Definition: ReadFromFileMetaData.cxx:85
IOVDbNamespace::ReadFromFileMetaData::stringAddress
std::string stringAddress()
Definition: ReadFromFileMetaData.cxx:63
ILockableTool::lock_shared
virtual void lock_shared() const =0
Lock the tool.
IOVDbNamespace::ReadFromFileMetaData
Definition: ReadFromFileMetaData.h:31
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
IOVDbNamespace::PoolRefColl
@ PoolRefColl
Definition: FolderTypes.h:31
IOVDbNamespace::PoolRef
@ PoolRef
Definition: FolderTypes.h:30
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
IOVDbNamespace::FMDReadLock::m_metadatatool
IIOVDbMetaDataTool * m_metadatatool
Definition: ReadFromFileMetaData.h:70
IOVDbNamespace::makeEpochOrRunLumi
IOVTime makeEpochOrRunLumi(const cool::ValidityKey key, const bool timeIsEpoch)
Create an IOVTime in ns of epoch or run-lumi (determined by the bool) from a ValidityKey.
Definition: IOVDbCoolFunctions.cxx:87
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
AthenaAttributeList.h
IOVDbNamespace::SafeReadFromFileMetaData::SafeReadFromFileMetaData
SafeReadFromFileMetaData(const std::string &folderName, IIOVDbMetaDataTool *metadatatool, const IOVTime &refTime, const bool useEpochTimestamp)
Definition: ReadFromFileMetaData.cxx:124
IOVDbNamespace::ReadFromFileMetaData::attributeList
AthenaAttributeList * attributeList()
Definition: ReadFromFileMetaData.cxx:102
IOVDbNamespace::ReadFromFileMetaData::m_attrListColl
CondAttrListCollection * m_attrListColl
Definition: ReadFromFileMetaData.h:56
IOVDbNamespace::ReadFromFileMetaData::m_payload
const IOVPayloadContainer * m_payload
Definition: ReadFromFileMetaData.h:53
IOVDbNamespace::ReadFromFileMetaData::m_newedPtr
bool m_newedPtr
Definition: ReadFromFileMetaData.h:58
IOVDbNamespace::FMDReadLock
Definition: ReadFromFileMetaData.h:62
IOVTime
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
Definition: IOVTime.h:33
ILockableTool::unlock_shared
virtual void unlock_shared() const =0
Unlock the tool.
ReadFromFileMetaData.h
IOVDbNamespace::FMDReadLock::~FMDReadLock
~FMDReadLock()
Definition: ReadFromFileMetaData.cxx:119
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
IIOVDbMetaDataTool
This is an interface to a tool used to manage the IOV Meta Data for a given object in the MetaData St...
Definition: IIOVDbMetaDataTool.h:44
IOVDbNamespace::ReadFromFileMetaData::m_pptr
CondAttrListCollection * m_pptr
Definition: ReadFromFileMetaData.h:54
IOVDbNamespace::ReadFromFileMetaData::folderType
IOVDbNamespace::FolderType folderType()
Definition: ReadFromFileMetaData.cxx:53
IOVMetaDataContainer.h
This class is a container for conditions data. It is intended to be used to store conditions data fro...
CaloCellTimeCorrFiller.folderName
string folderName
Definition: CaloCellTimeCorrFiller.py:20
IIOVDbMetaDataTool::findMetaDataContainer
virtual IOVMetaDataContainer * findMetaDataContainer(const std::string &folderName) const =0
IOVDbCoolFunctions.h
IOVDbNamespace::ReadFromFileMetaData::isValid
bool isValid()
Definition: ReadFromFileMetaData.cxx:47
CondAttrListCollection::iov_begin
iov_const_iterator iov_begin() const
Access to Chan/IOV pairs via iterators.
Definition: CondAttrListCollection.h:337
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition: CondAttrListCollection.h:322
IOVDbNamespace::FMDReadLock::findFolder
IOVMetaDataContainer * findFolder(const std::string &folderName)
Definition: ReadFromFileMetaData.cxx:114
IOVDbNamespace::FMDReadLock::FMDReadLock
FMDReadLock(const FMDReadLock &)=delete
IOVPayloadContainer::const_iterator
payloadVec::const_iterator const_iterator
Definition: IOVPayloadContainer.h:39
IOVPayloadContainer::end
const_iterator end() const
End of payload vector.
Definition: IOVPayloadContainer.h:114
IOVDbNamespace::AttrList
@ AttrList
Definition: FolderTypes.h:28
IOVDbNamespace::ReadFromFileMetaData::m_folderType
IOVDbNamespace::FolderType m_folderType
Definition: ReadFromFileMetaData.h:57
IIOVDbMetaDataTool.h
This is an interface to a tool used to manage the IOV Meta Data for a given object in the MetaData St...
IOVDbNamespace::ReadFromFileMetaData::ReadFromFileMetaData
ReadFromFileMetaData()=delete
IOVDbNamespace::determineFolderType
FolderType determineFolderType(const std::string &folderDescription, const std::string &spec, const std::vector< cool::ChannelId > &chans)
Determine folder type with optional check using clid service to check clid matches typename.
Definition: FolderTypes.cxx:17
IOVDbNamespace::ReadFromFileMetaData::m_metaContainer
const IOVMetaDataContainer * m_metaContainer
Definition: ReadFromFileMetaData.h:51
IOVDbNamespace::ReadFromFileMetaData::m_attrList
AthenaAttributeList * m_attrList
Definition: ReadFromFileMetaData.h:55
IOVPayloadContainer::find
const_iterator find(const IOVTime &time) const
find the first payload that has a IOVRange which includes the
Definition: IOVPayloadContainer.h:136
IOVDbNamespace::ReadFromFileMetaData::m_referenceTime
IOVTime m_referenceTime
Definition: ReadFromFileMetaData.h:52
IOVDbNamespace::FolderType
FolderType
Definition: FolderTypes.h:26
IOVDbNamespace
Definition: Base64Codec.cxx:16