HepMC3 event record library
Data Structures | Public Member Functions
GenRunInfo Class Reference

Stores run-related information. More...

#include <GenRunInfo.h>

+ Collaboration diagram for GenRunInfo:

Data Structures

struct  ToolInfo
 Interrnal struct for keeping track of tools. More...
 

Public Member Functions

 GenRunInfo ()
 Default constructor. More...
 
 GenRunInfo (const GenRunInfo &r)
 Copy constructor. More...
 
GenRunInfooperator= (const GenRunInfo &r)
 Assignmet. More...
 
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 std::string &name) const
 Check if a weight name is present. More...
 
int weight_index (const std::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 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 More...
 
void remove_attribute (const std::string &name)
 Remove attribute. More...
 
template<class T >
std::shared_ptr< T > attribute (const std::string &name) const
 Get attribute of type T. More...
 
std::string attribute_as_string (const std::string &name) const
 Get attribute of any type as string. More...
 
std::vector< std::string > attribute_names () const
 Get list of attribute names. More...
 
std::map< std::string,
std::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< ToolInfom_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,
std::shared_ptr< Attribute > > 
m_attributes
 Map of attributes. More...
 
std::recursive_mutex m_lock_attributes
 Mutex lock for the m_attibutes map. More...
 

Detailed Description

Stores run-related information.

Manages run-related information. Contains run-wide attributes

Examples:
class_example_write.cc.

Definition at line 33 of file GenRunInfo.h.

Constructor & Destructor Documentation

GenRunInfo ( )
inline

Default constructor.

Definition at line 54 of file GenRunInfo.h.

GenRunInfo ( const GenRunInfo r)

Copy constructor.

Definition at line 107 of file GenRunInfo.cc.

References GenRunInfo::m_lock_attributes, GenRunInfo::read_data(), and GenRunInfo::write_data().

Member Function Documentation

void add_attribute ( const std::string &  name,
const std::shared_ptr< Attribute > &  att 
)
inline

add an attribute This will overwrite existing attribute if an attribute with the same name is present

Definition at line 97 of file GenRunInfo.h.

std::shared_ptr< T > attribute ( const std::string &  name) const

Get attribute of type T.

Definition at line 176 of file GenRunInfo.h.

std::string attribute_as_string ( const std::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< std::string > attribute_names ( ) const

Get list of attribute names.

Definition at line 75 of file GenRunInfo.cc.

References GenRunInfo::m_attributes.

std::map< std::string, std::shared_ptr<Attribute> > attributes ( ) const
inline

Get a copy of the list of attributes.

Note
To avoid thread issues, this is returns a copy. Better solution may be needed.

Definition at line 121 of file GenRunInfo.h.

bool has_weight ( const std::string &  name) const
inline

Check if a weight name is present.

Definition at line 72 of file GenRunInfo.h.

GenRunInfo & operator= ( const GenRunInfo r)

Assignmet.

Definition at line 119 of file GenRunInfo.cc.

References GenRunInfo::m_lock_attributes, GenRunInfo::read_data(), and GenRunInfo::write_data().

void read_data ( const GenRunInfoData data)
void remove_attribute ( const std::string &  name)
inline

Remove attribute.

Definition at line 104 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.

const std::vector<ToolInfo>& tools ( ) const
inline

The vector of tools used to produce this run.

Definition at line 63 of file GenRunInfo.h.

std::vector<ToolInfo>& tools ( )
inline

The vector of tools used to produce this run.

Definition at line 67 of file GenRunInfo.h.

int weight_index ( const std::string &  name) const
inline

Return the index corresponding to a weight name.

Returns
-1 if name was not found

Definition at line 78 of file GenRunInfo.h.

const std::vector<std::string>& weight_names ( ) const
inline

Get the vector of weight names.

Definition at line 84 of file GenRunInfo.h.

void write_data ( GenRunInfoData data) const

Field Documentation

std::map< std::string, std::shared_ptr<Attribute> > m_attributes
mutableprivate

Map of attributes.

Definition at line 160 of file GenRunInfo.h.

std::recursive_mutex m_lock_attributes
mutableprivate

Mutex lock for the m_attibutes map.

Definition at line 163 of file GenRunInfo.h.

std::vector<ToolInfo> m_tools
private

The vector of tools used to produce this run.

Definition at line 151 of file GenRunInfo.h.

std::map<std::string, int> m_weight_indices
private

A map of weight names mapping to indices.

Definition at line 154 of file GenRunInfo.h.

std::vector<std::string> m_weight_names
private

A vector of weight names.

Definition at line 157 of file GenRunInfo.h.


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