HepMC3 event record library
|
Example analysis. Produces a rapidity distribution of final state particles.
Definition at line 20 of file AnalysisExample.h.
#include <AnalysisExample.h>
Public Member Functions | |
AnalysisExample (const std::string &filename, std::shared_ptr< GenRunInfo > run) | |
Constructor. | |
AnalysisExample (std::ostream &stream, std::shared_ptr< GenRunInfo > run) | |
Constructor from ostream. | |
void | write_event (const GenEvent &evt) override |
Write event to file. | |
bool | failed () override |
Return status of the stream. | |
void | close () override |
Close file stream. | |
~AnalysisExample () | |
destructor | |
void | set_run_info (std::shared_ptr< GenRunInfo > run) |
Set the global GenRunInfo object. | |
std::shared_ptr< GenRunInfo > | run_info () const |
Get the global GenRunInfo object. | |
void | set_options (const std::map< std::string, std::string > &options) |
Set options. | |
std::map< std::string, std::string > | get_options () const |
Set options. | |
Data Fields | |
double | m_sum_of_weights =0 |
Sum of event weights. | |
double | m_sum_of_weights2 =0 |
Sum of event weights**2. | |
std::map< std::string, std::vector< double > > | m_bins |
Binings. | |
std::map< std::string, std::vector< double > > | m_vals |
Values. | |
std::map< std::string, std::vector< double > > | m_errs |
Uncertainties. | |
Protected Attributes | |
std::map< std::string, std::string > | m_options |
options | |
Private Attributes | |
std::ofstream | m_file |
Output file. | |
std::ostream * | m_stream |
Output stream. | |
std::shared_ptr< GenRunInfo > | m_run_info |
The global GenRunInfo object. | |
AnalysisExample | ( | const std::string & | filename, |
std::shared_ptr< GenRunInfo > | run | ||
) |
Constructor.
Definition at line 8 of file AnalysisExample.cc.
References HEPMC3_ERROR.
AnalysisExample | ( | std::ostream & | stream, |
std::shared_ptr< GenRunInfo > | run | ||
) |
Constructor from ostream.
Definition at line 21 of file AnalysisExample.cc.
References AnalysisExample::m_bins, AnalysisExample::m_errs, AnalysisExample::m_sum_of_weights, AnalysisExample::m_sum_of_weights2, and AnalysisExample::m_vals.
|
inline |
|
overridevirtual |
Close file stream.
Implements Writer.
Definition at line 49 of file AnalysisExample.cc.
References AnalysisExample::m_bins, AnalysisExample::m_errs, AnalysisExample::m_stream, AnalysisExample::m_sum_of_weights, and AnalysisExample::m_vals.
|
inlineoverridevirtual |
Return status of the stream.
Implements Writer.
Definition at line 33 of file AnalysisExample.h.
References AnalysisExample::m_file.
|
inlineinherited |
|
inlineinherited |
Get the global GenRunInfo object.
Definition at line 47 of file Writer.h.
References Writer::m_run_info.
|
inlineinherited |
|
inlineinherited |
Set the global GenRunInfo object.
Definition at line 42 of file Writer.h.
References Writer::m_run_info.
|
overridevirtual |
Write event to file.
[in] | evt | Event to be serialized |
Implements Writer.
Definition at line 33 of file AnalysisExample.cc.
References AnalysisExample::m_bins, AnalysisExample::m_errs, AnalysisExample::m_sum_of_weights, AnalysisExample::m_sum_of_weights2, AnalysisExample::m_vals, GenEvent::particles(), and GenEvent::weight().
std::map<std::string, std::vector<double> > m_bins |
Binings.
Definition at line 43 of file AnalysisExample.h.
std::map<std::string, std::vector<double> > m_errs |
Uncertainties.
Definition at line 45 of file AnalysisExample.h.
|
private |
Output file.
Definition at line 47 of file AnalysisExample.h.
|
protectedinherited |
|
privateinherited |
The global GenRunInfo object.
|
private |
Output stream.
Definition at line 48 of file AnalysisExample.h.
double m_sum_of_weights =0 |
Sum of event weights.
Definition at line 41 of file AnalysisExample.h.
double m_sum_of_weights2 =0 |
Sum of event weights**2.
Definition at line 42 of file AnalysisExample.h.
std::map<std::string, std::vector<double> > m_vals |
Values.
Definition at line 44 of file AnalysisExample.h.