HepMC3 event record library
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
GenCrossSection Class Reference

Stores additional information about cross-section. More...

#include <GenCrossSection.h>

+ Inheritance diagram for GenCrossSection:
+ Collaboration diagram for GenCrossSection:

Public Member Functions

bool from_string (const std::string &att) override
 Implementation of Attribute::from_string. More...
 
bool to_string (std::string &att) const override
 Implementation of Attribute::to_string. More...
 
void set_cross_section (const double &xs, const double &xs_err, const long &n_acc=-1, const long &n_att=-1)
 Set all fields. More...
 
void set_accepted_events (const long &n_acc)
 Set the number of accepted events. More...
 
void set_attempted_events (const long &n_att)
 Set the number of attempted events. More...
 
long get_accepted_events () const
 Get the number of accepted events. More...
 
long get_attempted_events () const
 Get the number of attempted events. More...
 
void set_xsec (const std::string &wName, const double &xs)
 Set the cross section corresponding to the weight named wName. More...
 
void set_xsec (const int &indx, const double &xs)
 Set the cross section corresponding to the weight with index indx. More...
 
void set_xsec_err (const std::string &wName, const double &xs_err)
 Set the cross section error corresponding to the weight named wName. More...
 
void set_xsec_err (const int &indx, const double &xs_err)
 Set the cross section error corresponding to the weight with index indx. More...
 
double xsec (const std::string &wName) const
 Get the cross section corresponding to the weight named wName. More...
 
double xsec (const int &indx=0) const
 Get the cross section corresponding to the weight with index indx. More...
 
double xsec_err (const std::string &wName) const
 Get the cross section error corresponding to the weight named wName. More...
 
double xsec_err (const int &indx=0) const
 Get the cross section error corresponding to the weight with index indx. More...
 
bool operator== (const GenCrossSection &) const
 Operator ==. More...
 
bool operator!= (const GenCrossSection &) const
 Operator !=. More...
 
bool is_valid () const
 Verify that the instance contains non-zero information. More...
 
virtual bool init ()
 Optionally initialize the attribute after from_string. More...
 
virtual bool init (const GenRunInfo &)
 Optionally initialize the attribute after from_string. More...
 
bool is_parsed () const
 Check if this attribute is parsed. More...
 
const std::string & unparsed_string () const
 Get unparsed string. More...
 
const GenEventevent () const
 
GenParticlePtr particle ()
 
ConstGenParticlePtr particle () const
 
GenVertexPtr vertex ()
 
ConstGenVertexPtr vertex () const
 

Protected Member Functions

void set_is_parsed (bool flag)
 Set is_parsed flag. More...
 
void set_unparsed_string (const std::string &st)
 Set unparsed string. More...
 

Private Member Functions

int windx (std::string wName) const
 get the weight index given a weight name. More...
 

Private Attributes

long accepted_events
 The number of events generated so far. More...
 
long attempted_events
 The number of events attempted so far. More...
 
std::vector< double > cross_sections
 Per-weight cross-section. More...
 
std::vector< double > cross_section_errors
 Per-weight errors. More...
 

Detailed Description

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.

Examples:
basic_tree.cc, and HepMC3_fileIO_example.cc.

Definition at line 42 of file GenCrossSection.h.

Member Function Documentation

const GenEvent* event ( ) const
inlineinherited

return the GenEvent to which this Attribute belongs, if at all.

Definition at line 109 of file Attribute.h.

References Attribute::m_event.

bool from_string ( const std::string &  att)
overridevirtual
long get_accepted_events ( ) const
inline

Get the number of accepted events.

Definition at line 81 of file GenCrossSection.h.

long get_attempted_events ( ) const
inline

Get the number of attempted events.

Definition at line 87 of file GenCrossSection.h.

virtual bool init ( )
inlinevirtualinherited

Optionally initialize the attribute after from_string.

Reimplemented in HEPEUPAttribute.

Definition at line 82 of file Attribute.h.

virtual bool init ( const GenRunInfo )
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 91 of file Attribute.h.

bool is_parsed ( ) const
inlineinherited

Check if this attribute is parsed.

Definition at line 103 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.

GenParticlePtr particle ( )
inlineinherited

return the GenParticle to which this Attribute belongs, if at all.

Definition at line 114 of file Attribute.h.

References Attribute::m_particle.

ConstGenParticlePtr particle ( ) const
inlineinherited

return the GenParticle to which this Attribute belongs, if at all.

Definition at line 119 of file Attribute.h.

References Attribute::m_particle.

void set_accepted_events ( const long &  n_acc)
inline

Set the number of accepted events.

Definition at line 69 of file GenCrossSection.h.

void set_attempted_events ( const long &  n_att)
inline

Set the number of attempted events.

Definition at line 75 of file GenCrossSection.h.

void set_cross_section ( const double &  xs,
const double &  xs_err,
const long &  n_acc = -1,
const long &  n_att = -1 
)
void set_is_parsed ( bool  flag)
inlineprotectedinherited

Set is_parsed flag.

Definition at line 135 of file Attribute.h.

References Attribute::m_is_parsed.

void set_unparsed_string ( const std::string &  st)
inlineprotectedinherited

Set unparsed string.

Definition at line 138 of file Attribute.h.

References Attribute::m_string.

void set_xsec ( const std::string &  wName,
const double &  xs 
)
inline

Set the cross section corresponding to the weight named wName.

Definition at line 94 of file GenCrossSection.h.

void set_xsec ( const int &  indx,
const double &  xs 
)
inline

Set the cross section corresponding to the weight with index indx.

Definition at line 101 of file GenCrossSection.h.

void set_xsec_err ( const std::string &  wName,
const double &  xs_err 
)
inline

Set the cross section error corresponding to the weight named wName.

Definition at line 108 of file GenCrossSection.h.

void set_xsec_err ( const int &  indx,
const double &  xs_err 
)
inline

Set the cross section error corresponding to the weight with index indx.

Definition at line 115 of file GenCrossSection.h.

bool to_string ( std::string &  att) const
overridevirtual
const std::string& unparsed_string ( ) const
inlineinherited

Get unparsed string.

Definition at line 106 of file Attribute.h.

References Attribute::m_string.

GenVertexPtr vertex ( )
inlineinherited

return the GenVertex to which this Attribute belongs, if at all.

Definition at line 124 of file Attribute.h.

References Attribute::m_vertex.

ConstGenVertexPtr vertex ( ) const
inlineinherited

return the GenVertex to which this Attribute belongs, if at all.

Definition at line 129 of file Attribute.h.

References Attribute::m_vertex.

int windx ( std::string  wName) const
private

get the weight index given a weight name.

Definition at line 21 of file GenCrossSection.cc.

References Attribute::event(), and GenEvent::run_info().

double xsec ( const std::string &  wName) const
inline

Get the cross section corresponding to the weight named wName.

Definition at line 122 of file GenCrossSection.h.

double xsec ( const int &  indx = 0) const
inline

Get the cross section corresponding to the weight with index indx.

Definition at line 129 of file GenCrossSection.h.

double xsec_err ( const std::string &  wName) const
inline

Get the cross section error corresponding to the weight named wName.

Definition at line 136 of file GenCrossSection.h.

double xsec_err ( const int &  indx = 0) const
inline

Get the cross section error corresponding to the weight with index indx.

Definition at line 143 of file GenCrossSection.h.

Field Documentation

long accepted_events
private

The number of events generated so far.

Definition at line 49 of file GenCrossSection.h.

long attempted_events
private

The number of events attempted so far.

Definition at line 50 of file GenCrossSection.h.

std::vector<double> cross_section_errors
private

Per-weight errors.

Definition at line 53 of file GenCrossSection.h.

std::vector<double> cross_sections
private

Per-weight cross-section.

Definition at line 52 of file GenCrossSection.h.


The documentation for this class was generated from the following files: