8 #define FFTTOOLS_ALLOCATE_CONTIGUOUS 31 #include "Math/Interpolator.h" 32 #include "Math/InterpolationTypes.h" 34 #ifdef FFTTOOLS_COMPAT_MODE 35 #define FFTTOOLS_METHOD static 37 #define FFTTOOLS_METHOD 38 #include "FFTWindow.h" 43 #include "FFTWComplex.h" 76 #ifdef FFTTOOLS_COMPAT_MODE 84 #ifdef FFTTOOLS_COMPAT_MODE 94 FFTTOOLS_METHOD TGraph *getInterpolatedGraph(
const TGraph *grIn, Double_t deltaT);
110 FFTTOOLS_METHOD TGraph *
getConvolution(
const TGraph *grA,
const TGraph *grB);
132 FFTTOOLS_METHOD
double *doInvFFT(
int length,
const FFTWComplex *theInput);
139 FFTTOOLS_METHOD
FFTWComplex *doFFT(
int length,
const double *theInput);
144 FFTTOOLS_METHOD
void doFFT(
int length,
const double * properly_aligned_input,
FFTWComplex * properly_aligned_output);
147 FFTTOOLS_METHOD
void doInvFFTClobber(
int length,
FFTWComplex * properly_aligned_input_that_will_likely_be_clobbered,
double * properly_aligned_output);
174 FFTTOOLS_METHOD
double *
getCorrelation(
const TGraph *gr1,
const TGraph *gr2,
int firstIndex,
int lastIndex);
182 FFTTOOLS_METHOD
double *
getCorrelation(
int length,
const float *oldY1,
const float *oldY2);
190 FFTTOOLS_METHOD
double *
getCorrelation(
int length,
const double *oldY1,
const double *oldY2);
234 FFTTOOLS_METHOD Double_t *
combineValuesUsingFFTs(Int_t numArrays, Double_t **thePtrPtr, Int_t eachLength);
282 FFTTOOLS_METHOD TGraph *makePowerSpectrumMilliVoltsNanoSecondsdB(
const TGraph *grWave);
311 FFTTOOLS_METHOD TGraph *
getCorrelationGraph(
const TGraph *gr1,
const TGraph *gr2, Int_t *zeroOffset=0);
356 FFTTOOLS_METHOD TGraph *
combineGraphsUsingFFTs(Int_t numGraphs, TGraph **grPtr,
const double *theWeights=0);
364 FFTTOOLS_METHOD TGraph *
getBoxCar(
const TGraph *grWave, Int_t halfWidth);
393 FFTTOOLS_METHOD Double_t
sumPower(
const TGraph *gr,Int_t firstBin=-1,Int_t lastBin=-1);
401 FFTTOOLS_METHOD Double_t
integratePower(
const TGraph *gr,Int_t firstBin=-1,Int_t lastBin=-1);
409 FFTTOOLS_METHOD Double_t
sumVoltageSquared(
const TGraph *gr,Int_t firstBin,Int_t lastBin);
423 FFTTOOLS_METHOD Int_t
getPeakBin(
const TGraph *gr);
431 FFTTOOLS_METHOD Int_t
getPeakBin(
const TGraph *gr, Int_t firstBin, Int_t lastBin);
444 FFTTOOLS_METHOD Double_t
getPeakVal(
const TGraph *gr,
int *index=0);
453 FFTTOOLS_METHOD Double_t
getPeakVal(
const TGraph *gr, Int_t firstBin, Int_t lastBin,
int *index=0);
461 FFTTOOLS_METHOD Double_t
getPeakSqVal(
const TGraph *gr,
int *index=0);
469 FFTTOOLS_METHOD
void getPeakRmsSqVal(
const TGraph *gr, Double_t &peak, Double_t &rms, Int_t *index=0);
478 FFTTOOLS_METHOD
void getPeakRmsRectified(
const TGraph *gr, Double_t &peak, Double_t &rms, Int_t *index=0);
493 FFTTOOLS_METHOD TGraph *
smoothFFT(
const TGraph *gr,Int_t factor) ;
500 FFTTOOLS_METHOD TGraph *
subtractGraphs(
const TGraph *grA,
const TGraph *grB);
507 FFTTOOLS_METHOD TGraph *
divideGraphs(
const TGraph *grA,
const TGraph *grB);
516 FFTTOOLS_METHOD TGraph *
translateGraph(
const TGraph *grWave,
const Double_t deltaT);
531 FFTTOOLS_METHOD TGraph *
dbGraphs(
const TGraph *grA,
const TGraph *grB);
538 FFTTOOLS_METHOD TGraph *
padWave(
const TGraph *grA, Int_t padFactor);
545 FFTTOOLS_METHOD TGraph *
padWaveToLength(
const TGraph *grA, Int_t newLength);
552 FFTTOOLS_METHOD TGraph *
rectifyWave(
const TGraph *gr, Int_t makeNeg=0);
568 FFTTOOLS_METHOD Double_t
welchWindow(Int_t j, Int_t n);
580 FFTTOOLS_METHOD
void takeDerivative(Int_t numPoints,
const Double_t *inputX,
const Double_t *inputY, Double_t *outputX, Double_t *outputY);
602 FFTTOOLS_METHOD TGraph *
simplePassBandFilter(
const TGraph *grWave, Double_t minFreq, Double_t maxFreq);
611 FFTTOOLS_METHOD TGraph *
simpleNotchFilter(
const TGraph *grWave, Double_t minFreq, Double_t maxFreq);
622 FFTTOOLS_METHOD TGraph *
multipleSimpleNotchFilters(
const TGraph *grWave, Int_t numNotches,
const Double_t minFreq[],
const Double_t maxFreq[]);
631 FFTTOOLS_METHOD TGraph *
cropWave(
const TGraph *grWave, Double_t minTime, Double_t maxTime);
647 FFTTOOLS_METHOD Double_t
getWaveformSNR(
const TGraph *gr,Double_t &peakToPeak,Double_t &rms);
655 FFTTOOLS_METHOD Double_t getEnvelopeSNR(
const TGraph *gr);
656 FFTTOOLS_METHOD Double_t getEnvelopeSNR(
const TGraph *gr,Double_t &peakToPeak,Double_t &rms,Double_t &timeOfPeak);
668 FFTTOOLS_METHOD Double_t
simpleInterploate(Double_t x1, Double_t y1, Double_t x2, Double_t y2,Double_t x);
676 int min_i = 0,
int max_i =0,
int order=1);
685 FFTTOOLS_METHOD
void rotate(TGraph * g,
int rot);
688 FFTTOOLS_METHOD
void polySubtract(TGraph *g,
int order=1);
703 FFTTOOLS_METHOD
double * directConvolve(
int N,
const double *x,
int M,
const double * h,
double *y = 0,
int delay = 0, DirectConvolveEdgeBehavior edge_behavior = ZEROES_OUTSIDE);
707 FFTTOOLS_METHOD
void wrap(
size_t N,
double * vals,
double period = 360);
710 FFTTOOLS_METHOD
void wrap(
size_t N,
double * vals,
double period,
double center);
713 FFTTOOLS_METHOD
void wrap(
size_t N,
float * vals,
float period,
float center);
716 FFTTOOLS_METHOD
void wrap(
size_t N,
float * vals,
float period = 360);
721 FFTTOOLS_METHOD
inline int fast_floor(
double val) {
return (
int) val - (val < (int) val); }
728 FFTTOOLS_METHOD
inline double wrap(
double val,
double period,
double center)
729 {
return val - period *
fast_floor((val-center+period/2)/period); }
732 FFTTOOLS_METHOD
inline double wrap(
double val,
double period = 360)
733 {
return wrap(val,period,period/2); }
737 FFTTOOLS_METHOD
void unwrap(
size_t N,
double * vals,
double period = 360);
741 FFTTOOLS_METHOD
void unwrap(
size_t N,
float * vals,
float period = 360);
745 FFTTOOLS_METHOD
double getDt(
const TGraph * g,
int realN = 0);
748 FFTTOOLS_METHOD
double evalEvenGraph(
const TGraph * g,
double x);
752 #ifndef FFTTOOLS_COMPAT_MODE 754 void applyWindow(TGraph *g,
const FFTWindowType *w);
759 FFTTOOLS_METHOD
double randomRayleigh(
double sigma=1, TRandom * rng = 0);
762 FFTTOOLS_METHOD
double sinc(
double x,
double eps = 0);
764 FFTTOOLS_METHOD
int loadWisdom(
const char * file);
765 FFTTOOLS_METHOD
int saveWisdom(
const char * file);
767 #ifndef FFTTOOLS_COMPAT_MODE 780 TGraph * welchPeriodogram(
const TGraph * gin,
int segment_size,
double overlap_fraction = 0.5,
const FFTWindowType * window = &GAUSSIAN_WINDOW ,
bool truncate_extra =
true, TGraph * gout = 0);
786 FFTTOOLS_METHOD
double * lombScarglePeriodogramSlow(
int N,
const double *x,
const double * y,
int nfreqs,
const double * freqs,
double * answer = 0);
789 FFTTOOLS_METHOD TGraph * lombScarglePeriodogram(
const TGraph * g,
double dt = 0,
double oversample_factor = 4 ,
790 double high_factor = 2, TGraph * replaceme = 0,
int extirpolation_factor =4) ;
791 FFTTOOLS_METHOD TGraph * lombScarglePeriodogram(
int N,
double dt,
const double * __restrict x,
792 const double * __restrict y,
double oversample_factor = 4 ,
793 double high_factor = 2, TGraph * replaceme = 0,
int extirpolation_factor = 4) ;
820 FFTTOOLS_METHOD
void stokesParameters(
int N,
const double * hpol,
const double * hpol_hat,
const double * vpol,
const double * vpol_hat,
821 double * Iavg = 0,
double * Qavg = 0,
double * Uavg = 0,
double * Vavg = 0,
822 double * Iins = 0,
double * Qins = 0,
double * Uins = 0,
double * Vins = 0 ,
823 bool only_max_instantaneous =
true );
838 FFTTOOLS_METHOD
void dftAtFreq(
const TGraph * g,
double freq,
double * phase,
double * amp = 0,
double * real = 0,
double * imag = 0);
851 FFTTOOLS_METHOD
void dftAtFreqAndMultiples(
const TGraph * g,
double freq,
int nmultiples,
double * phase,
double * amp = 0,
double * real = 0,
double * imag = 0);
861 FFTTOOLS_METHOD
FFTWComplex * makeMinimumPhase(
int N,
const double * G,
double mindb = -100);
870 FFTTOOLS_METHOD TGraph * makeMinimumPhase(
const TGraph *g,
double mindb=-100);
879 FFTTOOLS_METHOD TGraph * makeFixedDelay(
const TGraph *g,
double delay = 1);
885 FFTTOOLS_METHOD
double checkCausality(
int N,
const FFTWComplex * signal) ;
899 FFTTOOLS_METHOD
double * rmsEnvelope(
int N,
double W,
const double * x,
const double * y,
double * out = 0);
911 FFTTOOLS_METHOD
double * peakEnvelope(
int N,
double min_distance,
const double * x,
const double *y,
double * out = 0);
912 #ifdef FFTTOOLS_COMPAT_MODE
This is a wrapper class for an RF Signal.
This is a wrapper class for a complex number.