10#ifndef HEPMC3_GENRUNINFO_H
11#define HEPMC3_GENRUNINFO_H
63 const std::vector<ToolInfo> &
tools()
const {
67 std::vector<ToolInfo> &
tools() {
103 const std::shared_ptr<Attribute> &att) {
116 std::shared_ptr<T>
attribute(
const std::string &name)
const;
126 std::map< std::string, std::shared_ptr<Attribute> >
attributes()
const {
144 void Streamer(TBuffer &b);
153#if !defined(__CINT__)
165 mutable std::map< std::string, std::shared_ptr<Attribute> >
m_attributes;
174#if !defined(__CINT__)
183 std::map< std::string, std::shared_ptr<Attribute> >::iterator i =
185 if ( i ==
m_attributes.end() )
return std::shared_ptr<T>();
187 if ( !i->second->is_parsed() ) {
189 std::shared_ptr<T> att = std::make_shared<T>();
190 if ( att->from_string(i->second->unparsed_string()) &&
198 return std::shared_ptr<T>();
200 else return std::dynamic_pointer_cast<T>(i->second);
205template<typename T> std::map<std::string, T> weight_indices() const {
206 std::map<std::string, T> ret;
207 ret.insert(m_weight_indices.begin(),m_weight_indices.end());
Definition of class Attribute, class IntAttribute and class StringAttribute.
Definition of class Units.
Stores run-related information.
std::recursive_mutex m_lock_attributes
Mutex lock for the m_attibutes map.
GenRunInfo & operator=(const GenRunInfo &r)
Assignmet.
std::shared_ptr< T > attribute(const std::string &name) const
Get attribute of type T.
std::map< std::string, int > m_weight_indices
A map of weight names mapping to indices.
std::vector< ToolInfo > m_tools
The vector of tools used to produce this run.
std::map< std::string, int > weight_indices() const
Returns a copy of indices map.
std::map< std::string, std::shared_ptr< Attribute > > attributes() const
Get a copy of the list of attributes.
void remove_attribute(const std::string &name)
Remove attribute.
std::map< std::string, std::shared_ptr< Attribute > > m_attributes
Map of attributes.
std::vector< ToolInfo > & tools()
The vector of tools used to produce this run.
std::vector< std::string > attribute_names() const
Get list of attribute names.
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
bool has_weight(const std::string &name) const
Check if a weight name is present.
std::vector< std::string > m_weight_names
A vector of weight names.
void read_data(const GenRunInfoData &data)
Fill GenRunInfo based on GenRunInfoData.
GenRunInfo()
Default constructor.
const std::vector< std::string > & weight_names() const
Get the vector of weight names.
void write_data(GenRunInfoData &data) const
Fill GenRunInfoData object.
int weight_index(const std::string &name) const
Return the index corresponding to a weight name.
const std::vector< ToolInfo > & tools() const
The vector of tools used to produce this run.
void set_weight_names(const std::vector< std::string > &names)
Set the names of the weights in this run.
std::string attribute_as_string(const std::string &name) const
Get attribute of any type as string.
Stores serializable run information.