![]() |
Takes in waveforms and averages averages their power spectra. More...
#include <AveragePowerSpectrum.h>
Public Member Functions | |
AveragePowerSpectrum () | |
Constructor. More... | |
AveragePowerSpectrum (TString name, TString title) | |
Constructor. More... | |
~AveragePowerSpectrum () | |
Destructor. | |
size_t | add (TGraph *gr) |
Function for the user to add the voltage/time waveform to all the stored averages. More... | |
TGraph * | makeAvePowSpecTGraph () |
Creates a TGraph of the average power spectrum. | |
TGraph * | makeAvePowSpecTGraph_dB () |
Creates a TGraph of the average power spectrum with a dB scale. | |
void | deleteRayleighDistributions () |
Deletes all the Rayleigh histograms. | |
void | rebinAllRayleighHistograms (Int_t rebinFactor) |
Rebins all the stored Rayleigh distributions. More... | |
void | fitRayleighHistogramOverRange (Int_t freqInd, Double_t xLowVal, Double_t xHighVal, Double_t *rAmplitudes, Double_t *rChiSquares, Int_t *rNdf, Double_t *rChiSquaresFullRange, Int_t *rNdfFullRange) |
Worker function called by all the other fitting functions. More... | |
void | fitRayleighHistogram (Int_t freqInd) |
Fit a Rayleigh histogram. More... | |
void | fitRayleighHistogramRisingEdge (Int_t freqInd) |
Fit a Rayleigh histogram, up to the peak bin. More... | |
void | fitRayleighHistogramRisingEdgeAndHalfFallingEdge (Int_t freqInd) |
Fit a Rayleigh histogram, past the peak up to half the maximum value. More... | |
void | fitAllRayleighHistograms () |
Fits all the Rayeligh distributions. | |
void | fitAllRayleighHistogramsRisingEdge () |
Fits all the Rayeligh distributions, but only up to the peak bin. | |
void | fitAllRayleighHistogramsRisingEdgeAndHalfFallingEdge () |
Fits all the Rayeligh distributions, as far as the bin which is half the value of the peak bin. | |
TH1D * | getRayleighHistogram (Int_t freqInd) |
Get Rayleigh distribution from frequency index. More... | |
TH1D * | getRayleighHistogramFromFrequencyMHz (Double_t freqMHz) |
Get pointer to rayleigh distribution of frequency closest to a particular frequency. More... | |
TF1 * | getRayleighHistogramFit (Int_t freqInd) |
Get Rayleigh fit to Rayleigh distribution from frequency index. More... | |
TH2D * | makeRayleigh2DHistogram () |
Combine all the 1D rayleigh distribution histograms to a 2D histogram. More... | |
void | getEventRayleighAmplitudes (TGraph *gr) |
Converts the stored power spectrum for the events and stores it in internal memory. More... | |
TF1 * | constructFitFromAmplitude (Int_t freqInd, Double_t amplitude) |
Create a Rayleigh fit with a particular Rayleigh amplitude. More... | |
TF1 * | constructFitFromRayleighAmplitude (Int_t freqInd) |
Create a Rayleigh fit with stored Rayleigh amplitude. More... | |
TF1 * | constructFitFromRayleighAmplitudeRisingEdge (Int_t freqInd) |
Create a Rayleigh fit with stored Rayleigh amplitude, fit up to the peak bin. More... | |
TF1 * | constructFitFromRayleighAmplitudeRisingEdgeAndHalfFalling (Int_t freqInd) |
Create a Rayleigh fit with stored Rayleigh amplitude, fit past the peak to half the maximum value. More... | |
ClassDef (AveragePowerSpectrum, 10) | |
ROOT's magic I/O macro. | |
Static Public Member Functions | |
static TF1 * | makeRayleighFunction (TString name, Double_t xMin, Double_t xMax) |
Creates a TF1 with to fit a Rayeligh distribution. More... | |
static TString | getRayleighFunctionText () |
Generates the text that defines the Rayleigh function for TF1. | |
Public Attributes | |
Double_t | deltaFMHz |
Difference between frequency bins in the power spectrums. | |
Double_t | summedPowSpec [NUM_FREQS] |
Sum of all power spectrum. | |
TH1D * | hRayleighs [NUM_FREQS] |
Histograms for Rayleigh distributions. | |
Int_t | count |
Number of waveforms that have been added to the AveragePowerSpectrum. | |
Double_t | rayleighFitChiSquares [NUM_FREQS] |
Chi squares of the Rayleigh fits. | |
Double_t | rayleighFitChiSquaresRisingEdge [NUM_FREQS] |
Chi squares of the fit to the rising egde of the Rayleigh distributions. | |
Double_t | rayleighFitChiSquaresRisingEdgeAndHalfFalling [NUM_FREQS] |
Chi squares of the fit to the leading and half the falling edge of the Rayleigh distributions. | |
Double_t | rayleighAmplitudes [NUM_FREQS] |
Fitted Rayleigh amplitudes. | |
Double_t | rayleighAmplitudesRisingEdge [NUM_FREQS] |
Amplitudes from fits to the leading edge of the Rayleigh distributions. | |
Double_t | rayleighAmplitudesRisingEdgeAndHalfFalling [NUM_FREQS] |
Amplitudes from fits to the leading and half the falling edge of the Rayleigh distributions. | |
Int_t | rayleighNdf [NUM_FREQS] |
NDFs from Rayleigh fits. | |
Int_t | rayleighNdfRisingEdge [NUM_FREQS] |
NDFs from fits to the leading edge of the Rayleigh distributions. | |
Int_t | rayleighNdfRisingEdgeAndHalfFalling [NUM_FREQS] |
NDFs from fits to the leading and half the falling edge of the Rayleigh distributions. | |
Double_t | rayleighFitChiSquaresFullRange [NUM_FREQS] |
Chi squares of the Rayleigh fits extended over the full range. | |
Double_t | rayleighFitChiSquaresRisingEdgeFullRange [NUM_FREQS] |
Chi squares of the fit to the rising egde of the Rayleigh distributions extended over the full range. | |
Double_t | rayleighFitChiSquaresRisingEdgeAndHalfFallingFullRange [NUM_FREQS] |
Amplitudes from fits to the leading and half the falling edge of the Rayleigh distributions extended over the full range. | |
Int_t | rayleighNdfFullRange [NUM_FREQS] |
NDFs from Rayleigh fits extended over the full range. | |
Int_t | rayleighNdfRisingEdgeFullRange [NUM_FREQS] |
NDFs from fits to the leading edge of the Rayleigh distributions extended over the full range. | |
Int_t | rayleighNdfRisingEdgeAndHalfFallingFullRange [NUM_FREQS] |
NDFs from fits to the leading and half the falling edge of the Rayleigh distributions extended over the full range. | |
Double_t | xHigh [NUM_FREQS] |
High end of fitted range of Rayleigh histograms. | |
Double_t | xHighRisingEdge [NUM_FREQS] |
High end of fitted range of Rayleigh histograms up to peak bin. | |
Double_t | xHighRisingEdgeAndHalfFalling [NUM_FREQS] |
High end of fitted range of Rayleigh histograms up to half the maximum value past the peak bin. | |
Double_t | outliers [NUM_FREQS][MAX_NUM_OUTLIERS] |
Used to store values that are much greater than the current Rayliegh histogram content. | |
Int_t | numOutliers [NUM_FREQS] |
Count of number of outliers in outliers array. | |
Double_t | eventRayleighAmplitudes [NUM_FREQS] |
Rayleigh amplitudes for the last added event. | |
Double_t | eventPowSpec [NUM_FREQS] |
Power spectra for the last added event. | |
Takes in waveforms and averages averages their power spectra.
Definition at line 36 of file AveragePowerSpectrum.h.
AveragePowerSpectrum::AveragePowerSpectrum | ( | ) |
AveragePowerSpectrum::AveragePowerSpectrum | ( | TString | name, |
TString | title | ||
) |
Constructor.
name | is the name you want to give this average power spectrum (e.g. channel). |
title | is the title you want to give this average power spectrum, since we inherit from TNamed. |
Definition at line 34 of file AveragePowerSpectrum.cxx.
size_t AveragePowerSpectrum::add | ( | TGraph * | gr | ) |
Function for the user to add the voltage/time waveform to all the stored averages.
gr | is a TGraph containing the voltage/time waveform. |
This function stores the average power spectrum and rayleigh amplitudes in interal memory.
Definition at line 172 of file AveragePowerSpectrum.cxx.
TF1 * AveragePowerSpectrum::constructFitFromAmplitude | ( | Int_t | freqInd, |
Double_t | amplitude | ||
) |
Create a Rayleigh fit with a particular Rayleigh amplitude.
freqInd | is the bin of the frequency bin. |
amplitude | is the rayleigh amplitude. |
Limits on the fit come from the histogram.
Definition at line 413 of file AveragePowerSpectrum.cxx.
TF1 * AveragePowerSpectrum::constructFitFromRayleighAmplitude | ( | Int_t | freqInd | ) |
Create a Rayleigh fit with stored Rayleigh amplitude.
freqInd | is the bin of the frequency bin. |
Limits on the fit come from the histogram. The amplitude comes from the stored internal numbers.
Definition at line 437 of file AveragePowerSpectrum.cxx.
TF1 * AveragePowerSpectrum::constructFitFromRayleighAmplitudeRisingEdge | ( | Int_t | freqInd | ) |
Create a Rayleigh fit with stored Rayleigh amplitude, fit up to the peak bin.
freqInd | is the bin of the frequency bin. |
Limits on the fit come from the histogram. The amplitude comes from the stored internal numbers.
Definition at line 455 of file AveragePowerSpectrum.cxx.
TF1 * AveragePowerSpectrum::constructFitFromRayleighAmplitudeRisingEdgeAndHalfFalling | ( | Int_t | freqInd | ) |
Create a Rayleigh fit with stored Rayleigh amplitude, fit past the peak to half the maximum value.
freqInd | is the bin of the frequency bin. |
Limits on the fit come from the histogram. The amplitude comes from the stored internal numbers.
Definition at line 473 of file AveragePowerSpectrum.cxx.
void AveragePowerSpectrum::fitRayleighHistogram | ( | Int_t | freqInd | ) |
Fit a Rayleigh histogram.
freqInd | is the bin of the frequency bin. |
Definition at line 487 of file AveragePowerSpectrum.cxx.
void AveragePowerSpectrum::fitRayleighHistogramOverRange | ( | Int_t | freqInd, |
Double_t | xLowVal, | ||
Double_t | xHighVal, | ||
Double_t * | rAmplitudes, | ||
Double_t * | rChiSquares, | ||
Int_t * | rNdf, | ||
Double_t * | rChiSquaresFullRange, | ||
Int_t * | rNdfFullRange | ||
) |
Worker function called by all the other fitting functions.
freqInd | is the bin of the frequency bin. |
xLowVal | is the low range of the fit. |
xHighVal | is the high range of the fit. |
rAmplitudes | is a pointer to stored amptlitude array. |
rChiSquares | is a pointer to stored chi square array. |
rNdf | is a pointer to stored NDF array. |
rChiSquaresFullRange | is a pointer to stored chi square, over the whole range even if this is larger than the fitted range. |
rNdfFullRange | is a pointer to stored NDF, over the whole range even if this is larger than the fitted range. |
Definition at line 581 of file AveragePowerSpectrum.cxx.
void AveragePowerSpectrum::fitRayleighHistogramRisingEdge | ( | Int_t | freqInd | ) |
Fit a Rayleigh histogram, up to the peak bin.
freqInd | is the bin of the frequency bin. |
Definition at line 511 of file AveragePowerSpectrum.cxx.
void AveragePowerSpectrum::fitRayleighHistogramRisingEdgeAndHalfFallingEdge | ( | Int_t | freqInd | ) |
Fit a Rayleigh histogram, past the peak up to half the maximum value.
freqInd | is the bin of the frequency bin. |
Definition at line 537 of file AveragePowerSpectrum.cxx.
void AveragePowerSpectrum::getEventRayleighAmplitudes | ( | TGraph * | gr | ) |
Converts the stored power spectrum for the events and stores it in internal memory.
gr | is a TGraph containing the voltage/time waveform |
Definition at line 144 of file AveragePowerSpectrum.cxx.
TH1D * AveragePowerSpectrum::getRayleighHistogram | ( | Int_t | freqInd | ) |
Get Rayleigh distribution from frequency index.
freqInd | is the index of the frequency bin. |
Definition at line 285 of file AveragePowerSpectrum.cxx.
TF1 * AveragePowerSpectrum::getRayleighHistogramFit | ( | Int_t | freqInd | ) |
Get Rayleigh fit to Rayleigh distribution from frequency index.
freqInd | is the index of the frequency bin. |
Definition at line 300 of file AveragePowerSpectrum.cxx.
TH1D * AveragePowerSpectrum::getRayleighHistogramFromFrequencyMHz | ( | Double_t | freqMHz | ) |
Get pointer to rayleigh distribution of frequency closest to a particular frequency.
freqMHz | is the chosen frequency in MHz. |
Definition at line 260 of file AveragePowerSpectrum.cxx.
TH2D * AveragePowerSpectrum::makeRayleigh2DHistogram | ( | ) |
Combine all the 1D rayleigh distribution histograms to a 2D histogram.
Definition at line 318 of file AveragePowerSpectrum.cxx.
|
static |
Creates a TF1 with to fit a Rayeligh distribution.
name | is the name for the TF1, use to identify the frequency bin. |
xMin | is the low edge of the fit range. |
xMax | is the high edge of the fit range. |
Definition at line 129 of file AveragePowerSpectrum.cxx.
void AveragePowerSpectrum::rebinAllRayleighHistograms | ( | Int_t | rebinFactor | ) |
Rebins all the stored Rayleigh distributions.
rebinFactor | is the factor to reduce the number of bins in the histogram by. |
Definition at line 242 of file AveragePowerSpectrum.cxx.