9 #ifndef AVERAGEPOWERSPECTRUM_H 10 #define AVERAGEPOWERSPECTRUM_H 18 #include "FancyFFTs.h" 19 #include "RootTools.h" 20 #include "CrossCorrelator.h" 22 #define NUM_AMPLITUDE_BINS 64 23 #define INITIAL_MAX_AMPLITUDE 4 24 #define INITIAL_MIN_AMPLITUDE 0 26 #define MAX_NUM_OUTLIERS 10 29 #define NUM_FREQS ((NUM_SAMPLES/2)+1) 44 size_t add(TGraph* gr);
54 Double_t* rAmplitudes,
55 Double_t* rChiSquares,
57 Double_t* rChiSquaresFullRange,
58 Int_t* rNdfFullRange);
TH1D * getRayleighHistogramFromFrequencyMHz(Double_t freqMHz)
Get pointer to rayleigh distribution of frequency closest to a particular frequency.
void fitAllRayleighHistograms()
Fits all the Rayeligh distributions.
ClassDef(AveragePowerSpectrum, 10)
ROOT's magic I/O macro.
static TString getRayleighFunctionText()
Generates the text that defines the Rayleigh function for TF1.
Int_t count
Number of waveforms that have been added to the AveragePowerSpectrum.
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.
Double_t rayleighAmplitudesRisingEdge[NUM_FREQS]
Amplitudes from fits to the leading edge of the Rayleigh distributions.
Double_t rayleighFitChiSquares[NUM_FREQS]
Chi squares of the Rayleigh fits.
TF1 * constructFitFromAmplitude(Int_t freqInd, Double_t amplitude)
Create a Rayleigh fit with a particular Rayleigh amplitude.
void rebinAllRayleighHistograms(Int_t rebinFactor)
Rebins all the stored Rayleigh distributions.
Double_t rayleighFitChiSquaresRisingEdge[NUM_FREQS]
Chi squares of the fit to the rising egde of the Rayleigh distributions.
Int_t rayleighNdfFullRange[NUM_FREQS]
NDFs from Rayleigh fits extended over the full range.
static TF1 * makeRayleighFunction(TString name, Double_t xMin, Double_t xMax)
Creates a TF1 with to fit a Rayeligh distribution.
Double_t rayleighAmplitudes[NUM_FREQS]
Fitted Rayleigh amplitudes.
Int_t rayleighNdfRisingEdgeAndHalfFalling[NUM_FREQS]
NDFs from fits to the leading and half the falling edge of the Rayleigh distributions.
Double_t summedPowSpec[NUM_FREQS]
Sum of all power spectrum.
TF1 * getRayleighHistogramFit(Int_t freqInd)
Get Rayleigh fit to Rayleigh distribution from frequency index.
Double_t eventPowSpec[NUM_FREQS]
Power spectra for the last added event.
size_t add(TGraph *gr)
Function for the user to add the voltage/time waveform to all the stored averages.
void fitRayleighHistogramRisingEdge(Int_t freqInd)
Fit a Rayleigh histogram, up to the peak bin.
Double_t rayleighAmplitudesRisingEdgeAndHalfFalling[NUM_FREQS]
Amplitudes from fits to the leading and half the falling edge of the Rayleigh distributions.
Double_t deltaFMHz
Difference between frequency bins in the power spectrums.
~AveragePowerSpectrum()
Destructor.
void fitAllRayleighHistogramsRisingEdgeAndHalfFallingEdge()
Fits all the Rayeligh distributions, as far as the bin which is half the value of the peak bin...
Double_t xHigh[NUM_FREQS]
High end of fitted range of Rayleigh histograms.
void deleteRayleighDistributions()
Deletes all the Rayleigh histograms.
TH1D * getRayleighHistogram(Int_t freqInd)
Get Rayleigh distribution from frequency index.
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.
TF1 * constructFitFromRayleighAmplitudeRisingEdge(Int_t freqInd)
Create a Rayleigh fit with stored Rayleigh amplitude, fit up to the peak bin.
TF1 * constructFitFromRayleighAmplitudeRisingEdgeAndHalfFalling(Int_t freqInd)
Create a Rayleigh fit with stored Rayleigh amplitude, fit past the peak to half the maximum value...
AveragePowerSpectrum()
Constructor.
Int_t rayleighNdfRisingEdge[NUM_FREQS]
NDFs from fits to the leading edge of the Rayleigh distributions.
void fitRayleighHistogramRisingEdgeAndHalfFallingEdge(Int_t freqInd)
Fit a Rayleigh histogram, past the peak up to half the maximum value.
TF1 * constructFitFromRayleighAmplitude(Int_t freqInd)
Create a Rayleigh fit with stored Rayleigh amplitude.
Double_t outliers[NUM_FREQS][MAX_NUM_OUTLIERS]
Used to store values that are much greater than the current Rayliegh histogram content.
Double_t xHighRisingEdgeAndHalfFalling[NUM_FREQS]
High end of fitted range of Rayleigh histograms up to half the maximum value past the peak bin...
void fitRayleighHistogram(Int_t freqInd)
Fit a Rayleigh histogram.
Double_t xHighRisingEdge[NUM_FREQS]
High end of fitted range of Rayleigh histograms up to peak bin.
TH2D * makeRayleigh2DHistogram()
Combine all the 1D rayleigh distribution histograms to a 2D histogram.
Double_t eventRayleighAmplitudes[NUM_FREQS]
Rayleigh amplitudes for the last added event.
Double_t rayleighFitChiSquaresRisingEdgeAndHalfFallingFullRange[NUM_FREQS]
Amplitudes from fits to the leading and half the falling edge of the Rayleigh distributions extended ...
Takes in waveforms and averages averages their power spectra.
Int_t rayleighNdfRisingEdgeAndHalfFallingFullRange[NUM_FREQS]
NDFs from fits to the leading and half the falling edge of the Rayleigh distributions extended over t...
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 rayleighFitChiSquaresFullRange[NUM_FREQS]
Chi squares of the Rayleigh fits extended over the full range.
void getEventRayleighAmplitudes(TGraph *gr)
Converts the stored power spectrum for the events and stores it in internal memory.
Double_t rayleighFitChiSquaresRisingEdgeAndHalfFalling[NUM_FREQS]
Chi squares of the fit to the leading and half the falling edge of the Rayleigh distributions.
Int_t rayleighNdfRisingEdgeFullRange[NUM_FREQS]
NDFs from fits to the leading edge of the Rayleigh distributions extended over the full range...
Int_t rayleighNdf[NUM_FREQS]
NDFs from Rayleigh fits.
void fitAllRayleighHistogramsRisingEdge()
Fits all the Rayeligh distributions, but only up to the peak bin.
Int_t numOutliers[NUM_FREQS]
Count of number of outliers in outliers array.
TH1D * hRayleighs[NUM_FREQS]
Histograms for Rayleigh distributions.