HepMC3 event record library
|
Stores additional information about cross-section.
This is an example of event attribute used to store cross-section information
This class is meant to be used to pass, on an event by event basis, the current best guess of the total cross section. It is expected that the final cross section will be stored elsewhere.
In addition, several cross sections and related info can be included in case of runs with mulltiple weights.
The units of cross_section and cross_section_error are expected to be pb.
Definition at line 42 of file GenCrossSection.h.
#include <GenCrossSection.h>
Public Member Functions | |
bool | from_string (const std::string &att) override |
Implementation of Attribute::from_string. | |
bool | to_string (std::string &att) const override |
Implementation of Attribute::to_string. | |
void | set_cross_section (const double &xs, const double &xs_err, const long &n_acc=-1, const long &n_att=-1) |
Set all fields. | |
void | set_accepted_events (const long &n_acc) |
Set the number of accepted events. | |
void | set_attempted_events (const long &n_att) |
Set the number of attempted events. | |
long | get_accepted_events () const |
Get the number of accepted events. | |
long | get_attempted_events () const |
Get the number of attempted events. | |
void | set_xsec (const std::string &wName, const double &xs) |
Set the cross section corresponding to the weight named wName. | |
void | set_xsec (const int &indx, const double &xs) |
Set the cross section corresponding to the weight with index indx. | |
void | set_xsec_err (const std::string &wName, const double &xs_err) |
Set the cross section error corresponding to the weight named wName. | |
void | set_xsec_err (const int &indx, const double &xs_err) |
Set the cross section error corresponding to the weight with index indx. | |
double | xsec (const std::string &wName) const |
Get the cross section corresponding to the weight named wName. | |
double | xsec (const int &indx=0) const |
Get the cross section corresponding to the weight with index indx. | |
double | xsec_err (const std::string &wName) const |
Get the cross section error corresponding to the weight named wName. | |
double | xsec_err (const int &indx=0) const |
Get the cross section error corresponding to the weight with index indx. | |
bool | operator== (const GenCrossSection &) const |
Operator ==. | |
bool | operator!= (const GenCrossSection &) const |
Operator !=. | |
bool | is_valid () const |
Verify that the instance contains non-zero information. | |
virtual bool | init () |
Optionally initialize the attribute after from_string. | |
virtual bool | init (const GenRunInfo &) |
Optionally initialize the attribute after from_string. | |
bool | is_parsed () const |
Check if this attribute is parsed. | |
const std::string & | unparsed_string () const |
Get unparsed string. | |
const GenEvent * | event () const |
GenParticlePtr | particle () |
ConstGenParticlePtr | particle () const |
GenVertexPtr | vertex () |
ConstGenVertexPtr | vertex () const |
Protected Member Functions | |
void | set_is_parsed (bool flag) |
Set is_parsed flag. | |
void | set_unparsed_string (const std::string &st) |
Set unparsed string. | |
Private Member Functions | |
int | windx (std::string wName) const |
get the weight index given a weight name. | |
Private Attributes | |
long | accepted_events |
The number of events generated so far. | |
long | attempted_events |
The number of events attempted so far. | |
std::vector< double > | cross_sections |
Per-weight cross-section. | |
std::vector< double > | cross_section_errors |
Per-weight errors. | |
bool | m_is_parsed |
Is this attribute parsed? | |
std::string | m_string |
Raw (unparsed) string. | |
const GenEvent * | m_event |
GenParticlePtr | m_particle |
controlling GenEvent object. | |
GenVertexPtr | m_vertex |
Vertex to which assigned. | |
|
inlineinherited |
return the GenEvent to which this Attribute belongs, if at all.
Definition at line 108 of file Attribute.h.
References Attribute::m_event.
|
overridevirtual |
Implementation of Attribute::from_string.
Implements Attribute.
Definition at line 39 of file GenCrossSection.cc.
References GenCrossSection::accepted_events, GenCrossSection::attempted_events, GenCrossSection::cross_section_errors, GenCrossSection::cross_sections, Attribute::event(), and HEPMC3_WARNING.
|
inline |
Get the number of accepted events.
Definition at line 81 of file GenCrossSection.h.
References GenCrossSection::accepted_events.
|
inline |
Get the number of attempted events.
Definition at line 87 of file GenCrossSection.h.
References GenCrossSection::attempted_events.
|
inlinevirtualinherited |
Optionally initialize the attribute after from_string.
Reimplemented in HEPEUPAttribute.
Definition at line 81 of file Attribute.h.
|
inlinevirtualinherited |
Optionally initialize the attribute after from_string.
Is passed a reference to the GenRunInfo object to which the Attribute belongs.
Reimplemented in HEPEUPAttribute.
Definition at line 90 of file Attribute.h.
|
inlineinherited |
Check if this attribute is parsed.
Definition at line 102 of file Attribute.h.
References Attribute::m_is_parsed.
bool is_valid | ( | ) | const |
Verify that the instance contains non-zero information.
Definition at line 104 of file GenCrossSection.cc.
References GenCrossSection::cross_section_errors, and GenCrossSection::cross_sections.
bool operator!= | ( | const GenCrossSection & | a | ) | const |
Operator !=.
Definition at line 100 of file GenCrossSection.cc.
bool operator== | ( | const GenCrossSection & | a | ) | const |
Operator ==.
Definition at line 96 of file GenCrossSection.cc.
|
inlineinherited |
return the GenParticle to which this Attribute belongs, if at all.
Definition at line 113 of file Attribute.h.
References Attribute::m_particle.
|
inlineinherited |
return the GenParticle to which this Attribute belongs, if at all.
Definition at line 118 of file Attribute.h.
References Attribute::m_particle.
|
inline |
Set the number of accepted events.
Definition at line 69 of file GenCrossSection.h.
References GenCrossSection::accepted_events.
|
inline |
Set the number of attempted events.
Definition at line 75 of file GenCrossSection.h.
References GenCrossSection::attempted_events.
void set_cross_section | ( | const double & | xs, |
const double & | xs_err, | ||
const long & | n_acc = -1 , |
||
const long & | n_att = -1 |
||
) |
Set all fields.
Definition at line 27 of file GenCrossSection.cc.
References GenCrossSection::accepted_events, GenCrossSection::attempted_events, GenCrossSection::cross_section_errors, GenCrossSection::cross_sections, and Attribute::event().
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inline |
Set the cross section corresponding to the weight with index indx.
Definition at line 101 of file GenCrossSection.h.
References GenCrossSection::cross_sections.
|
inline |
Set the cross section corresponding to the weight named wName.
Definition at line 94 of file GenCrossSection.h.
References GenCrossSection::set_xsec(), and GenCrossSection::windx().
|
inline |
Set the cross section error corresponding to the weight with index indx.
Definition at line 115 of file GenCrossSection.h.
References GenCrossSection::cross_section_errors.
|
inline |
Set the cross section error corresponding to the weight named wName.
Definition at line 108 of file GenCrossSection.h.
References GenCrossSection::set_xsec_err(), and GenCrossSection::windx().
|
overridevirtual |
Implementation of Attribute::to_string.
Implements Attribute.
Definition at line 78 of file GenCrossSection.cc.
References GenCrossSection::accepted_events, GenCrossSection::attempted_events, GenCrossSection::cross_section_errors, and GenCrossSection::cross_sections.
|
inlineinherited |
|
inlineinherited |
return the GenVertex to which this Attribute belongs, if at all.
Definition at line 123 of file Attribute.h.
References Attribute::m_vertex.
|
inlineinherited |
return the GenVertex to which this Attribute belongs, if at all.
Definition at line 128 of file Attribute.h.
References Attribute::m_vertex.
|
private |
get the weight index given a weight name.
Definition at line 22 of file GenCrossSection.cc.
References Attribute::event(), and GenEvent::run_info().
|
inline |
Get the cross section corresponding to the weight with index indx.
Definition at line 129 of file GenCrossSection.h.
References GenCrossSection::cross_sections.
|
inline |
Get the cross section corresponding to the weight named wName.
Definition at line 122 of file GenCrossSection.h.
References GenCrossSection::windx(), and GenCrossSection::xsec().
|
inline |
Get the cross section error corresponding to the weight with index indx.
Definition at line 143 of file GenCrossSection.h.
References GenCrossSection::cross_section_errors.
|
inline |
Get the cross section error corresponding to the weight named wName.
Definition at line 136 of file GenCrossSection.h.
References GenCrossSection::windx(), and GenCrossSection::xsec_err().
|
private |
The number of events generated so far.
Definition at line 49 of file GenCrossSection.h.
|
private |
The number of events attempted so far.
Definition at line 50 of file GenCrossSection.h.
|
private |
Per-weight errors.
Definition at line 53 of file GenCrossSection.h.
|
private |
Per-weight cross-section.
Definition at line 52 of file GenCrossSection.h.
|
privateinherited |
Possibility to be aware of the
Definition at line 145 of file Attribute.h.
|
privateinherited |
Is this attribute parsed?
Definition at line 143 of file Attribute.h.
|
privateinherited |
controlling GenEvent object.
Particle to which assigned.
Definition at line 147 of file Attribute.h.
|
privateinherited |
Raw (unparsed) string.
Definition at line 144 of file Attribute.h.
|
privateinherited |
Vertex to which assigned.
Definition at line 148 of file Attribute.h.