13 #include "HepMC/WeightContainer.h"
23 assert( w[0] == 2.0 );
24 assert( w[1] == 4.56 );
25 assert( w.
size() == 2 );
28 std::vector<double> vec;
29 for(
int i = 0; i < 15; ++i ) {
30 double x = (double)i + 0.14*(
double)i;
35 assert( w.
size() == 15 );
37 assert( w.
size() == 14 );
40 std::size_t vs = vec.size();
41 std::string nm =
"tau";
43 assert( w.
size() == (vs) );
44 w[
"my_pdf"] = 11.3445;
46 assert( w[nm] == 3.1 );
48 assert( w.
size() == (vs+1) );
49 assert( w[vs-1] == 3.1 );
52 assert( wc[nm] == 3.1 );
56 std::cout <<
"lookup of nonexistent name returns " << x << std::endl;
58 catch (std::exception& e) {
59 std::cout << e.what() << std::endl;
60 std::cout <<
"HepMC testWeights: the above error is intentional" << std::endl;
65 std::cout <<
"lookup of nonexistent name returns " << x << std::endl;
void pop_back()
pop from weight container
void push_back(const double &)
push onto 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
void write(std::ostream &ostr=std::cout) const
write weights in a readable table
Container for the Weights associated with an event or vertex.
size_type size() const
size of weight container