jhplot
Class H1D

java.lang.Object
  extended by jhplot.DrawOptions
      extended by jhplot.H1D

public class H1D
extends DrawOptions

Class to create a histogram in one dimension. Based on JAIDA Histogram1D class


Constructor Summary
H1D(Histogram1D h1)
          Create H1D histogram from JAIDA Histogram1D class
H1D(hep.aida.IHistogram1D h1)
          Create H1D histogram from JAIDA IHistogram1D class
H1D(java.lang.String title, double[] edges)
          Creat 1D histogram with variable bin size
H1D(java.lang.String title, int bins, double min, double max)
          Creat 1D histogram
H1D(hep.io.root.interfaces.TH1 h1t)
          Create H1D histogram from JAIDA TH1 histogram class
 
Method Summary
 int allEntries()
          Get number of all entries
 double binCenter(int index)
          Get bin centers
 double binEntries(int index)
          Number of entries in a bin with index i
 double binError(int index)
          Error on the bin with index i
 double binHeight(int index)
          Hight of the corresponding bin
 double binLowerEdge(int index)
          Get bin lower edge
 double binMean(int index)
          Mean in a single bin with index
 double binRms(int index)
          RMS of a single bin with index
 double binUpperEdge(int index)
          Get bin upper edge
 int entries()
          Number of in-range entries in the histogram
 int extraEntries()
          Number of under and overflow entries in the histogram.
 void fill(double value)
          Fill histogram with a value
 void fill(double value, double weight)
          Fill histogram a with weight
 void fillInvBinSizeWeight(double value)
          Fill histogram with a value, weighting it by inverse of bin size.
 Histogram1D get()
          Get JAIDA histogram
 hep.aida.IAxis getAxis()
          Get histogram axis
 int getBins()
          Get the number of bins
 double getMax()
          Get Maximum value of axis
 double getMin()
          Get Minimum value of the axis
 int getOverflow()
          Number of overlow entries
 double getOverflowlowHight()
          Overflow hight
 java.lang.String getTitle()
          get Title of the histogram
 int getUnderflow()
          Number of underflow entries
 double getUnderflowHight()
          Underflow hight
 double[][] getValues(int mode)
          Get positions in X,Y and Errors.
 double maxBinHeight()
          Max value of all bins
 double mean()
          Get mean of the histogram
 double minBinHeight()
          Min value of all bins
 H1D oper(double scale)
          Scale of the histogram
 H1D oper(H1D a, java.lang.String what)
          Various manipulations with histograms (+,-,*,/).
 H1D oper(H1D a, java.lang.String title, java.lang.String what)
          Various manipulations with histograms (+,-,*,/)
 H1D oper(int scale)
          Scale histogram.
 H1D oper(java.lang.String title, double scale)
          Scale the histogram
 H1D oper(java.lang.String title, int scale)
          Scale the histogram.
 void print()
          Print histogram on screen
 double rms()
          Get RMS of histogram
 void setBins(int bins)
          Sets the number of bins
 void setContents(double[] values, double[] errors)
          Sets the content of H1D histogram.
 void setMax(double max)
          Set Maximum value of axis
 void setMeanAndRms(double mean, double rms)
          Sets the Mean and RMS of H1D histogram
 void setMin(double min)
          Set Min value of axis
 void setNEntries(int entries)
          Sets number of entries of H1D histogram
 void setTitle(java.lang.String title)
          Sets the title
 void setValidEntries(int entries)
          Sets number of valid entries
 double sumAllBinHeights()
          Sum of all heights
 void toFile(java.lang.String name)
          Write the H1D histogram to a file
 void toTable()
          Print the H1D histogram to a Table in a separate Frame.
 void toTable(boolean format)
          Print the H1D histogram to a Table in a separate Frame.
 
Methods inherited from class jhplot.DrawOptions
getBinWidth, getDrawOption, getDrawOptions, getLegend, getNameX, getNameY, getNameZ, getType, printDrawOptions, printDrawOptions, setBinWidth, setColor, setDrawLine, setDrawOption, setDrawSymbol, setErr, setErrAll, setErrColor, setErrColorX, setErrColorY, setErrFill, setErrFillColor, setErrFillColor, setErrSys, setErrSysFill, setErrSysFillColor, setErrSysFillColor, setErrSysX, setErrSysY, setErrX, setErrY, setFill, setFillColor, setFillColorTransparency, setGraphStyle, setLegend, setNameX, setNameY, setNameZ, setPenDash, setPenDash, setPenWidth, setPenWidthErr, setPenWidthErrSys, setStyle, setSymbol, setSymbolSize, setType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

H1D

public H1D(java.lang.String title,
           int bins,
           double min,
           double max)
Creat 1D histogram

Parameters:
title - Title
bins - Number of bins
min - Minimum value
max - Maximum value

H1D

public H1D(java.lang.String title,
           double[] edges)
Creat 1D histogram with variable bin size

Parameters:
title - Title
edges - edges

H1D

public H1D(Histogram1D h1)
Create H1D histogram from JAIDA Histogram1D class

Parameters:
h1 - Histogram1D histogram from JAIDA

H1D

public H1D(hep.aida.IHistogram1D h1)
Create H1D histogram from JAIDA IHistogram1D class

Parameters:
h1 - IHistogram1D histogram from JAIDA

H1D

public H1D(hep.io.root.interfaces.TH1 h1t)
Create H1D histogram from JAIDA TH1 histogram class

Parameters:
h1t - TH1 histogram from JAIDA
Method Detail

print

public void print()
Print histogram on screen


toTable

public void toTable()
Print the H1D histogram to a Table in a separate Frame. The numbers are formatted to scientific format. One can sort and search the data in this table (but not modify)


getAxis

public hep.aida.IAxis getAxis()
Get histogram axis

Returns:
Axis

binCenter

public double binCenter(int index)
Get bin centers

Parameters:
index - bin index
Returns:
bin center

binLowerEdge

public double binLowerEdge(int index)
Get bin lower edge

Parameters:
index - bin index
Returns:
lower edge

binUpperEdge

public double binUpperEdge(int index)
Get bin upper edge

Parameters:
index - bin index
Returns:
upper edge

toTable

public void toTable(boolean format)
Print the H1D histogram to a Table in a separate Frame. One can sort and search the data in this table (but not modify) #param format if false, numbers will not be formatted The numbers are formatted to scientific format.


toFile

public void toFile(java.lang.String name)
Write the H1D histogram to a file

Parameters:
name - File name

setContents

public void setContents(double[] values,
                        double[] errors)
Sets the content of H1D histogram. Start fron 1 to bins+2.

Parameters:
values - array with values in Y (dimension: bins + 2)
errors - array with errors on Y (dimension: bins + 2)

setMeanAndRms

public void setMeanAndRms(double mean,
                          double rms)
Sets the Mean and RMS of H1D histogram

Parameters:
mean - mean of the histogram
rms - RMS to be set

setNEntries

public void setNEntries(int entries)
Sets number of entries of H1D histogram

Parameters:
entries - Number of entries

setValidEntries

public void setValidEntries(int entries)
Sets number of valid entries

Parameters:
entries - Number of valid entries

setTitle

public void setTitle(java.lang.String title)
Sets the title

Overrides:
setTitle in class DrawOptions
Parameters:
title - Title

getTitle

public java.lang.String getTitle()
get Title of the histogram

Overrides:
getTitle in class DrawOptions
Returns:
Title of histogram

get

public Histogram1D get()
Get JAIDA histogram

Returns:
JAIDA Histogram1D histogram

setMin

public void setMin(double min)
Set Min value of axis

Parameters:
min - Minimum value of axis

getMin

public double getMin()
Get Minimum value of the axis

Returns:
Minimum value of the axis

setMax

public void setMax(double max)
Set Maximum value of axis

Parameters:
max - Maximum value of axis

getMax

public double getMax()
Get Maximum value of axis

Returns:
Maximum value of axis

setBins

public void setBins(int bins)
Sets the number of bins

Parameters:
bins - Number of bins

getBins

public int getBins()
Get the number of bins

Returns:
Number of bins

fill

public void fill(double value)
Fill histogram with a value

Parameters:
value - Value to be filled

fill

public void fill(double value,
                 double weight)
Fill histogram a with weight

Parameters:
value - Value to be filled
weight - Weight of the value

mean

public double mean()
Get mean of the histogram

Returns:
Mean of histogram

rms

public double rms()
Get RMS of histogram

Returns:
RMS of histogram

allEntries

public int allEntries()
Get number of all entries

Returns:
Number of all entries

extraEntries

public int extraEntries()
Number of under and overflow entries in the histogram.

Returns:
Number of under and overflow entries

entries

public int entries()
Number of in-range entries in the histogram

Returns:
Number of in-range entries

getUnderflow

public int getUnderflow()
Number of underflow entries

Returns:
Number of underflow

getUnderflowHight

public double getUnderflowHight()
Underflow hight

Returns:
Hight of underflow

getOverflowlowHight

public double getOverflowlowHight()
Overflow hight

Returns:
Hight of underflow

getOverflow

public int getOverflow()
Number of overlow entries

Returns:
Number of overflow entries

oper

public H1D oper(double scale)
Scale of the histogram

Parameters:
scale - Scaling factor
Returns:
New H1D histogram

fillInvBinSizeWeight

public void fillInvBinSizeWeight(double value)
Fill histogram with a value, weighting it by inverse of bin size. Should be useful for histograms with irregular binning.

Parameters:
value - Value to filled histogram with.

oper

public H1D oper(int scale)
Scale histogram. Keep original title

Parameters:
scale - Scale factor
Returns:
New H1D histogram

oper

public H1D oper(java.lang.String title,
                int scale)
Scale the histogram.

Parameters:
title - New title
scale - Scale factor
Returns:
New H1D histogram

oper

public H1D oper(java.lang.String title,
                double scale)
Scale the histogram

Parameters:
title - New title
scale - Scale factor
Returns:
New H1D histogram

binEntries

public double binEntries(int index)
Number of entries in a bin with index i

Parameters:
index - Bin index
Returns:
Number of entries

binError

public double binError(int index)
Error on the bin with index i

Parameters:
index - Bin index
Returns:
Error

binHeight

public double binHeight(int index)
Hight of the corresponding bin

Parameters:
index - Bin index
Returns:
Bin Hight

binMean

public double binMean(int index)
Mean in a single bin with index

Parameters:
index - Bin index
Returns:
Mean value inside of this bin

binRms

public double binRms(int index)
RMS of a single bin with index

Parameters:
index - Bin index
Returns:
RMS of this bin

maxBinHeight

public double maxBinHeight()
Max value of all bins

Returns:
Max value

minBinHeight

public double minBinHeight()
Min value of all bins

Returns:
Min value

sumAllBinHeights

public double sumAllBinHeights()
Sum of all heights

Returns:
Sum of all Heights

oper

public H1D oper(H1D a,
                java.lang.String what)
Various manipulations with histograms (+,-,*,/). Keep the original title

Parameters:
a - H1D histogram.
what - String representing the operation: "+" add a histogarm to the original "-" subtract a histogram from the original "*" multiply "/" divide
Returns:
New H1D histogram

getValues

public double[][] getValues(int mode)
Get positions in X,Y and Errors. For x, we take mean values

Parameters:
mode - if =1, take center of the bins. In all other cases - mean value in each bin
Returns:
array with X,Y, and Error on Y, double[3][bins];

oper

public H1D oper(H1D a,
                java.lang.String title,
                java.lang.String what)
Various manipulations with histograms (+,-,*,/)

Parameters:
a - H1D histogram.
title - New Title
Returns:
New H1D histogram


jHepWork 1.1 (C) Chekanov