11 #include "HepMC/GenRunInfo.h" 12 #include "HepMC/Data/GenRunInfoData.h" 21 for (
int i = 0, N = names.size(); i < N; ++i ) {
22 string name = names[i];
24 std::ostringstream oss;
30 throw std::logic_error(
"GenRunInfo::set_weight_names: " 31 "Duplicate weight name '" + name +
39 std::map< std::string, shared_ptr<Attribute> >::iterator i =
m_attributes.find(name);
42 if( !i->second )
return string();
45 i->second->to_string(ret);
56 typedef std::map<std::string, shared_ptr<Attribute> >::value_type att_val_t;
58 FOREACH(
const att_val_t& vt, this->
attributes() ) {
60 vt.second->to_string(att);
88 for(
unsigned int i=0; i<data.
tool_name.size(); ++i) {
94 this->
tools().push_back(ti);
void read_data(const GenRunInfoData &data)
Fill GenRunInfo based on GenRunInfoData.
const std::vector< ToolInfo > & tools() const
The vector of tools used to produce this run.
Stores serializable run information.
const std::map< std::string, shared_ptr< Attribute > > & attributes() const
Get list of attributes.
std::map< std::string, shared_ptr< Attribute > > m_attributes
Map of attributes.
std::vector< std::string > attribute_string
Attribute serialized as string.
std::vector< std::string > tool_description
Tool descriptions.
std::vector< std::string > m_weight_names
A vector of weight names.
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...
const std::vector< std::string > & weight_names() const
Get the vector of weight names.
bool has_weight(string name) const
Check if a weight name is present.
void write_data(GenRunInfoData &data) const
Fill GenRunInfoData object.
std::vector< std::string > weight_names
Weight names.
std::map< std::string, int > m_weight_indices
A map of weight names mapping to indices.
Definition of template class SmartPointer.
string attribute_as_string(const string &name) const
Get attribute of any type as string.
std::vector< std::string > tool_name
Tool names.
std::vector< std::string > tool_version
Tool versions.
std::vector< std::string > attribute_name
Attribute name.
void set_weight_names(const std::vector< std::string > &names)
Set the names of the weights in this run.