Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

rootEnergyHist Class Reference

This class stores and graphs the flux vs. energy. More...

#include <rootEnergyHist.h>

List of all members.

Public Methods

 rootEnergyHist (int bins, double min_energy, double max_energy)
 Constructor creates an empty energy histogram. More...

 ~rootEnergyHist (void)
 rootEnergyHist (const rootEnergyHist& oldHist)
void setTitle (std::string title)
 Sets the title for the graph. More...

void setXLabel (std::string label)
 Sets the x-axis label on the flux vs. energy graph. More...

void setYLabel (std::string label)
 Sets the y-axis label on the flux vs. energy graph. More...

void setGraphType (const char *graph_type)
 Sets the type of scaling used on the graph Valid values are "linear", "semilogx", "semilogy", and "log". More...

void store (double energy)
 Increments the temporary bin (by +1) corresponding to the given energy. More...

double retrieveCount (int binNumber)
 Retrieves the raw count associated with the given bin number. More...

double retrieveFlux (int binNumber)
 Retrieves the flux associated with the given bin number. More...

double retrieveFluxUncertainty (int binNumber)
 Retrieves the flux uncertainty associated with the given bin number. More...

double retrieveEnergy (int binNumber)
 Retrieves the energy associated with the given bin number. More...

double retrieveRange (void)
 Retrieves the logorithmic (base 10) energy range for the histogram. More...

void setFluxMode (void)
 This function changes the graph type from E*flux vs. E to flux vs. E. More...

void setFluxMin (double f)
 This function manually sets the minimum flux to be displayed on the graph. More...

void setFluxMax (double f)
 This function manually sets the maximum flux to be displayed on the graph. More...

void apply (double scale_factor)
 Applies the scaling factor to the raw counts to obtain the fluxes. More...

void reset (void)
 This function clears everything in the object except for the number of bins. More...

void draw (double scale_factor, std::string mode, int current_plot, int total_plots)
 Writes the contents of the flux and flux uncertainty histograms to a script file. More...

void writeFile (double scale_factor, std::ostream& out_file)
 Writes the contents of the flux histogram to an output file with the following format. More...


Private Types

enum  graphType { linear, semilogx, semilogy, loglog }
 Enumeration that determines the graph type. More...


Private Attributes

rootHistflux_hist
 histogram to store fluxes. More...

rootHistflux_sigma_hist
 histogram to store uncertainties. More...

rootHistraw_hist
 histogram to store raw counts. More...

const int num_bins
 number of bins for the histogram. More...

const double emin
 minimum energy. More...

const double emax
 maximum energy. More...

double range
 logarithmic range of energies. More...

std::string graphTitle
 title of graph. More...

std::string xlabel
 x axis title. More...

std::string ylabel
 y axis title. More...

enum rootEnergyHist::graphType  currentType
 Enumeration that determines the graph type.

bool fluxMode
 If true flux is graphed instead of E*flux. More...

bool use_flux_min
 If true flux_min is used as the minimum flux on the graph. More...

bool use_flux_max
 If true flux_max is used as the maximum flux on the graph. More...

double flux_min
 Manually specified minimum flux. More...

double flux_max
 Manually specified maximum flux. More...


Detailed Description

This class stores and graphs the flux vs. energy.

Normal usage typically entails 1. calling the constructor 2. calling setTitle, setXLabel, setYLabel, etc. 3. storing energies in the object using store 4. calling apply to normalize the histogram 5. calling draw or writeFile to output the results

Author(s):
Theodore Hierath

Definition at line 25 of file rootEnergyHist.h.


Member Enumeration Documentation

enum rootEnergyHist::graphType [private]
 

Enumeration that determines the graph type.

Enumeration values:
linear   Linear graph.
semilogx   Linear y-axis, logarithmic x-axis.
semilogy   Linear x-axis, logarithmic y-axis.
loglog   Logarithmic x and y axes.

Definition at line 124 of file rootEnergyHist.h.


Constructor & Destructor Documentation

rootEnergyHist::rootEnergyHist ( int bins,
double min_energy,
double max_energy )
 

Constructor creates an empty energy histogram.

ams bins The number of bins to use in the graph
ams min_energy The minimum energy in GeV for the binning range
ams max_energy The maximum energy in GeV for the binning range

Definition at line 12 of file rootEnergyHist.cxx.

rootEnergyHist::~rootEnergyHist ( void )
 

Definition at line 32 of file rootEnergyHist.cxx.

rootEnergyHist::rootEnergyHist ( const rootEnergyHist & oldHist )
 

Definition at line 39 of file rootEnergyHist.cxx.


Member Function Documentation

void rootEnergyHist::apply ( double scale_factor )
 

Applies the scaling factor to the raw counts to obtain the fluxes.

This function clears the raw count histogram, stores the flux values in the flux histogram, and calculates the uncertainties. If there was a previous value in the flux and flux uncertainty histograms, this function does not overwrite the values, but adds them together. This function must be used before the draw member function.

Definition at line 163 of file rootEnergyHist.cxx.

void rootEnergyHist::draw ( double scale_factor,
std::string mode,
int current_plot,
int total_plots )
 

Writes the contents of the flux and flux uncertainty histograms to a script file.

This file is then interpreted by root.

Parameters:
scale_factor   This is a final scale factor applied to the graphs.
mode   This can be "normal", "begin", or "end". Normal means that the draw function for this object will be used alone. Begin means that this draw function is first called before the corresponding one for rootEnergyHist. End means that this draw function is first called after the draw function for rootEnergyHist.
current_plot   This is the number of times this function has been called. If it is the first time it is called, this number should be '0'. This is used by the function so that it knows if it is at the beginning, middle, or end of the script file.
total_plots   This is the total number of plots that will be graphed. This is used in conjunction with current_plot so that the function knows when the script file should end.

Definition at line 205 of file rootEnergyHist.cxx.

void rootEnergyHist::reset ( void )
 

This function clears everything in the object except for the number of bins.

Definition at line 181 of file rootEnergyHist.cxx.

double rootEnergyHist::retrieveCount ( int binNumber )
 

Retrieves the raw count associated with the given bin number.

Definition at line 119 of file rootEnergyHist.cxx.

double rootEnergyHist::retrieveEnergy ( int binNumber )
 

Retrieves the energy associated with the given bin number.

Definition at line 134 of file rootEnergyHist.cxx.

Referenced by writeFile().

double rootEnergyHist::retrieveFlux ( int binNumber )
 

Retrieves the flux associated with the given bin number.

Definition at line 124 of file rootEnergyHist.cxx.

Referenced by draw(), and writeFile().

double rootEnergyHist::retrieveFluxUncertainty ( int binNumber )
 

Retrieves the flux uncertainty associated with the given bin number.

Definition at line 129 of file rootEnergyHist.cxx.

Referenced by draw().

double rootEnergyHist::retrieveRange ( void )
 

Retrieves the logorithmic (base 10) energy range for the histogram.

Definition at line 139 of file rootEnergyHist.cxx.

Referenced by draw().

void rootEnergyHist::setFluxMax ( double f )
 

This function manually sets the maximum flux to be displayed on the graph.

Definition at line 156 of file rootEnergyHist.cxx.

void rootEnergyHist::setFluxMin ( double f )
 

This function manually sets the minimum flux to be displayed on the graph.

Definition at line 150 of file rootEnergyHist.cxx.

void rootEnergyHist::setFluxMode ( void )
 

This function changes the graph type from E*flux vs. E to flux vs. E.

Definition at line 145 of file rootEnergyHist.cxx.

void rootEnergyHist::setGraphType ( const char * graph_type )
 

Sets the type of scaling used on the graph Valid values are "linear", "semilogx", "semilogy", and "log".

Definition at line 86 of file rootEnergyHist.cxx.

void rootEnergyHist::setTitle ( std::string title )
 

Sets the title for the graph.

Definition at line 71 of file rootEnergyHist.cxx.

void rootEnergyHist::setXLabel ( std::string label )
 

Sets the x-axis label on the flux vs. energy graph.

Definition at line 76 of file rootEnergyHist.cxx.

void rootEnergyHist::setYLabel ( std::string label )
 

Sets the y-axis label on the flux vs. energy graph.

Definition at line 81 of file rootEnergyHist.cxx.

void rootEnergyHist::store ( double energy )
 

Increments the temporary bin (by +1) corresponding to the given energy.

Definition at line 100 of file rootEnergyHist.cxx.

void rootEnergyHist::writeFile ( double scale_factor,
std::ostream & out_file )
 

Writes the contents of the flux histogram to an output file with the following format.

The first line is a comment describing the file. The following lines contain two pairs of numbers, the energy (MeV), and the flux (particles/(m^2*s*sr*MeV)).

Parameters:
scale_factor   The final scale factor to apply
out_file   The output file stream to write to

Definition at line 422 of file rootEnergyHist.cxx.


Member Data Documentation

enum rootEnergyHist::graphType rootEnergyHist::currentType [private]
 

Enumeration that determines the graph type.

const double rootEnergyHist::emax [private]
 

maximum energy.

Definition at line 117 of file rootEnergyHist.h.

const double rootEnergyHist::emin [private]
 

minimum energy.

Definition at line 116 of file rootEnergyHist.h.

bool rootEnergyHist::fluxMode [private]
 

If true flux is graphed instead of E*flux.

Definition at line 132 of file rootEnergyHist.h.

rootHist * rootEnergyHist::flux_hist [private]
 

histogram to store fluxes.

Definition at line 112 of file rootEnergyHist.h.

double rootEnergyHist::flux_max [private]
 

Manually specified maximum flux.

Definition at line 136 of file rootEnergyHist.h.

double rootEnergyHist::flux_min [private]
 

Manually specified minimum flux.

Definition at line 135 of file rootEnergyHist.h.

rootHist * rootEnergyHist::flux_sigma_hist [private]
 

histogram to store uncertainties.

Definition at line 113 of file rootEnergyHist.h.

std::string rootEnergyHist::graphTitle [private]
 

title of graph.

Definition at line 119 of file rootEnergyHist.h.

const int rootEnergyHist::num_bins [private]
 

number of bins for the histogram.

Definition at line 115 of file rootEnergyHist.h.

double rootEnergyHist::range [private]
 

logarithmic range of energies.

Definition at line 118 of file rootEnergyHist.h.

rootHist * rootEnergyHist::raw_hist [private]
 

histogram to store raw counts.

Definition at line 114 of file rootEnergyHist.h.

bool rootEnergyHist::use_flux_max [private]
 

If true flux_max is used as the maximum flux on the graph.

Definition at line 134 of file rootEnergyHist.h.

bool rootEnergyHist::use_flux_min [private]
 

If true flux_min is used as the minimum flux on the graph.

Definition at line 133 of file rootEnergyHist.h.

std::string rootEnergyHist::xlabel [private]
 

x axis title.

Definition at line 120 of file rootEnergyHist.h.

std::string rootEnergyHist::ylabel [private]
 

y axis title.

Definition at line 121 of file rootEnergyHist.h.


The documentation for this class was generated from the following files:
Generated at Wed Nov 21 12:20:36 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000