HepMC3 event record library
Public Member Functions | Data Fields | Protected Attributes | Private Attributes
AnalysisExample Class Reference

Example analysis. Produces a rapidity distribution of final state particles. More...

#include <AnalysisExample.h>

+ Inheritance diagram for AnalysisExample:
+ Collaboration diagram for AnalysisExample:

Public Member Functions

 AnalysisExample (const std::string &filename, std::shared_ptr< GenRunInfo > run)
 Constructor. More...
 
 AnalysisExample (std::ostream &stream, std::shared_ptr< GenRunInfo > run)
 Constructor from ostream. More...
 
void write_event (const GenEvent &evt) override
 Write event to file. More...
 
bool failed () override
 Return status of the stream. More...
 
void close () override
 Close file stream. More...
 
 ~AnalysisExample ()
 destructor More...
 
void set_run_info (std::shared_ptr< GenRunInfo > run)
 Set the global GenRunInfo object. More...
 
std::shared_ptr< GenRunInforun_info () const
 Get the global GenRunInfo object. More...
 
void set_options (const std::map< std::string, std::string > &options)
 Set options. More...
 
std::map< std::string,
std::string > 
get_options () const
 Set options. More...
 

Data Fields

double m_sum_of_weights =0
 Sum of event weights. More...
 
double m_sum_of_weights2 =0
 Sum of event weights**2. More...
 
std::map< std::string,
std::vector< double > > 
m_bins
 Binings. More...
 
std::map< std::string,
std::vector< double > > 
m_vals
 Values. More...
 
std::map< std::string,
std::vector< double > > 
m_errs
 Uncertainties. More...
 

Protected Attributes

std::map< std::string,
std::string > 
m_options
 options More...
 

Private Attributes

std::ofstream m_file
 Output file. More...
 
std::ostream * m_stream
 Output stream. More...
 

Detailed Description

Example analysis. Produces a rapidity distribution of final state particles.

Definition at line 20 of file AnalysisExample.h.

Constructor & Destructor Documentation

AnalysisExample ( const std::string &  filename,
std::shared_ptr< GenRunInfo run 
)

Constructor.

Warning
If file already exists, it will be cleared before writing

Definition at line 8 of file AnalysisExample.cc.

References HEPMC3_ERROR.

AnalysisExample ( std::ostream &  stream,
std::shared_ptr< GenRunInfo run 
)
~AnalysisExample ( )
inline

destructor

Definition at line 39 of file AnalysisExample.h.

References AnalysisExample::close().

Member Function Documentation

void close ( )
overridevirtual
bool failed ( )
inlineoverridevirtual

Return status of the stream.

Implements Writer.

Definition at line 33 of file AnalysisExample.h.

References AnalysisExample::m_file.

std::map<std::string, std::string> get_options ( ) const
inlineinherited

Set options.

Definition at line 61 of file Writer.h.

References Writer::m_options.

std::shared_ptr<GenRunInfo> run_info ( ) const
inlineinherited

Get the global GenRunInfo object.

Definition at line 47 of file Writer.h.

References Writer::m_run_info.

void set_options ( const std::map< std::string, std::string > &  options)
inlineinherited

Set options.

Definition at line 56 of file Writer.h.

References Writer::m_options.

void set_run_info ( std::shared_ptr< GenRunInfo run)
inlineinherited

Set the global GenRunInfo object.

Definition at line 42 of file Writer.h.

References Writer::m_run_info.

void write_event ( const GenEvent evt)
overridevirtual

Write event to file.

Parameters
[in]evtEvent 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().

Field Documentation

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.

std::ofstream m_file
private

Output file.

Definition at line 47 of file AnalysisExample.h.

std::map<std::string, std::string> m_options
protectedinherited

options

Definition at line 68 of file Writer.h.

std::ostream* m_stream
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.


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