XeSpectrum Class Reference

Class describing a spectrum. More...

#include <XeStat.h>

Inheritance diagram for XeSpectrum:
XeGraphics XeStat XeCore XeMath XeObject XeCore XeCore TabulatedDist

List of all members.

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.
LinearRangegetRange ()
 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
XeGraphnewGraph (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
LinearRangerange
bool rangeIsCreated
vector< double > spectrum

Detailed Description

Class describing a spectrum.

If normalized, it is called a XeDist


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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 
)

Constructor from an XeValues of realizations.

Parameters:
nam name of the original quantity
nBins Number of bins
min lowest value of lowest bin
max highest value of highest bin
values Original table of Values (actually XeValues)

Member Function Documentation

void XeSpectrum::add ( XeSpectrum other  ) 

Add (cumulate) contents with those of another spectum.

Parameters:
other pointer to the other XeSpectrum
virtual void XeSpectrum::addSpectrum ( vector< double > &  spectrum  )  [virtual]

add the spectrum from a vector

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
options THist->Draw() option
void XeSpectrum::fillDelta ( double  x,
double  weight = 1. 
)

Fill one value with a given weight.

Parameters:
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.

Parameters:
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

Parameters:
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.

Parameters:
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.

Parameters:
x x-value to be considered
pair<int,double> XeSpectrum::getBinAndFraction ( double  x  ) 

Return the bin number and fraction corresponding to a given value.

Returns:
a pair containing the bin and the fraction
Parameters:
x x-value to be considered
double* XeSpectrum::getSpectrum (  ) 

Return the contents.

Returns:
pointer to the array of contents
vector<double>* XeSpectrum::getTheSpectrum (  ) 

Return the contents vector.

Returns:
pointer to the array of contents
virtual void XeSpectrum::importSpectrum ( vector< double > &  spectrum  )  [virtual]

copy the spectrum from a vector

Parameters:
spectrum vector of values to be copied

Reimplemented in TabulatedDist.

virtual void XeSpectrum::importSpectrum ( double *  spectrum  )  [virtual]

Copy the spectrum from an array.

Parameters:
spec values to be copied

Reimplemented in TabulatedDist.

double XeSpectrum::integral ( double  x1,
double  x2 
)

computes the integral of the spectrum between two values

Returns:
sum of (fractional) bin contents
Parameters:
x1 lower bound of the integral
x2 upper bound of the integral
XeGraph* XeSpectrum::newGraph ( string  Xlab = "",
string  Ylab = "",
XeStyle style = NULL,
string  legend = "" 
)
Returns:
A graph (actually an XeGraph) of the spectrum
Parameters:
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 
)
Returns:
an empty 2-D histogram form an array of spectra
Parameters:
nSpectra number of spectra
plot either NONE, AUTO, LINEAR, or LOG
TH1F* XeSpectrum::newHistogram ( string  name = "",
int  plot = NONE 
)
Returns:
an histogram
Parameters:
name Name of the histogram
plot either NONE, AUTO, LINEAR, or LOG
void XeSpectrum::printDetailed ( bool  ignoreTail  ) 

print a detailed table of content

Parameters:
ignoreTail don't print the uppermost empty part of the spectrum
bool XeSpectrum::printIt ( int  level = 1  )  [virtual]

print the object

Parameters:
level print level (0-> no print)

Reimplemented from XeObject.

Reimplemented in TabulatedDist.

void XeSpectrum::setBin ( int  bin,
double  content 
)

set content of a bin

Parameters:
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

Parameters:
nB number of bins
min lower edge of range
max upper edge of range
void XeSpectrum::setTheRange ( LinearRange range  ) 

Internal method: set the range.

Parameters:
 range pointer to LinearRange

Member Data Documentation

int XeSpectrum::nBins [protected]

number of bins

pointer to the XeRange (actually LinearRange)

bool XeSpectrum::rangeIsCreated [protected]

a new XeRange had to be created

vector<double> XeSpectrum::spectrum [protected]

the values


The documentation for this class was generated from the following file:
 All Classes Functions Variables

Generated on 10 Apr 2015 for Xephyr by  doxygen 1.6.1