public class H1D extends DrawOptions implements Serializable
Constructor and Description |
---|
H1D()
Build 1D histogram.
|
H1D(hep.aida.ref.histogram.Cloud1D c1d,
int bins)
Create H1D histogram from JAIDA Cloud1D class.
|
H1D(hep.aida.ref.histogram.Histogram1D h1)
Create H1D histogram from JAIDA Histogram1D class.
|
H1D(hep.aida.IHistogram1D h1)
Create H1D histogram from JAIDA IHistogram1D class
|
H1D(String title,
double[] edges)
Create 1D histogram with variable bin size.
|
H1D(String title,
H1D h1d)
Create H1D from another instance.
|
H1D(String title,
hep.aida.IAxis axis)
Create 1D histogram with variable bin size.
|
H1D(String title,
int bins,
double min,
double max)
Build 1D histogram
|
H1D(hep.io.root.interfaces.TH1 h1t)
Create H1D histogram from JAIDA TH1 histogram class
|
Modifier and Type | Method and Description |
---|---|
int |
allEntries()
Get number of all entries
|
double |
binCenter(int index)
Get bin centres.
|
double[] |
binCenters()
Get all bin centers in form of array
|
int[] |
binEntries()
Get all entries of the histogram as an array
|
int |
binEntries(int index)
Number of entries in a bin with index i
|
double |
binError(int index)
Error on the bin with index i
|
double[] |
binErrors()
Get all bin errors of the histogram as an array
|
double |
binHeight(int index)
Height of the corresponding bin
|
double[] |
binHeights()
Get all heights of the histogram as an array
|
double |
binLowerEdge(int index)
Get bin lower edge.
|
double[] |
binLowerEdges()
Get all lower edges in form of array
|
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.
|
double[] |
binUpperEdges()
Get all upper edges in form of array
|
void |
clear()
Make a copy of the data holder
|
H1D |
copy()
Make a copy of the data holder
|
H1D |
copy(String newtitle)
Get exact copy of the current histogram.
|
void |
doc()
Show online documentation.
|
int |
entries()
Number of in-range entries in the histogram
|
int |
extraEntries()
Number of under and overflow entries in the histogram.
|
void |
fill(hep.aida.ref.histogram.Cloud1D c1d)
Fill histogram with array of double values
|
void |
fill(double value)
Fill histogram with a value
|
void |
fill(double[] values)
Fill histogram with array of double values
|
void |
fill(double[] values,
double[] weights)
Fill histogram with array of double values.
|
void |
fill(double value,
double weight)
Fill histogram a with weight
|
void |
fill(int[] values)
Fill histogram with array of integer values
|
void |
fill(int TotNumber,
AbstractDistribution random)
Fill histogram with random numbers.
|
void |
fill(P0D p0d)
Fill histogram from P0D array
|
void |
fill(P0I p0i)
Fill histogram from P0I array
|
void |
fill(PND pnd)
Fill histogram with values from a PND array.
|
void |
fill(PND pnd,
PND weigths)
Fill histograms with values from PND array.
|
void |
fillInvBinSizeWeight(double value)
Fill histogram with a value, weighting it by inverse of bin size.
|
int |
findBin(double x)
Convert a coordinate on the axis to a bin number
|
hep.aida.ref.histogram.Histogram1D |
get()
Get JAIDA histogram
|
hep.aida.IAxis |
getAxis()
Get histogram Axis class.
|
int |
getBins()
Get the number of bins
|
double |
getBinSize()
Get bin width in case of fixed-size bins.
|
double |
getBinSize(int index)
Get bin width for index i
|
H1D |
getDensity()
Get a density distribution dividing each bin of the histogram
by the bin width and the total number of heights for all bins.
|
H1D |
getDividedByBinWidth()
Divide heights of each bin by the bin width.
|
double |
getEntropy()
Returns the entropy of the histogram.
|
double |
getMax()
Get Maximum value of axis
|
double |
getMin()
Get Minimum value of the axis
|
int |
getOverflow()
Number of overflow entries
|
double |
getOverflowlowHeight()
Overflow height
|
H1D |
getProbability()
Return q probability distribution derived from a histogram.
|
Map<String,Double> |
getStat()
Calculate complete statistics for this histogram.
|
String[] |
getStatParameters()
Get statistical parameters of a Histogram as a list of strings
|
int |
getUnderflow()
Number of underflow entries
|
double |
getUnderflowHeight()
Underflow height
|
double[][] |
getValues(int mode)
Get positions in X,Y and Errors.
|
double |
integral()
Sum of all heights
|
double |
integral(int BinMin,
int BinMax)
Integrate a histogram between two bin indices (between 1 and max number)
By default the integral is computed as the sum of bin contents in the range.
|
double |
integral(int BinMin,
int BinMax,
boolean timesBinWidth)
Integrate a histogram between two bin indices (between 1 and max number)
The integral is computed as the sum of bin contents in the range
if the last parameter is false.
|
double |
integralRegion(double xmin,
double xmax)
Integrate histogram in a region between Xmin and Xmax.
|
double |
integralRegion(double xmin,
double xmax,
boolean timesBinWidth)
Integrate histogram in a region between Xmin and Xmax.
|
boolean |
isFixedBinning()
Return true if bins have constant bin width
|
double |
maxBinHeight()
Max value of all bins
|
double |
mean()
Get mean of the histogram
|
double |
minBinHeight()
Min value of all bins
|
H1D |
oper(H1D a,
String what)
Various manipulations with histograms (+,-,*,/).
|
H1D |
oper(H1D a,
String title,
String what)
Various manipulations with histograms (+,-,*,/).
|
H1D |
operScale(String title,
double scaleFactor)
Scale the histogram and return scaled object.
|
H1D |
operSmooth(boolean isWeighted,
int k)
Smooth the histogram.
|
H1D |
operSmoothGauss(double standardDeviation)
Computes a Gaussian smoothed version of the histogram.
|
void |
print()
Print histogram on screen
|
H1D |
rebin(int ngroup)
Rebin a histogram with constant bin width.
|
double |
rms()
Get RMS of histogram
|
void |
scale(double scaleFactor)
Scale the histogram.
|
void |
scale(String title,
double scaleFactor)
Scale the histogram.
|
H1D |
scaleErrors(double scale)
Rescale errors by a some factor.
|
void |
setBins(int bins)
Sets the number of bins
|
void |
setContents(double[] values,
double[] errors)
Sets the content of H1D histogram.
|
void |
setContents(double[] heights,
double[] errors,
int[] entries,
double[] means,
double[] rmss)
Set the content of the whole Histogram at once.
|
void |
setErrors(double[] errors)
Sets errors of H1D histogram (for heights).
|
void |
setHeights(double[] values)
Sets the content of H1D histogram (heights).
|
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 |
setValidEntries(int entries)
Sets number of valid entries.
|
void |
shift(double d)
Shift all bins by some value
|
double |
sumAllBinHeights()
Sum of all heights
|
void |
toFile(String name)
Write the H1D histogram to a file
|
String |
toString()
Convert the histogram to a string
|
void |
toTable()
Print a H1D histogram to a Table in a separate frame.
|
copyLinePars, getBinWidth, getColor, getDrawOption, getDrawOptions, getFillColor, getLegend, getLineParm, getLineStyle, getNameX, getNameY, getNameZ, getPenWidth, getSymbol, getSymbolShape, getSymbolSize, getTitle, getType, isBars, isErrX, isErrY, isFilled, printDrawOptions, printDrawOptions, setBars, setBinWidth, setColor, setDrawLine, setDrawLineKey, setDrawOption, setDrawSymbol, setErr, setErrAll, setErrColor, setErrColor, setErrColorX, setErrColorY, setErrFill, setErrFillColor, setErrFillColor, setErrSys, setErrSysFill, setErrSysFillColor, setErrSysFillColor, setErrSysX, setErrSysY, setErrTicSize, setErrX, setErrY, setFill, setFillColor, setFillColorTransparency, setGraphStyle, setLegend, setLineStyle, setNameX, setNameY, setNameZ, setPenDash, setPenDash, setPenWidth, setPenWidthErr, setPenWidthErrSys, setStyle, setSymbol, setSymbol, setSymbolSize, setTitle, setType
public H1D()
public H1D(String title, int bins, double min, double max)
title
- Titlebins
- Number of binsmin
- Minimum valuemax
- Maximum valuepublic H1D(String title, double[] edges)
title
- Title of histogram.edges
- edgespublic H1D(String title, hep.aida.IAxis axis)
title
- Title of histogram.edges
- edgespublic H1D(hep.aida.ref.histogram.Histogram1D h1)
h1
- Histogram1D histogram from JAIDApublic H1D(hep.aida.ref.histogram.Cloud1D c1d, int bins)
c1d
- Cloud1D histogram from JAIDAbins
- Number of bins for plotting.public H1D(hep.aida.IHistogram1D h1)
h1
- IHistogram1D histogram from JAIDApublic H1D(String title, H1D h1d)
title
- new titleh1d
- input H1Dpublic H1D(hep.io.root.interfaces.TH1 h1t)
h1t
- TH1 histogram from JAIDApublic void print()
public String toString()
public void toTable()
public void fill(P0D p0d)
p0d
- input P0D arraypublic void fill(int TotNumber, AbstractDistribution random)
TotNumber
- number generated eventsrandom
- generatorpublic void fill(P0I p0i)
p0i
- input P0I arraypublic hep.aida.IAxis getAxis()
public double binCenter(int index)
index
- bin indexpublic double[] binCenters()
public double binLowerEdge(int index)
index
- bin indexpublic double[] binLowerEdges()
public double binUpperEdge(int index)
index
- bin indexpublic double[] binUpperEdges()
public void toFile(String name)
name
- File namepublic void setHeights(double[] values)
values
- array with values in Y (dimension: bins + 2)public void setErrors(double[] errors)
errors
- array with errors in Y (dimension: bins + 2)public void setContents(double[] values, double[] errors)
values
- array with values in Y (dimension: bins + 2)errors
- array with errors on Y (dimension: bins + 2)public void setContents(double[] heights, double[] errors, int[] entries, double[] means, double[] rmss)
heights
- The bins heightserrors
- The bins errorsentries
- The bin entries.means
- The means of the bins.rmss
- The rmss of the binspublic void setMeanAndRms(double mean, double rms)
mean
- mean of the histogramrms
- RMS to be setpublic void setNEntries(int entries)
entries
- Number of entriespublic void setValidEntries(int entries)
entries
- Number of valid entriespublic hep.aida.ref.histogram.Histogram1D get()
public void setMin(double min)
min
- Minimum value of axispublic double getMin()
public void setMax(double max)
max
- Maximum value of axispublic double getMax()
public void setBins(int bins)
bins
- Number of binspublic int getBins()
public double getBinSize()
public double getBinSize(int index)
index
- of this binpublic void shift(double d)
d
- parameter used to shift binspublic boolean isFixedBinning()
public void fill(double value)
value
- Value to be filledpublic void fill(PND pnd)
pnd
- PND used to fill histogrampublic void fill(PND pnd, PND weigths)
pnd
- input valueweigths
- PND with weightspublic void fill(double[] values)
values
- array of double valuespublic void fill(hep.aida.ref.histogram.Cloud1D c1d)
values
- array of double valuespublic void fill(double[] values, double[] weights)
values
- array of double valuesweights
- array of double weightspublic void fill(int[] values)
values
- array of integer valuespublic void fill(double value, double weight)
value
- Value to be filledweight
- Weight of the valuepublic double mean()
public Map<String,Double> getStat()
The key for the output map are: mean, error, rms, variance, stddev etc. Print the keys of this map to get the full access to statistics.
public double rms()
public int allEntries()
public int extraEntries()
public int entries()
public int getUnderflow()
public double getUnderflowHeight()
public double getOverflowlowHeight()
public int getOverflow()
public void fillInvBinSizeWeight(double value)
value
- Value to filled histogram with.public void scale(String title, double scaleFactor)
title
- New titlescaleFactor
- Scale factorpublic H1D operScale(String title, double scaleFactor)
title
- New titlescaleFactor
- Scale factorpublic void scale(double scaleFactor)
scaleFactor
- Scale factorpublic H1D operSmooth(boolean isWeighted, int k)
Each band of the histogram is smoothed by averaging over a moving window of a size specified by the method parameter: if the value of the parameter is k then the width of the window is 2*k + 1. If the window runs off the end of the histogram only those values which intersect the histogram are taken into consideration. The smoothing may optionally be weighted to favor the central value using a "triangular" weighting. For example, for a value of k equal to 2 the central bin would have weight 1/3, the adjacent bins 2/9, and the next adjacent bins 1/9. Errors are kept the same as before.
isWeighted
- Whether bins will be weighted using a triangular weighting
scheme favoring bins near the central bin.k
- The smoothing parameter which must be non-negative. If zero,
the histogram object will be returned with no smoothing
applied.public H1D operSmoothGauss(double standardDeviation)
Each band of the histogram is smoothed by discrete convolution with a kernel approximating a Gaussian impulse response with the specified standard deviation.
standardDeviation
- The standard deviation of the Gaussian smoothing kernel which
must be non-negative or an
IllegalArgumentException
will be thrown. If zero,
the histogram object will be returned with no smoothing
applied.public double getEntropy()
The entropy is defined to be the negation of the sum of the products of the probability associated with each bin with the base-2 log of the probability.
public H1D copy()
public void clear()
public H1D rebin(int ngroup)
ngroup
- indicates how many bins of this have to me merged
into one bin of hnewpublic H1D copy(String newtitle)
newtitle
- New titlepublic H1D scaleErrors(double scale)
scale
- scale factor used to multiply errorspublic int binEntries(int index)
index
- Bin indexpublic int[] binEntries()
public double binError(int index)
index
- Bin indexpublic double binHeight(int index)
index
- Bin indexpublic double[] binHeights()
public double[] binErrors()
public double binMean(int index)
index
- Bin indexpublic double binRms(int index)
index
- Bin indexpublic double maxBinHeight()
public double minBinHeight()
public double sumAllBinHeights()
public double integral()
public int findBin(double x)
x
- coordinate on axispublic double integral(int BinMin, int BinMax, boolean timesBinWidth)
BinMin
- Min index for integration starting from 1 (included to
integration)BinMax
- Max index for integration (start from 1, included to integration)timesBinWidth
- If true, the integral is the sum of
the bin contents multiplied by the bin width in x.public double integral(int BinMin, int BinMax)
BinMin
- Min index for integration starting from 1 (included to
integration)BinMax
- Max index for integration (included to integration)public double integralRegion(double xmin, double xmax, boolean timesBinWidth)
Xmin
- Min index for integrationXmax
- Max index for integrationtimesBinWidth
- if true, multiply by the bin width.public double integralRegion(double xmin, double xmax)
Xmin
- Min index for integrationXmax
- Max index for integrationpublic H1D getProbability()
public H1D getDividedByBinWidth()
public H1D getDensity()
public H1D oper(H1D a, String what)
a
- H1D histogram.what
- String representing the operation: "+" add a histogram to the
original "-" subtract a histogram from the original "*"
multiply "/" dividepublic double[][] getValues(int mode)
mode
- if =1, take center of the bins. In all other cases - mean
value in each binpublic H1D oper(H1D a, String title, String what)
a
- H1D histogram.title
- New Titlepublic String[] getStatParameters()
h1
- histogram H1Dpublic void doc()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics