HepMC3 event record library
|
Stores run-related information.
Manages run-related information. Contains run-wide attributes
Definition at line 32 of file GenRunInfo.h.
#include <GenRunInfo.h>
Data Structures | |
struct | ToolInfo |
Interrnal struct for keeping track of tools. More... | |
Public Member Functions | |
GenRunInfo () | |
Default constructor. More... | |
GenRunInfo (const GenRunInfo &r) | |
GenRunInfo & | operator= (const GenRunInfo &r) |
const std::vector< ToolInfo > & | tools () const |
The vector of tools used to produce this run. More... | |
std::vector< ToolInfo > & | tools () |
The vector of tools used to produce this run. More... | |
bool | has_weight (const string &name) const |
Check if a weight name is present. More... | |
int | weight_index (const string &name) const |
Return the index corresponding to a weight name. More... | |
const std::vector< std::string > & | weight_names () const |
Get the vector of weight names. More... | |
void | set_weight_names (const std::vector< std::string > &names) |
Set the names of the weights in this run. More... | |
void | add_attribute (const string &name, const shared_ptr< Attribute > &att) |
add an attribute This will overwrite existing attribute if an attribute with the same name is present More... | |
void | remove_attribute (const string &name) |
Remove attribute. More... | |
template<class T > | |
shared_ptr< T > | attribute (const string &name) const |
Get attribute of type T. More... | |
string | attribute_as_string (const string &name) const |
Get attribute of any type as string. More... | |
std::vector< string > | attribute_names () const |
Get list of attribute names. More... | |
std::map< std::string, shared_ptr< Attribute > > | attributes () const |
Get a copy of the list of attributes. More... | |
Methods to fill GenRunInfoData and to read it back | |
void | write_data (GenRunInfoData &data) const |
Fill GenRunInfoData object. More... | |
void | read_data (const GenRunInfoData &data) |
Fill GenRunInfo based on GenRunInfoData. More... | |
Private Attributes | |
Fields | |
std::vector< ToolInfo > | m_tools |
The vector of tools used to produce this run. More... | |
std::map< std::string, int > | m_weight_indices |
A map of weight names mapping to indices. More... | |
std::vector< std::string > | m_weight_names |
A vector of weight names. More... | |
std::map< std::string, shared_ptr< Attribute > > | m_attributes |
Map of attributes. More... | |
std::recursive_mutex | m_lock_attributes |
Mutex lock for the m_attibutes map. More... | |
|
inline |
Default constructor.
Definition at line 53 of file GenRunInfo.h.
|
inline |
add an attribute This will overwrite existing attribute if an attribute with the same name is present
Definition at line 94 of file GenRunInfo.h.
shared_ptr< T > attribute | ( | const string & | name | ) | const |
Get attribute of type T.
Definition at line 173 of file GenRunInfo.h.
string attribute_as_string | ( | const string & | name | ) | const |
Get attribute of any type as string.
Definition at line 37 of file GenRunInfo.cc.
References GenRunInfo::m_attributes, and GenRunInfo::m_lock_attributes.
std::vector<string> attribute_names | ( | ) | const |
Get list of attribute names.
|
inline |
Get a copy of the list of attributes.
Definition at line 118 of file GenRunInfo.h.
|
inline |
Check if a weight name is present.
Definition at line 69 of file GenRunInfo.h.
void read_data | ( | const GenRunInfoData & | data | ) |
Fill GenRunInfo based on GenRunInfoData.
Definition at line 74 of file GenRunInfo.cc.
References GenRunInfo::add_attribute(), GenRunInfoData::attribute_name, GenRunInfoData::attribute_string, GenRunInfo::ToolInfo::description, GenRunInfo::GenRunInfo(), GenRunInfo::m_lock_attributes, GenRunInfo::ToolInfo::name, GenRunInfo::set_weight_names(), GenRunInfoData::tool_description, GenRunInfoData::tool_name, GenRunInfoData::tool_version, GenRunInfo::tools(), GenRunInfo::ToolInfo::version, GenRunInfoData::weight_names, and GenRunInfo::write_data().
|
inline |
Remove attribute.
Definition at line 101 of file GenRunInfo.h.
void set_weight_names | ( | const std::vector< std::string > & | names | ) |
Set the names of the weights in this run.
For consistency, the length of the vector should be the same as the number of weights in the events in the run.
Definition at line 18 of file GenRunInfo.cc.
References GenRunInfo::has_weight(), GenRunInfo::m_weight_indices, and GenRunInfo::m_weight_names.
|
inline |
The vector of tools used to produce this run.
Definition at line 60 of file GenRunInfo.h.
|
inline |
The vector of tools used to produce this run.
Definition at line 64 of file GenRunInfo.h.
|
inline |
Return the index corresponding to a weight name.
Definition at line 75 of file GenRunInfo.h.
|
inline |
Get the vector of weight names.
Definition at line 81 of file GenRunInfo.h.
void write_data | ( | GenRunInfoData & | data | ) | const |
Fill GenRunInfoData object.
Definition at line 50 of file GenRunInfo.cc.
References GenRunInfoData::attribute_name, GenRunInfoData::attribute_string, GenRunInfo::m_attributes, GenRunInfoData::tool_description, GenRunInfoData::tool_name, GenRunInfoData::tool_version, GenRunInfo::tools(), GenRunInfoData::weight_names, and GenRunInfo::weight_names().
|
mutableprivate |
Map of attributes.
Definition at line 157 of file GenRunInfo.h.
|
mutableprivate |
Mutex lock for the m_attibutes map.
Definition at line 160 of file GenRunInfo.h.
|
private |
The vector of tools used to produce this run.
Definition at line 148 of file GenRunInfo.h.
|
private |
A map of weight names mapping to indices.
Definition at line 151 of file GenRunInfo.h.
|
private |
A vector of weight names.
Definition at line 154 of file GenRunInfo.h.