22 if ( !
event() || !
event()->run_info() )
return 0;
27 double cross_section = xs;
28 double cross_section_error = xs_err;
32 if (
event() ) N=std::max(
event()->weights().size(),N);
39 const char *cursor = att.data();
44 double cross_section = atof(cursor);
47 if( !(cursor = strchr(cursor+1,
' ')) )
return false;
48 double cross_section_error = atof(cursor);
59 if (
event() ) N=std::max(
event()->weights().size(),N);
60 const size_t max_n_cross_sections=1000;
62 if( !(cursor = strchr(cursor+1,
' ')) )
break;
64 if( !(cursor = strchr(cursor+1,
' ')) )
break;
68 HEPMC3_WARNING(
"GenCrossSection::from_string: too many optional cross-sections N="<<
cross_sections.size()<<
" or ill-formed input:"<<att )
79 std::ostringstream os;
81 os << std::setprecision(8) << std::scientific
97 return ( memcmp( (
void*)
this, (
void*) &a,
sizeof(
class GenCrossSection) ) == 0 );
101 return !( a == *this );
bool is_valid() const
Verify that the instance contains non-zero information.
int windx(std::string wName) const
get the weight index given a weight name.
#define HEPMC3_WARNING(MESSAGE)
Macro for printing HEPMC3_HEPMC3_WARNING messages.
std::vector< double > cross_section_errors
Per-weight errors.
void set_cross_section(const double &xs, const double &xs_err, const long &n_acc=-1, const long &n_att=-1)
Set all fields.
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
const GenEvent * event() const
long attempted_events
The number of events attempted so far.
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 ==.
std::vector< double > cross_sections
Per-weight cross-section.
Definition of class GenEvent.
Definition of attribute class GenCrossSection.
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.
Stores additional information about cross-section.