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

rootHist Class Reference

This class serves as an array that checks for invalid indexing. More...

#include <rootHist.h>

List of all members.

Public Methods

 rootHist (int bins)
 Constructor takes number of bins for histogram. More...

 rootHist (const rootHist &oldHist)
 ~rootHist (void)
void updateBin (int binNumber, double data)
 Stores a number in the specified bin. More...

double retrieveBin (int binNumber)
 Returns the contents of the specified bin. More...


Private Attributes

double * hist
 The histogram. More...

const int num_bins
 The number of bins in the histogram. More...


Detailed Description

This class serves as an array that checks for invalid indexing.

Author:
Theodore Hierath

Definition at line 13 of file rootHist.h.


Constructor & Destructor Documentation

rootHist::rootHist int    bins
 

Constructor takes number of bins for histogram.

Definition at line 10 of file rootHist.cxx.

References hist, and num_bins.

00010                            : num_bins(bins)
00011 {
00012     if(bins <= 0)
00013     {
00014         std::cerr << "ERROR in constructor for roothist:\n" 
00015             "   The total number of bins must be greater than zero."
00016             << std::endl;
00017         exit(0);
00018     }
00019     
00020     hist = new double[num_bins];
00021     for (int i = 0; i < num_bins; i++) hist[i] = 0;
00022 }

rootHist::rootHist const rootHist &    oldHist
 

Definition at line 30 of file rootHist.cxx.

References hist, and num_bins.

00030                                           : num_bins(oldHist.num_bins)
00031 {
00032     hist = new double[num_bins];
00033     for (int i = 0; i < num_bins; i++) hist[i] = oldHist.hist[i];
00034 }

rootHist::~rootHist void   
 

Definition at line 24 of file rootHist.cxx.

References hist.

00025 {
00026     delete [] hist;
00027     hist = NULL;
00028 }


Member Function Documentation

double rootHist::retrieveBin int    binNumber
 

Returns the contents of the specified bin.

The bin numbering goes from 0 to (total number of bins - 1).

Definition at line 48 of file rootHist.cxx.

References hist, and num_bins.

Referenced by rootEnergyHist::apply(), rootAngleHist::apply(), rootEnergyHist::retrieveCount(), rootEnergyHist::retrieveFlux(), rootEnergyHist::retrieveFluxUncertainty(), rootAngleHist::retrievePhiCount(), rootAngleHist::retrievePhiFlux(), rootAngleHist::retrievePhiFluxUncertainty(), rootAngleHist::retrieveThetaCount(), rootAngleHist::retrieveThetaFlux(), rootAngleHist::retrieveThetaFluxUncertainty(), rootEnergyHist::store(), rootAngleHist::storePhi(), and rootAngleHist::storeTheta().

00049 {
00050     if(binNumber < 0 || binNumber >= num_bins)
00051     {
00052         std::cerr << "Error:  bin number is out of range" << std::endl;
00053         exit(0);
00054     }
00055     return hist[binNumber];
00056 }

void rootHist::updateBin int    binNumber,
double    data
 

Stores a number in the specified bin.

ams binNumber The bin to store the data in. The bin numbering
goes from 0 to (total number of bins - 1).
ams data The number to store

Definition at line 37 of file rootHist.cxx.

References hist, and num_bins.

Referenced by rootEnergyHist::apply(), rootAngleHist::apply(), rootEnergyHist::reset(), rootAngleHist::reset(), rootAngleHist::rootAngleHist(), rootEnergyHist::rootEnergyHist(), rootEnergyHist::store(), rootAngleHist::storePhi(), and rootAngleHist::storeTheta().

00038 {
00039     if(binNumber < 0 || binNumber >= num_bins)
00040     {
00041         std::cerr << "Error:  bin number is out of range" << std::endl;
00042         exit(0);
00043     }
00044     hist[binNumber] = data;
00045 }


Member Data Documentation

double* rootHist::hist [private]
 

The histogram.

Definition at line 31 of file rootHist.h.

Referenced by retrieveBin(), rootHist(), updateBin(), and ~rootHist().

const int rootHist::num_bins [private]
 

The number of bins in the histogram.

Definition at line 32 of file rootHist.h.

Referenced by retrieveBin(), rootHist(), and updateBin().


The documentation for this class was generated from the following files:
Generated on Wed Oct 16 14:01:35 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001