2 #ifndef HEPMC_WEIGHT_CONTAINER_H
3 #define HEPMC_WEIGHT_CONTAINER_H
36 typedef std::vector<double>::iterator
iterator;
56 void print( std::ostream& ostr = std::cout )
const;
58 void write( std::ostream& ostr = std::cout )
const;
72 bool has_key(
const std::string& s )
const;
81 const double&
operator[](
const std::string& s )
const;
91 const double&
front()
const;
95 const double&
back()
const;
111 typedef std::map<std::string,size_type>::iterator map_iterator;
114 typedef std::map<std::string,size_type>::const_iterator const_map_iterator;
117 map_iterator map_begin();
120 map_iterator map_end();
123 const_map_iterator map_begin()
const;
126 const_map_iterator map_end()
const;
133 std::vector<double> m_weights;
134 std::map<std::string,size_type> m_names;
142 : m_weights(in.m_weights), m_names(in.m_names)
145 inline WeightContainer::~WeightContainer() {}
149 m_weights.swap( other.m_weights );
150 m_names.swap( other.m_names );
162 (
const std::vector<double>& in ) {
180 {
return m_weights[n]; }
183 {
return m_weights[n]; }
188 {
return m_weights.front(); }
193 {
return m_weights.back(); }
196 {
return m_weights.begin(); }
199 {
return m_weights.end(); }
202 {
return m_weights.begin(); }
205 {
return m_weights.end(); }
207 inline WeightContainer::map_iterator WeightContainer::map_begin()
208 {
return m_names.begin(); }
210 inline WeightContainer::map_iterator WeightContainer::map_end()
211 {
return m_names.end(); }
213 inline WeightContainer::const_map_iterator WeightContainer::map_begin()
const
214 {
return m_names.begin(); }
216 inline WeightContainer::const_map_iterator WeightContainer::map_end()
const
217 {
return m_names.end(); }
221 #endif // HEPMC_WEIGHT_CONTAINER_H
void print(std::ostream &ostr=std::cout) const
print weights
WeightContainer & operator=(const WeightContainer &)
copy assignment
double & operator[](size_type n)
access the weight container
bool operator!=(const WeightContainer &) const
inequality
std::vector< double >::const_iterator const_iterator
const iterator for the weight container
void pop_back()
pop from weight container
The GenEvent class is the core of HepMC.
void push_back(const double &)
push onto weight container
iterator begin()
begining of the weight container
bool has_key(const std::string &s) const
check to see if a name exists in the map
bool empty() const
return true if weight container is empty
double & front()
returns the first element
void write(std::ostream &ostr=std::cout) const
write weights in a readable table
WeightContainer(size_type n=0, double value=0.)
default constructor
std::size_t size_type
defining the size type used by vector and map
iterator end()
end of the weight container
std::vector< double >::iterator iterator
iterator for the weight container
Container for the Weights associated with an event or vertex.
void swap(WeightContainer &other)
swap
double & back()
returns the last element
bool operator==(const WeightContainer &) const
equality
size_type size() const
size of weight container
void clear()
clear the weight container