HepMC3 event record library
|
Stores run-related information.
Manages run-related information. Contains run-wide attributes
Definition at line 33 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. | |
GenRunInfo (const GenRunInfo &r) | |
Copy constructor. | |
GenRunInfo & | operator= (const GenRunInfo &r) |
Assignmet. | |
const std::vector< ToolInfo > & | tools () const |
The vector of tools used to produce this run. | |
std::vector< ToolInfo > & | tools () |
The vector of tools used to produce this run. | |
bool | has_weight (const std::string &name) const |
Check if a weight name is present. | |
std::map< std::string, int > | weight_indices () const |
Returns a copy of indices map. | |
int | weight_index (const std::string &name) const |
Return the index corresponding to a weight name. | |
const std::vector< std::string > & | weight_names () const |
Get the vector of weight names. | |
void | set_weight_names (const std::vector< std::string > &names) |
Set the names of the weights in this run. | |
void | add_attribute (const std::string &name, const std::shared_ptr< Attribute > &att) |
add an attribute This will overwrite existing attribute if an attribute with the same name is present | |
void | remove_attribute (const std::string &name) |
Remove attribute. | |
template<class T > | |
std::shared_ptr< T > | attribute (const std::string &name) const |
Get attribute of type T. | |
std::string | attribute_as_string (const std::string &name) const |
Get attribute of any type as string. | |
std::vector< std::string > | attribute_names () const |
Get list of attribute names. | |
std::map< std::string, std::shared_ptr< Attribute > > | attributes () const |
Get a copy of the list of attributes. | |
Methods to fill GenRunInfoData and to read it back | |
void | write_data (GenRunInfoData &data) const |
Fill GenRunInfoData object. | |
void | read_data (const GenRunInfoData &data) |
Fill GenRunInfo based on GenRunInfoData. | |
Private Attributes | |
Fields | |
std::vector< ToolInfo > | m_tools |
The vector of tools used to produce this run. | |
std::map< std::string, int > | m_weight_indices |
A map of weight names mapping to indices. | |
std::vector< std::string > | m_weight_names |
A vector of weight names. | |
std::map< std::string, std::shared_ptr< Attribute > > | m_attributes |
Map of attributes. | |
std::recursive_mutex | m_lock_attributes |
Mutex lock for the m_attibutes map. | |
|
inline |
Default constructor.
Definition at line 54 of file GenRunInfo.h.
GenRunInfo | ( | const GenRunInfo & | r | ) |
Copy constructor.
Definition at line 104 of file GenRunInfo.cc.
References GenRunInfo::m_lock_attributes, GenRunInfo::read_data(), and GenRunInfo::write_data().
|
inline |
add an attribute This will overwrite existing attribute if an attribute with the same name is present
Definition at line 102 of file GenRunInfo.h.
References GenRunInfo::m_attributes, and GenRunInfo::m_lock_attributes.
std::shared_ptr< T > attribute | ( | const std::string & | name | ) | const |
Get attribute of type T.
Definition at line 181 of file GenRunInfo.h.
References GenRunInfo::m_attributes, and GenRunInfo::m_lock_attributes.
std::string attribute_as_string | ( | const std::string & | name | ) | const |
Get attribute of any type as string.
Definition at line 38 of file GenRunInfo.cc.
References GenRunInfo::m_attributes, and GenRunInfo::m_lock_attributes.
std::vector< std::string > attribute_names | ( | ) | const |
Get list of attribute names.
Definition at line 75 of file GenRunInfo.cc.
References GenRunInfo::m_attributes.
|
inline |
Get a copy of the list of attributes.
Definition at line 126 of file GenRunInfo.h.
References GenRunInfo::m_attributes.
|
inline |
Check if a weight name is present.
Definition at line 72 of file GenRunInfo.h.
References GenRunInfo::m_weight_indices.
GenRunInfo & operator= | ( | const GenRunInfo & | r | ) |
Assignmet.
Definition at line 116 of file GenRunInfo.cc.
References GenRunInfo::m_lock_attributes, GenRunInfo::read_data(), and GenRunInfo::write_data().
void read_data | ( | const GenRunInfoData & | data | ) |
Fill GenRunInfo based on GenRunInfoData.
Definition at line 83 of file GenRunInfo.cc.
References GenRunInfo::add_attribute(), GenRunInfoData::attribute_name, GenRunInfoData::attribute_string, GenRunInfo::ToolInfo::description, GenRunInfo::ToolInfo::name, GenRunInfo::set_weight_names(), GenRunInfoData::tool_description, GenRunInfoData::tool_name, GenRunInfoData::tool_version, GenRunInfo::tools(), GenRunInfo::ToolInfo::version, and GenRunInfoData::weight_names.
|
inline |
Remove attribute.
Definition at line 109 of file GenRunInfo.h.
References GenRunInfo::m_attributes, and GenRunInfo::m_lock_attributes.
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 19 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 67 of file GenRunInfo.h.
References GenRunInfo::m_tools.
|
inline |
The vector of tools used to produce this run.
Definition at line 63 of file GenRunInfo.h.
References GenRunInfo::m_tools.
|
inline |
Return the index corresponding to a weight name.
Definition at line 83 of file GenRunInfo.h.
References GenRunInfo::m_weight_indices.
|
inline |
Returns a copy of indices map.
Definition at line 77 of file GenRunInfo.h.
References GenRunInfo::m_weight_indices.
|
inline |
Get the vector of weight names.
Definition at line 89 of file GenRunInfo.h.
References GenRunInfo::m_weight_names.
void write_data | ( | GenRunInfoData & | data | ) | const |
Fill GenRunInfoData object.
Definition at line 51 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 165 of file GenRunInfo.h.
|
mutableprivate |
Mutex lock for the m_attibutes map.
Definition at line 168 of file GenRunInfo.h.
|
private |
The vector of tools used to produce this run.
Definition at line 156 of file GenRunInfo.h.
|
private |
A map of weight names mapping to indices.
Definition at line 159 of file GenRunInfo.h.
|
private |
A vector of weight names.
Definition at line 162 of file GenRunInfo.h.