10 #ifndef HEPMC3_GENRUNINFO_H
11 #define HEPMC3_GENRUNINFO_H
13 #if !defined(__CINT__)
26 struct GenRunInfoData;
59 #if !defined(__CINT__)
62 const std::vector<ToolInfo> &
tools()
const {
66 std::vector<ToolInfo> &
tools() {
72 return m_weight_indices.find(name) != m_weight_indices.end();
78 std::map<std::string, int>::const_iterator it = m_weight_indices.find(name);
79 return it == m_weight_indices.end()? -1: it->second;
84 return m_weight_names;
91 void set_weight_names(
const std::vector<std::string> & names);
97 const shared_ptr<Attribute> &att) {
98 std::lock_guard<std::recursive_mutex> lock(m_lock_attributes);
99 if ( att ) m_attributes[name] = att;
104 std::lock_guard<std::recursive_mutex> lock(m_lock_attributes);
105 m_attributes.erase(name);
110 shared_ptr<T> attribute(
const string &name)
const;
113 string attribute_as_string(
const string &name)
const;
116 std::vector<string> attribute_names()
const;
120 std::map< std::string, shared_ptr<Attribute> >
attributes()
const {
138 void Streamer(TBuffer &b);
147 #if !defined(__CINT__)
168 #if !defined(__CINT__)
176 std::lock_guard<std::recursive_mutex> lock(m_lock_attributes);
177 std::map< std::string, shared_ptr<Attribute> >::iterator i =
178 m_attributes.find(name);
179 if( i == m_attributes.end() )
return shared_ptr<T>();
181 if( !i->second->is_parsed() ) {
183 shared_ptr<T> att = make_shared<T>();
184 if ( att->from_string(i->second->unparsed_string()) &&
192 return shared_ptr<T>();
194 else return dynamic_pointer_cast<T>(i->second);
GenRunInfo()
Default constructor.
std::recursive_mutex m_lock_attributes
Mutex lock for the m_attibutes map.
std::vector< std::string > m_weight_names
A vector of weight names.
bool has_weight(const string &name) const
Check if a weight name is present.
Stores run-related information.
const std::vector< std::string > & weight_names() const
Get the vector of weight names.
const std::vector< ToolInfo > & tools() const
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.
Stores serializable run information.
Definition of class Units.
std::map< std::string, shared_ptr< Attribute > > attributes() const
Get a copy of the list of attributes.
shared_ptr< T > attribute(const string &name) const
Get attribute of type T.
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...
Definition of class Attribute, class IntAttribute and class StringAttribute.
void remove_attribute(const string &name)
Remove attribute.
std::map< std::string, shared_ptr< Attribute > > m_attributes
Map of attributes.
int weight_index(const string &name) const
Return the index corresponding to a weight name.
std::vector< ToolInfo > m_tools
The vector of tools used to produce this run.
std::vector< ToolInfo > & tools()
The vector of tools used to produce this run.