24    if ( !
event() || !
event()->run_info() ) {
return 0;}
 
 
   28void GenCrossSection::set_cross_section(
const double& xs, 
const double& xs_err, 
const long& n_acc, 
const long& n_att) {
 
   29    double cross_section       = xs;
 
   30    double cross_section_error = xs_err;
 
   33    size_t N = std::max( 
event() ? 
event()->weights().size() : 0, 
size_t{1});
 
   39void GenCrossSection::set_cross_section(
const std::vector<double>& xs, 
const std::vector<double>& xs_err, 
const long& n_acc, 
const long& n_att) {
 
 
   48    const char *cursor = att.data();
 
   53    double cross_section = atof(cursor);
 
   56    if ( !(cursor = strchr(cursor+1, 
' ')) ) {
return false;}
 
   57    double cross_section_error = atof(cursor);
 
   67    size_t N = 
event() ? std::max(
event()->weights().size(), 
size_t{1}) : 
size_t{1};
 
   68    const size_t max_n_cross_sections = 1000;
 
   70        if ( !(cursor = strchr(cursor+1, 
' ')) ) 
break;
 
   72        if ( !(cursor = strchr(cursor+1, 
' ')) ) 
break;
 
   76        HEPMC3_WARNING(
"GenCrossSection::from_string: too many optional cross-sections  N=" << 
cross_sections.size() << 
" or ill-formed input:" << att)
 
   81        HEPMC3_WARNING(
"GenCrossSection::from_string: the number of cross-sections cross_sections.size()=" << 
cross_sections.size() << 
" does not match the number of weights" << 
event()->weights().size())
 
 
   88    std::ostringstream os;
 
   90    os << std::setprecision(8) << std::scientific
 
   96        HEPMC3_WARNING(
"GenCrossSection::to_string: the number of cross-sections cross_sections.size()=" << 
cross_sections.size() << 
" does not match the number of weights" << 
event()->weights().size())
 
 
  108    return ( memcmp( (
void*)
this, (
void*) &a, 
sizeof(
class GenCrossSection) ) == 0 );
 
 
  112    return !( a == *this );
 
 
#define HEPMC3_WARNING(MESSAGE)
Macro for printing HEPMC3_HEPMC3_WARNING messages.
Definition of attribute class GenCrossSection.
Definition of class GenEvent.
const GenEvent * event() const
Stores additional information about cross-section.
long attempted_events
The number of events attempted so far.
std::vector< double > cross_section_errors
Per-weight errors.
std::vector< double > cross_sections
Per-weight cross-section.
bool is_valid() const
Verify that the instance contains non-zero information.
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
bool operator==(const GenCrossSection &) const
Operator ==.
bool operator!=(const GenCrossSection &) const
Operator !=.
int windx(const std::string &wName) const
get the weight index given a weight name.
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
long accepted_events
The number of events generated so far.
std::shared_ptr< GenRunInfo > run_info() const
Get a pointer to the the GenRunInfo object.