//*-- Author : M. Sanchez (12/06/2001) //*-- Modified : M. Sanchez (20/06/2001) using namespace std; #include "hsavitzkygolay.h" #include "hludecomposer.h" #include #include "TMath.h" #include #include //_HADES_CLASS_DESCRIPTION //////////////////////////////////////////////////////////////// //HSavitzkyGolay // // Simple class to calculate the Savitzky-Golay coefficients // // Basically the Savitzky-Golay filter consists on doing a fit // of a set of data points to a polinomial of a certain degree and // then use this polinomial to interpolate the data, calculate // derivatives... // // The Savitzky-Golay coefficients allow to make this procedure fast // by converting the process of fitting and evaluating a polinomial at // some point into a linear convolution. // // For more documentation on the Savitzky-Golay filter and its // applications see Numerical Recipes in C. 14.8 ///////////////////////////////////////////////////////////////// HSavitzkyGolay::HSavitzkyGolay(void) { } HSavitzkyGolay::~HSavitzkyGolay(void) { } void HSavitzkyGolay::calcCoefficients(HRtVector &out, Int_t nl,Int_t nr,Int_t ld,Int_t m) { // Stores in vector out the Savitzky-Golay coefficients. // Input // nl: number of points to the left in the fit // nr: number of points to the right in the fit // m: degree of the polinomial // ld: order of the coefficients. 0 for interpoletion, // 1 for differentiation... assert( !(nl<0 || nr<0 || ld>m || nl+nr