ATLAS Offline Software
Loading...
Searching...
No Matches
CopyEventStreamInfo Class Reference

This class provides an algorithm to make the EventStreamInfo object and update it. More...

#include <CopyEventStreamInfo.h>

Inheritance diagram for CopyEventStreamInfo:
Collaboration diagram for CopyEventStreamInfo:

Public Member Functions

 CopyEventStreamInfo (const std::string &type, const std::string &name, const IInterface *parent)
 Standard AlgTool Constructor.
virtual ~CopyEventStreamInfo ()=default
 Destructor.
virtual StatusCode initialize () override final
 AthAlgTool Interface method implementations:
virtual StatusCode beginInputFile (const SG::SourceID &="Serial") override final
 Function called when a new input file is opened.
virtual StatusCode endInputFile (const SG::SourceID &="Serial") override final
 Function called when the currently open input file got completely processed.
virtual StatusCode metaDataStop () override final
 Function called when the tool should write out its metadata.

Private Attributes

Gaudi::Property< std::vector< std::string > > m_keys
 (optional) list of keys to copy, all if empty, default: empty
ServiceHandle< IAthMetaDataSvcm_metaDataSvc {this, "MetaDataSvc", "MetaDataSvc"}
 Access to output MetaDataStore through MetaDataSvc (using MetaContainers)
ServiceHandle< StoreGateSvcm_inputMetaDataStore {this, "InputMetaDataStore", "StoreGateSvc/InputMetaDataStore"}
 MetaDataStore for input.

Detailed Description

This class provides an algorithm to make the EventStreamInfo object and update it.

Definition at line 27 of file CopyEventStreamInfo.h.

Constructor & Destructor Documentation

◆ CopyEventStreamInfo()

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

Standard AlgTool Constructor.

Definition at line 17 of file CopyEventStreamInfo.cxx.

19 :
20 base_class(type, name, parent) {
21}

◆ ~CopyEventStreamInfo()

virtual CopyEventStreamInfo::~CopyEventStreamInfo ( )
virtualdefault

Destructor.

Member Function Documentation

◆ beginInputFile()

StatusCode CopyEventStreamInfo::beginInputFile ( const SG::SourceID & = "Serial")
finaloverridevirtual

Function called when a new input file is opened.

Definition at line 33 of file CopyEventStreamInfo.cxx.

34{
35 std::vector<std::string> keys = m_keys;
36 if (keys.empty()) {
38 } else {
39 // remove keys not in the InputMetaDataStore
40 std::erase_if(keys, [this](const std::string& key) {
41 return !m_inputMetaDataStore->contains<EventStreamInfo>(key);
42 });
43 }
44
45 // If the input file doesn't have any event stream info metadata,
46 // then finish right away:
47 if (keys.empty()) return StatusCode::SUCCESS;
48
49 for (const auto &key : keys) {
50 // Ignore versioned container
51 if (key.substr(0, 1) == ";" && key.substr(3, 1) == ";") {
52 ATH_MSG_VERBOSE( "Ignore versioned container: " << key );
53 continue;
54 }
55 std::list<SG::ObjectWithVersion<EventStreamInfo> > allVersions;
56 ATH_CHECK( m_inputMetaDataStore->retrieveAllVersions(allVersions, key) );
57
58 EventStreamInfo* evtStrInfo_out = 0;
59 for (SG::ObjectWithVersion<EventStreamInfo>& obj : allVersions) {
60 const EventStreamInfo* evtStrInfo_in = obj.dataObject.cptr();
61 evtStrInfo_out = m_metaDataSvc->tryRetrieve<EventStreamInfo>(key);
62 if( !evtStrInfo_out ) {
63 auto esinfo_up = std::make_unique<EventStreamInfo>(*evtStrInfo_in);
64 ATH_CHECK( m_metaDataSvc->record( std::move(esinfo_up), key ) );
65 } else {
66 evtStrInfo_out->addEvent(evtStrInfo_in->getNumberOfEvents());
67 for (const auto& elem : evtStrInfo_in->getRunNumbers()) {
68 evtStrInfo_out->insertRunNumber(elem);
69 }
70 for (const auto& elem : evtStrInfo_in->getLumiBlockNumbers()) {
71 evtStrInfo_out->insertLumiBlockNumber(elem);
72 }
73 for (const auto& elem : evtStrInfo_in->getProcessingTags()) {
74 evtStrInfo_out->insertProcessingTag(elem);
75 }
76 for (const auto& [classId, key] : evtStrInfo_in->getItemList()) {
77 evtStrInfo_out->insertItemList(classId, key);
78 }
79 for (const auto& elem : evtStrInfo_in->getEventTypes()) {
80 evtStrInfo_out->insertEventType(elem);
81 }
82 }
83 }
84 }
85 return StatusCode::SUCCESS;
86}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current EventStreamInfo
Gaudi::Property< std::vector< std::string > > m_keys
(optional) list of keys to copy, all if empty, default: empty
ServiceHandle< StoreGateSvc > m_inputMetaDataStore
MetaDataStore for input.
ServiceHandle< IAthMetaDataSvc > m_metaDataSvc
Access to output MetaDataStore through MetaDataSvc (using MetaContainers)
const std::set< std::string > & getProcessingTags() const
const std::set< unsigned int > & getLumiBlockNumbers() const
void insertEventType(const EventType &event)
Insert new Event Type into a set.
void insertLumiBlockNumber(unsigned int lumiBlock)
Insert new Luminosity Block Number into a set.
const std::set< unsigned int > & getRunNumbers() const
void insertRunNumber(unsigned int run)
Insert new Run Number into a set.
void addEvent(unsigned int number=1)
Increase Event Counter.
const std::set< EventType > & getEventTypes() const
void insertProcessingTag(const std::string &process)
Insert new Processing Tag into a set.
const std::set< std::pair< CLID, std::string > > & getItemList() const
void insertItemList(CLID type, const std::string &key)
Insert new ItemList Entry into a set.
unsigned int getNumberOfEvents() const
std::size_t erase_if(T_container &container, T_Func pred)

◆ endInputFile()

StatusCode CopyEventStreamInfo::endInputFile ( const SG::SourceID & = "Serial")
finaloverridevirtual

Function called when the currently open input file got completely processed.

Definition at line 87 of file CopyEventStreamInfo.cxx.

88{
89 return StatusCode::SUCCESS;
90}

◆ initialize()

StatusCode CopyEventStreamInfo::initialize ( )
finaloverridevirtual

AthAlgTool Interface method implementations:

Definition at line 23 of file CopyEventStreamInfo.cxx.

23 {
24 ATH_MSG_DEBUG("Initializing " << name());
25 // Locate the MetaDataSvc and InputMetaDataStore
26 ATH_CHECK( m_metaDataSvc.retrieve() );
27 ATH_CHECK( m_inputMetaDataStore.retrieve() );
28
29 return StatusCode::SUCCESS;
30}
#define ATH_MSG_DEBUG(x)

◆ metaDataStop()

StatusCode CopyEventStreamInfo::metaDataStop ( )
finaloverridevirtual

Function called when the tool should write out its metadata.

Definition at line 91 of file CopyEventStreamInfo.cxx.

92{
93 return StatusCode::SUCCESS;
94}

Member Data Documentation

◆ m_inputMetaDataStore

ServiceHandle<StoreGateSvc> CopyEventStreamInfo::m_inputMetaDataStore {this, "InputMetaDataStore", "StoreGateSvc/InputMetaDataStore"}
private

MetaDataStore for input.

Definition at line 55 of file CopyEventStreamInfo.h.

55{this, "InputMetaDataStore", "StoreGateSvc/InputMetaDataStore"};

◆ m_keys

Gaudi::Property<std::vector<std::string> > CopyEventStreamInfo::m_keys
private
Initial value:
{this, "Keys", {},
"(optional) list of keys to copy, all if empty. default: empty"}

(optional) list of keys to copy, all if empty, default: empty

Definition at line 49 of file CopyEventStreamInfo.h.

49 {this, "Keys", {},
50 "(optional) list of keys to copy, all if empty. default: empty"};

◆ m_metaDataSvc

ServiceHandle<IAthMetaDataSvc> CopyEventStreamInfo::m_metaDataSvc {this, "MetaDataSvc", "MetaDataSvc"}
private

Access to output MetaDataStore through MetaDataSvc (using MetaContainers)

Definition at line 53 of file CopyEventStreamInfo.h.

53{this, "MetaDataSvc", "MetaDataSvc"};

The documentation for this class was generated from the following files: