Class describing a spectrum. More...
#include <XeStat.h>
Public Member Functions | |
| void | add (XeSpectrum *other) |
| Add (cumulate) contents with those of another spectum. | |
| virtual void | addSpectrum (vector< double > &spectrum) |
| add the spectrum from a vector | |
| void | drawGraph (string options="C", string Xlab="", string Ylab="", XeStyle *style=NULL) |
| Draw it as a graph. | |
| void | drawGraphWithFrame (string options="C", string Xlab="", string Ylab="", XeStyle *style=NULL) |
| Draw it as a graph with its frame. | |
| void | drawHistogram (string options="C", string Xlab="", string Ylab="") |
| Draw it as an histogram. | |
| void | fillDelta (double x, double weight=1.) |
| Fill one value with a given weight. | |
| void | fillExponent (double x0, double norm=1., double xmin=0., double xmax=VERY_LARGE) |
| Fill content by a (bounded) exponential distribution. | |
| void | fillHistogram (TH2F *hist, int spectrum) |
| fill one of the 2D histogram slices with the current spectrum | |
| virtual void | fillValues (double *values, int nValues) |
| Build the spectrum from an list of realizations. | |
| int | getBin (double x) |
| Return the bin number corresponding to a given value. | |
| pair< int, double > | getBinAndFraction (double x) |
| Return the bin number and fraction corresponding to a given value. | |
| double | getMax () |
| Return the highest edge. | |
| double | getMin () |
| Return the lowest edge. | |
| int | getNBins () |
| Return the number of bins. | |
| LinearRange * | getRange () |
| Return the range (actually LinearRange) of x values. | |
| string | getReducedName () |
| Return the name without the header. | |
| double * | getSpectrum () |
| Return the contents. | |
| vector< double > * | getTheSpectrum () |
| Return the contents vector. | |
| virtual void | importSpectrum (vector< double > &spectrum) |
| copy the spectrum from a vector | |
| virtual void | importSpectrum (double *spectrum) |
| Copy the spectrum from an array. | |
| double | integral (double x1, double x2) |
| computes the integral of the spectrum between two values | |
| XeGraph * | newGraph (string Xlab="", string Ylab="", XeStyle *style=NULL, string legend="") |
| TH2F * | newHistogram (int nSpectra, int plot=NONE) |
| TH1F * | newHistogram (string name="", int plot=NONE) |
| XeSpectrum | operator* (double a) |
| multiply one double times one Spectrum | |
| XeSpectrum | operator+ (XeSpectrum &other) |
| add two Spectra | |
| void | printDetailed (bool ignoreTail) |
| print a detailed table of content | |
| bool | printIt (int level=1) |
| print the object | |
| void | reset () |
| Reset the content. | |
| void | setBin (int bin, double content) |
| set content of a bin | |
| void | setTheRange (int nB, double min, double max) |
| Internal method: set the range. | |
| void | setTheRange (LinearRange *range) |
| Internal method: set the range. | |
| double | sum () |
| Return the sum of contents. | |
| XeSpectrum (string nam, int nBins, double min, double max, XeValues *values) | |
| Constructor from an XeValues of realizations. | |
| XeSpectrum (string nam, LinearRange *lr, vector< double > &spec, int mode=SPECTRUM) | |
| Constructor giving Linear Range and possibly pointer to spectrum. | |
| XeSpectrum (string nam, int nBins, double min, double max, vector< double > &spec, int mode=SPECTRUM) | |
| Constructor giving bin boundaries and passing vector of spectrum. | |
| XeSpectrum (string nam, LinearRange *lr, double *spec=NULL, int nValues=0, int mode=SPECTRUM) | |
| Constructor giving Linear Range and possibly pointer to spectrum. | |
| XeSpectrum (string nam, int nBins, double min, double max, double *spec=NULL, int nValues=0, int mode=SPECTRUM) | |
| Constructor giving bin boundaries and possibly pointer to spectrum. | |
| XeSpectrum (string n) | |
| Minimal constructor. | |
| XeSpectrum () | |
| Empty constructor for ROOT. | |
Static Public Member Functions | |
| static string | getTheName (string nam) |
| Return the name with the header. | |
Protected Member Functions | |
| void | initialize () |
| initialize members | |
Protected Attributes | |
| int | nBins |
| LinearRange * | range |
| bool | rangeIsCreated |
| vector< double > | spectrum |
Class describing a spectrum.
If normalized, it is called a XeDist
| XeSpectrum::XeSpectrum | ( | string | nam, | |
| int | nBins, | |||
| double | min, | |||
| double | max, | |||
| double * | spec = NULL, |
|||
| int | nValues = 0, |
|||
| int | mode = SPECTRUM | |||
| ) |
Constructor giving bin boundaries and possibly pointer to spectrum.
| nam | name of the spectrum | |
| nBins | number of bins | |
| min | Lower bound of the spectrum | |
| max | Upper bound of the spectrum | |
| spec | pointer to the spectrum to be copied (mode SPECTRUM) , or the values to be histogrammed (mode VALUES) | |
| nValues | number of values | |
| mode | whether spec refer to SPECTRUM or VALUES |
| XeSpectrum::XeSpectrum | ( | string | nam, | |
| LinearRange * | lr, | |||
| double * | spec = NULL, |
|||
| int | nValues = 0, |
|||
| int | mode = SPECTRUM | |||
| ) |
Constructor giving Linear Range and possibly pointer to spectrum.
| nam | name of the spectrum | |
| lr | Linear Range defining the boundaries | |
| spec | pointer to the spectrum to be copied (mode SPECTRUM) , or the values to be histogrammed (mode VALUES) | |
| nValues | number of values | |
| mode | whether spec refer to SPECTRUM or VALUES |
| XeSpectrum::XeSpectrum | ( | string | nam, | |
| int | nBins, | |||
| double | min, | |||
| double | max, | |||
| vector< double > & | spec, | |||
| int | mode = SPECTRUM | |||
| ) |
Constructor giving bin boundaries and passing vector of spectrum.
| nam | name of the spectrum | |
| nBins | number of bins | |
| min | Lower bound of the spectrum | |
| max | Upper bound of the spectrum | |
| spec | pointer to the spectrum to be copied (mode SPECTRUM) , or the values to be histogrammed (mode VALUES) | |
| mode | whether spec refer to SPECTRUM or VALUES |
| XeSpectrum::XeSpectrum | ( | string | nam, | |
| LinearRange * | lr, | |||
| vector< double > & | spec, | |||
| int | mode = SPECTRUM | |||
| ) |
Constructor giving Linear Range and possibly pointer to spectrum.
| nam | name of the spectrum | |
| lr | Linear Range defining the boundaries | |
| spec | pointer to the spectrum to be copied (mode SPECTRUM) , or the values to be histogrammed (mode VALUES) | |
| mode | whether spec refer to SPECTRUM or VALUES |
| XeSpectrum::XeSpectrum | ( | string | nam, | |
| int | nBins, | |||
| double | min, | |||
| double | max, | |||
| XeValues * | values | |||
| ) |
| void XeSpectrum::add | ( | XeSpectrum * | other | ) |
Add (cumulate) contents with those of another spectum.
| other | pointer to the other XeSpectrum |
| virtual void XeSpectrum::addSpectrum | ( | vector< double > & | spectrum | ) | [virtual] |
add the spectrum from a vector
| spectrum | vector of values to be added |
| void XeSpectrum::drawGraph | ( | string | options = "C", |
|
| string | Xlab = "", |
|||
| string | Ylab = "", |
|||
| XeStyle * | style = NULL | |||
| ) |
Draw it as a graph.
| Xlab | label of x-axis | |
| Ylb | label of y-axis | |
| style | Style of the graph | |
| options | TGraph->Draw() option |
| void XeSpectrum::drawGraphWithFrame | ( | string | options = "C", |
|
| string | Xlab = "", |
|||
| string | Ylab = "", |
|||
| XeStyle * | style = NULL | |||
| ) |
Draw it as a graph with its frame.
| Xlab | label of x-axis | |
| Ylb | label of y-axis | |
| style | Style of the graph | |
| options | TGraph->Draw() option |
| void XeSpectrum::drawHistogram | ( | string | options = "C", |
|
| string | Xlab = "", |
|||
| string | Ylab = "" | |||
| ) |
Draw it as an histogram.
| options | THist->Draw() option |
| void XeSpectrum::fillDelta | ( | double | x, | |
| double | weight = 1. | |||
| ) |
Fill one value with a given weight.
| x | value | |
| weight | weight (default 1.) |
| void XeSpectrum::fillExponent | ( | double | x0, | |
| double | norm = 1., |
|||
| double | xmin = 0., |
|||
| double | xmax = VERY_LARGE | |||
| ) |
Fill content by a (bounded) exponential distribution.
| x0 | 1./slope | |
| norm | overall normalization | |
| xmin | lower cut | |
| xmax | upper cut |
| void XeSpectrum::fillHistogram | ( | TH2F * | hist, | |
| int | spectrum | |||
| ) |
fill one of the 2D histogram slices with the current spectrum
| hist | The histogram to be filled | |
| spectrum | numbered from 0 to nSpectra-1 |
| virtual void XeSpectrum::fillValues | ( | double * | values, | |
| int | nValues | |||
| ) | [virtual] |
Build the spectrum from an list of realizations.
| values | array of values | |
| nValues | number of points |
Reimplemented in TabulatedDist.
| int XeSpectrum::getBin | ( | double | x | ) |
Return the bin number corresponding to a given value.
| x | x-value to be considered |
| pair<int,double> XeSpectrum::getBinAndFraction | ( | double | x | ) |
Return the bin number and fraction corresponding to a given value.
| x | x-value to be considered |
| double* XeSpectrum::getSpectrum | ( | ) |
Return the contents.
| vector<double>* XeSpectrum::getTheSpectrum | ( | ) |
Return the contents vector.
| virtual void XeSpectrum::importSpectrum | ( | vector< double > & | spectrum | ) | [virtual] |
copy the spectrum from a vector
| spectrum | vector of values to be copied |
Reimplemented in TabulatedDist.
| virtual void XeSpectrum::importSpectrum | ( | double * | spectrum | ) | [virtual] |
Copy the spectrum from an array.
| spec | values to be copied |
Reimplemented in TabulatedDist.
| double XeSpectrum::integral | ( | double | x1, | |
| double | x2 | |||
| ) |
computes the integral of the spectrum between two values
| x1 | lower bound of the integral | |
| x2 | upper bound of the integral |
| XeGraph* XeSpectrum::newGraph | ( | string | Xlab = "", |
|
| string | Ylab = "", |
|||
| XeStyle * | style = NULL, |
|||
| string | legend = "" | |||
| ) |
| Xlab | label of x-axis | |
| Ylb | label of y-axis | |
| style | Style of the graph | |
| legend | Legend in case of a multi-graph |
| TH2F* XeSpectrum::newHistogram | ( | int | nSpectra, | |
| int | plot = NONE | |||
| ) |
| nSpectra | number of spectra | |
| plot | either NONE, AUTO, LINEAR, or LOG |
| TH1F* XeSpectrum::newHistogram | ( | string | name = "", |
|
| int | plot = NONE | |||
| ) |
| name | Name of the histogram | |
| plot | either NONE, AUTO, LINEAR, or LOG |
| void XeSpectrum::printDetailed | ( | bool | ignoreTail | ) |
print a detailed table of content
| ignoreTail | don't print the uppermost empty part of the spectrum |
| bool XeSpectrum::printIt | ( | int | level = 1 |
) | [virtual] |
print the object
| level | print level (0-> no print) |
Reimplemented from XeObject.
Reimplemented in TabulatedDist.
| void XeSpectrum::setBin | ( | int | bin, | |
| double | content | |||
| ) |
set content of a bin
| bin | which bin, from 0 to nBins-1 | |
| content | what to set |
| void XeSpectrum::setTheRange | ( | int | nB, | |
| double | min, | |||
| double | max | |||
| ) |
Internal method: set the range.
Create a Linear Range only when needed
| nB | number of bins | |
| min | lower edge of range | |
| max | upper edge of range |
| void XeSpectrum::setTheRange | ( | LinearRange * | range | ) |
Internal method: set the range.
| range pointer to LinearRange |
int XeSpectrum::nBins [protected] |
number of bins
LinearRange* XeSpectrum::range [protected] |
pointer to the XeRange (actually LinearRange)
bool XeSpectrum::rangeIsCreated [protected] |
a new XeRange had to be created
vector<double> XeSpectrum::spectrum [protected] |
the values
1.6.1