ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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. More...
 
virtual ~CopyEventStreamInfo ()
 Destructor. More...
 
virtual StatusCode initialize () override final
 AthAlgTool Interface method implementations: More...
 
virtual StatusCode beginInputFile (const SG::SourceID &="Serial") override final
 Function called when a new input file is opened. More...
 
virtual StatusCode endInputFile (const SG::SourceID &="Serial") override final
 Function called when the currently open input file got completely processed. More...
 
virtual StatusCode metaDataStop () override final
 Function called when the tool should write out its metadata. More...
 

Private Attributes

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

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 16 of file CopyEventStreamInfo.cxx.

18  :
19  base_class(type, name, parent),
20  m_metaDataSvc("MetaDataSvc", name),
21  m_inputMetaDataStore("StoreGateSvc/InputMetaDataStore", name) {
22 }

◆ ~CopyEventStreamInfo()

CopyEventStreamInfo::~CopyEventStreamInfo ( )
virtual

Destructor.

Definition at line 24 of file CopyEventStreamInfo.cxx.

24  {
25 }

Member Function Documentation

◆ beginInputFile()

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

Function called when a new input file is opened.

Definition at line 37 of file CopyEventStreamInfo.cxx.

38 {
39  std::vector<std::string> keys = m_keys;
40  if (keys.empty()) {
42  } else {
43  // remove keys not in the InputMetaDataStore
44  keys.erase(
45  std::remove_if(
46  keys.begin(), keys.end(),
47  [this](std::string& key) {
48  return !m_inputMetaDataStore->contains<EventStreamInfo>(key);
49  }),
50  keys.end());
51  }
52 
53  // If the input file doesn't have any event stream info metadata,
54  // then finish right away:
55  if (keys.empty()) return StatusCode::SUCCESS;
56 
57  for (const auto &key : keys) {
58  // Ignore versioned container
59  if (key.substr(0, 1) == ";" && key.substr(3, 1) == ";") {
60  ATH_MSG_VERBOSE( "Ignore versioned container: " << key );
61  continue;
62  }
63  std::list<SG::ObjectWithVersion<EventStreamInfo> > allVersions;
64  ATH_CHECK( m_inputMetaDataStore->retrieveAllVersions(allVersions, key) );
65 
66  EventStreamInfo* evtStrInfo_out = 0;
67  for (SG::ObjectWithVersion<EventStreamInfo>& obj : allVersions) {
68  const EventStreamInfo* evtStrInfo_in = obj.dataObject.cptr();
69  evtStrInfo_out = m_metaDataSvc->tryRetrieve<EventStreamInfo>(key);
70  if( !evtStrInfo_out ) {
71  auto esinfo_up = std::make_unique<EventStreamInfo>(*evtStrInfo_in);
72  ATH_CHECK( m_metaDataSvc->record( std::move(esinfo_up), key ) );
73  } else {
74  evtStrInfo_out->addEvent(evtStrInfo_in->getNumberOfEvents());
75  for (auto elem = evtStrInfo_in->getRunNumbers().begin(),
76  lastElem = evtStrInfo_in->getRunNumbers().end();
77  elem != lastElem; elem++) {
78  evtStrInfo_out->insertRunNumber(*elem);
79  }
80  for (auto elem = evtStrInfo_in->getLumiBlockNumbers().begin(),
81  lastElem = evtStrInfo_in->getLumiBlockNumbers().end();
82  elem != lastElem; elem++) {
83  evtStrInfo_out->insertLumiBlockNumber(*elem);
84  }
85  for (auto elem = evtStrInfo_in->getProcessingTags().begin(),
86  lastElem = evtStrInfo_in->getProcessingTags().end();
87  elem != lastElem; elem++) {
88  evtStrInfo_out->insertProcessingTag(*elem);
89  }
90  for (auto elem = evtStrInfo_in->getItemList().begin(),
91  lastElem = evtStrInfo_in->getItemList().end();
92  elem != lastElem; elem++) {
93  evtStrInfo_out->insertItemList((*elem).first, (*elem).second);
94  }
95  for (auto elem = evtStrInfo_in->getEventTypes().begin(),
96  lastElem = evtStrInfo_in->getEventTypes().end();
97  elem != lastElem; elem++) {
98  evtStrInfo_out->insertEventType(*elem);
99  }
100  }
101  }
102  }
103  return(StatusCode::SUCCESS);
104 }

◆ endInputFile()

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

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

Definition at line 105 of file CopyEventStreamInfo.cxx.

106 {
107  return(StatusCode::SUCCESS);
108 }

◆ initialize()

StatusCode CopyEventStreamInfo::initialize ( )
finaloverridevirtual

AthAlgTool Interface method implementations:

Definition at line 27 of file CopyEventStreamInfo.cxx.

27  {
28  ATH_MSG_INFO("Initializing " << name());
29  // Locate the MetaDataSvc and InputMetaDataStore
30  ATH_CHECK( m_metaDataSvc.retrieve() );
31  ATH_CHECK( m_inputMetaDataStore.retrieve() );
32 
33  return(StatusCode::SUCCESS);
34 }

◆ metaDataStop()

StatusCode CopyEventStreamInfo::metaDataStop ( )
finaloverridevirtual

Function called when the tool should write out its metadata.

Definition at line 109 of file CopyEventStreamInfo.cxx.

110 {
111  return(StatusCode::SUCCESS);
112 }

Member Data Documentation

◆ m_inputMetaDataStore

ServiceHandle<StoreGateSvc> CopyEventStreamInfo::m_inputMetaDataStore
private

MetaDataStore for input.

Definition at line 55 of file CopyEventStreamInfo.h.

◆ 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.

◆ m_metaDataSvc

ServiceHandle<IAthMetaDataSvc> CopyEventStreamInfo::m_metaDataSvc
private

Access to output MetaDataStore through MetaDataSvc (using MetaContainers)

Definition at line 53 of file CopyEventStreamInfo.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EventStreamInfo::getRunNumbers
const std::set< unsigned int > & getRunNumbers() const
Definition: EventStreamInfo.cxx:23
EventStreamInfo::getProcessingTags
const std::set< std::string > & getProcessingTags() const
Definition: EventStreamInfo.cxx:35
CopyEventStreamInfo::m_inputMetaDataStore
ServiceHandle< StoreGateSvc > m_inputMetaDataStore
MetaDataStore for input.
Definition: CopyEventStreamInfo.h:55
EventStreamInfo::getEventTypes
const std::set< EventType > & getEventTypes() const
Definition: EventStreamInfo.cxx:47
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CopyEventStreamInfo::m_keys
Gaudi::Property< std::vector< std::string > > m_keys
(optional) list of keys to copy, all if empty, default: empty
Definition: CopyEventStreamInfo.h:49
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
EventStreamInfo::getLumiBlockNumbers
const std::set< unsigned int > & getLumiBlockNumbers() const
Definition: EventStreamInfo.cxx:29
EventStreamInfo::insertRunNumber
void insertRunNumber(unsigned int run)
Insert new Run Number into a set.
Definition: EventStreamInfo.cxx:64
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EventStreamInfo::addEvent
void addEvent(unsigned int number=1)
Increase Event Counter.
Definition: EventStreamInfo.cxx:53
EventStreamInfo::insertProcessingTag
void insertProcessingTag(const std::string &process)
Insert new Processing Tag into a set.
Definition: EventStreamInfo.cxx:76
CopyEventStreamInfo::m_metaDataSvc
ServiceHandle< IAthMetaDataSvc > m_metaDataSvc
Access to output MetaDataStore through MetaDataSvc (using MetaContainers)
Definition: CopyEventStreamInfo.h:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EventStreamInfo::getNumberOfEvents
unsigned int getNumberOfEvents() const
Definition: EventStreamInfo.cxx:17
EventStreamInfo::getItemList
const std::set< std::pair< CLID, std::string > > & getItemList() const
Definition: EventStreamInfo.cxx:41
EventStreamInfo
This class provides the summary information stored for data written as a Event Stream.
Definition: EventStreamInfo.h:28
EventStreamInfo::insertItemList
void insertItemList(CLID type, const std::string &key)
Insert new ItemList Entry into a set.
Definition: EventStreamInfo.cxx:82
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
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
EventStreamInfo::insertEventType
void insertEventType(const EventType &event)
Insert new Event Type into a set.
Definition: EventStreamInfo.cxx:88
EventStreamInfo::insertLumiBlockNumber
void insertLumiBlockNumber(unsigned int lumiBlock)
Insert new Luminosity Block Number into a set.
Definition: EventStreamInfo.cxx:70
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37