ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ByteStreamMetadataTool Class Reference

This class provides the MetaDataTool for ByteStreamMetadata objects. More...

#include <ByteStreamMetadataTool.h>

Inheritance diagram for ByteStreamMetadataTool:
Collaboration diagram for ByteStreamMetadataTool:

Public Member Functions

 ByteStreamMetadataTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Service Constructor. More...
 
virtual ~ByteStreamMetadataTool ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Gaudi Service Interface method implementations: More...
 
virtual StatusCode beginInputFile (const SG::SourceID &) override
 Incident service handle listening for BeginInputFile and EndInputFile. More...
 
virtual StatusCode metaDataStop () override
 
virtual StatusCode endInputFile (const SG::SourceID &) override
 

Private Member Functions

std::set< std::string > keysFromInput () const
 

Private Attributes

ServiceHandle< StoreGateSvcm_metadataStore
 
ServiceHandle< StoreGateSvcm_inputStore
 

Detailed Description

This class provides the MetaDataTool for ByteStreamMetadata objects.

Definition at line 28 of file ByteStreamMetadataTool.h.

Constructor & Destructor Documentation

◆ ByteStreamMetadataTool()

ByteStreamMetadataTool::ByteStreamMetadataTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard Service Constructor.

Definition at line 17 of file ByteStreamMetadataTool.cxx.

21  : base_class(type, name, parent)
22  , m_metadataStore("StoreGateSvc/MetaDataStore", name)
23  , m_inputStore ("StoreGateSvc/InputMetaDataStore", name)
24 {
25 }

◆ ~ByteStreamMetadataTool()

ByteStreamMetadataTool::~ByteStreamMetadataTool ( )
virtual

Destructor.

Definition at line 29 of file ByteStreamMetadataTool.cxx.

30 {}

Member Function Documentation

◆ beginInputFile()

StatusCode ByteStreamMetadataTool::beginInputFile ( const SG::SourceID )
overridevirtual

Incident service handle listening for BeginInputFile and EndInputFile.

Definition at line 48 of file ByteStreamMetadataTool.cxx.

49 {
50  std::set<std::string> keys = keysFromInput();
51 
52  std::vector<std::unique_ptr<ByteStreamMetadata> > copy;
53  std::set<std::string> transGuids;
54 
55 
56  for(const auto& key : keys) {
57  ATH_MSG_DEBUG("Processing Input ByteStreamMetadata, key = " << key);
58  copy.clear();
59 
60  if(m_inputStore->contains<ByteStreamMetadata>(key)) {
61 
62  std::list<SG::ObjectWithVersion<ByteStreamMetadata> > allVersions;
63  ATH_CHECK(m_inputStore->retrieveAllVersions(allVersions, key));
64 
66  copy.push_back(std::make_unique<ByteStreamMetadata>(*obj.dataObject));
67 
68  }
69 
70 
72 
73  std::list<SG::ObjectWithVersion<ByteStreamMetadataContainer> > allVersions;
74  ATH_CHECK(m_inputStore->retrieveAllVersions(allVersions, key));
75 
77  for(const ByteStreamMetadata* md : *obj.dataObject)
78  copy.push_back(std::make_unique<ByteStreamMetadata>(*md));
79  }
80 
81 
82  if(!copy.empty()) {
83 
84  transGuids.clear();
85  // Check for existing container
86  ByteStreamMetadataContainer* bsmdc = 0;
87 
89 
90  ATH_MSG_DEBUG("Pre-existing ByteStreamMetadataContainer found");
91  ATH_CHECK(m_metadataStore->retrieve(bsmdc, key));
92 
93  for (const auto bsmd : *bsmdc)
94  transGuids.insert(bsmd->getGuid());
95 
96  } else {
97 
98  bsmdc = new ByteStreamMetadataContainer;
99  ATH_CHECK(m_metadataStore->record(bsmdc, key));
100 
101  }
102 
103  for(auto& pBSMD : copy) {
104  // Only insert new metadata records (with GUID not yet in container)
105  if(transGuids.insert(pBSMD->getGuid()).second)
106  bsmdc->push_back(std::move(pBSMD));
107  }
108  }
109  }
110 
111  return StatusCode::SUCCESS;
112 }

◆ endInputFile()

StatusCode ByteStreamMetadataTool::endInputFile ( const SG::SourceID )
overridevirtual

Definition at line 136 of file ByteStreamMetadataTool.cxx.

137 {
138  return StatusCode::SUCCESS;
139 }

◆ initialize()

StatusCode ByteStreamMetadataTool::initialize ( )
overridevirtual

Gaudi Service Interface method implementations:

Definition at line 35 of file ByteStreamMetadataTool.cxx.

36 {
37  ATH_MSG_INFO("Initializing");
38 
39  ATH_CHECK(m_metadataStore.retrieve());
40  ATH_CHECK(m_inputStore.retrieve());
41 
42  return(StatusCode::SUCCESS);
43 }

◆ keysFromInput()

std::set< std::string > ByteStreamMetadataTool::keysFromInput ( ) const
inlineprivate

Definition at line 119 of file ByteStreamMetadataTool.cxx.

120 {
121  std::vector<std::string> vKeys;
122  std::set<std::string> keys;
123 
125  keys.insert(vKeys.begin(), vKeys.end());
126 
128  keys.insert(vKeys.begin(), vKeys.end());
129 
130  return keys;
131 }

◆ metaDataStop()

StatusCode ByteStreamMetadataTool::metaDataStop ( )
overridevirtual

Definition at line 143 of file ByteStreamMetadataTool.cxx.

144 {
145  return StatusCode::SUCCESS;
146 }

Member Data Documentation

◆ m_inputStore

ServiceHandle<StoreGateSvc> ByteStreamMetadataTool::m_inputStore
private

Definition at line 49 of file ByteStreamMetadataTool.h.

◆ m_metadataStore

ServiceHandle<StoreGateSvc> ByteStreamMetadataTool::m_metadataStore
private

Definition at line 48 of file ByteStreamMetadataTool.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ByteStreamMetadata
This class is the StoreGate data object for bytestream metadata.
Definition: ByteStreamMetadata.h:25
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ByteStreamMetadataContainer
This class is the StoreGate data object for bytestream metadata.
Definition: ByteStreamMetadataContainer.h:22
ByteStreamMetadataContainer
ByteStreamMetadataContainer
Definition: ByteStreamEventTPCnv.cxx:14
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamMetadataTool::m_inputStore
ServiceHandle< StoreGateSvc > m_inputStore
Definition: ByteStreamMetadataTool.h:49
python.compareNtuple.vKeys
vKeys
Definition: compareNtuple.py:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ByteStreamMetadataTool::m_metadataStore
ServiceHandle< StoreGateSvc > m_metadataStore
Definition: ByteStreamMetadataTool.h:48
ByteStreamMetadataTool::keysFromInput
std::set< std::string > keysFromInput() const
Definition: ByteStreamMetadataTool.cxx:119
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
calibdata.copy
bool copy
Definition: calibdata.py:26
SG::ObjectWithVersion
associate a data object with its VersionedKey The object is held by a ReadHandle to delay its retriev...
Definition: SGVersionedKey.h:17
python.PyAthena.obj
obj
Definition: PyAthena.py:132
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37