HepMC event record
Data Structures | Public Member Functions
GenRunInfo Class Reference

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 build/outputs/include/HepMC/GenRunInfo.h.

#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...
 
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 (string name) const
 Check if a weight name is present. More...
 
int weight_index (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...
 
const std::map< std::string, shared_ptr< Attribute > > & attributes () const
 Get list of attributes. More...
 
 GenRunInfo ()
 Default constructor. 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 (string name) const
 Check if a weight name is present. More...
 
int weight_index (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...
 
const std::map< std::string, shared_ptr< Attribute > > & attributes () const
 Get 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...
 
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, shared_ptr< Attribute > > m_attributes
 Map of attributes. More...
 

Constructor & Destructor Documentation

◆ GenRunInfo() [1/2]

GenRunInfo ( )
inline

Default constructor.

Definition at line 54 of file build/outputs/include/HepMC/GenRunInfo.h.

◆ GenRunInfo() [2/2]

GenRunInfo ( )
inline

Default constructor.

Definition at line 54 of file include/HepMC/GenRunInfo.h.

Member Function Documentation

◆ add_attribute() [1/2]

void add_attribute ( const string &  name,
const 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 94 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ add_attribute() [2/2]

void add_attribute ( const string &  name,
const 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 94 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ attribute() [1/2]

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

Get attribute of type T.

Definition at line 163 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ attribute() [2/2]

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

Get attribute of type T.

◆ attribute_as_string() [1/2]

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.

◆ attribute_as_string() [2/2]

string attribute_as_string ( const string &  name) const

Get attribute of any type as string.

◆ attributes() [1/2]

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

Get list of attributes.

Definition at line 112 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ attributes() [2/2]

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

Get list of attributes.

Definition at line 112 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ has_weight() [1/2]

bool has_weight ( string  name) const
inline

Check if a weight name is present.

Definition at line 68 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_weight_indices.

◆ has_weight() [2/2]

bool has_weight ( string  name) const
inline

Check if a weight name is present.

Definition at line 68 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_weight_indices.

◆ read_data() [1/2]

void read_data ( const GenRunInfoData data)

◆ read_data() [2/2]

void read_data ( const GenRunInfoData data)

Fill GenRunInfo based on GenRunInfoData.

◆ remove_attribute() [1/2]

void remove_attribute ( const string &  name)
inline

Remove attribute.

Definition at line 100 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ remove_attribute() [2/2]

void remove_attribute ( const string &  name)
inline

Remove attribute.

Definition at line 100 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_attributes.

◆ set_weight_names() [1/2]

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.

◆ set_weight_names() [2/2]

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.

◆ tools() [1/4]

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

The vector of tools used to produce this run.

Definition at line 59 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_tools.

◆ tools() [2/4]

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

The vector of tools used to produce this run.

Definition at line 59 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_tools.

◆ tools() [3/4]

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

The vector of tools used to produce this run.

Definition at line 63 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_tools.

◆ tools() [4/4]

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

The vector of tools used to produce this run.

Definition at line 63 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_tools.

◆ weight_index() [1/2]

int weight_index ( string  name) const
inline

Return the index corresponding to a weight name.

Returns
-1 if name was not found
Todo:
Throw exception instead? Or return ssize_t for better signed/unsigned safety?

Definition at line 75 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_weight_indices.

◆ weight_index() [2/2]

int weight_index ( string  name) const
inline

Return the index corresponding to a weight name.

Returns
-1 if name was not found
Todo:
Throw exception instead? Or return ssize_t for better signed/unsigned safety?

Definition at line 75 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_weight_indices.

◆ weight_names() [1/2]

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

Get the vector of weight names.

Definition at line 81 of file include/HepMC/GenRunInfo.h.

References GenRunInfo::m_weight_names.

◆ weight_names() [2/2]

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

Get the vector of weight names.

Definition at line 81 of file build/outputs/include/HepMC/GenRunInfo.h.

References GenRunInfo::m_weight_names.

◆ write_data() [1/2]

void write_data ( GenRunInfoData data) const

◆ write_data() [2/2]

void write_data ( GenRunInfoData data) const

Fill GenRunInfoData object.

Field Documentation

◆ m_attributes

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

Map of attributes.

Definition at line 150 of file build/outputs/include/HepMC/GenRunInfo.h.

◆ m_tools

std::vector< ToolInfo > m_tools
private

The vector of tools used to produce this run.

Definition at line 141 of file build/outputs/include/HepMC/GenRunInfo.h.

◆ m_weight_indices

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

A map of weight names mapping to indices.

Definition at line 144 of file build/outputs/include/HepMC/GenRunInfo.h.

◆ m_weight_names

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

A vector of weight names.

Definition at line 147 of file build/outputs/include/HepMC/GenRunInfo.h.


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