Page MenuHomeHEPForge

AbsFilter1DBuilder.hh
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

AbsFilter1DBuilder.hh

#ifndef NPSTAT_ABSFILTER1DBUILDER_HH_
#define NPSTAT_ABSFILTER1DBUILDER_HH_
/*!
// \file AbsFilter1DBuilder.hh
//
// \brief Abstract interface for building local polynomial filter weights in 1-d
//
// Author: I. Volobouev
//
// November 2009
*/
#include <vector>
#include "geners/ClassId.hh"
namespace npstat {
class OrthoPoly1D;
/**
// Besides providing a table of weights, the filter should remember
// for which point it was constructed (this info can potentially be
// used in subsequent cross-validation calculations)
*/
class PolyFilter1D : public std::vector<long double>
{
public:
inline explicit PolyFilter1D(const unsigned peak) : peak_(peak) {}
inline unsigned peakPosition() const {return peak_;}
inline bool operator==(const PolyFilter1D& r) const
{return peak_ == r.peak_ &&
static_cast<const std::vector<long double>&>(*this) ==
static_cast<const std::vector<long double>&>(r);}
inline bool operator!=(const PolyFilter1D& r) const
{return !(*this == r);}
// Methods needed for I/O
inline gs::ClassId classId() const {return gs::ClassId(*this);}
bool write(std::ostream& os) const;
static inline const char* classname() {return "npstat::PolyFilter1D";}
static inline unsigned version() {return 1;}
static PolyFilter1D* read(const gs::ClassId& id, std::istream& in);
private:
PolyFilter1D();
unsigned peak_;
};
/**
// Abstract interface class for building local polynomial filter
// weights in 1-d
*/
struct AbsFilter1DBuilder
{
inline virtual ~AbsFilter1DBuilder() {}
/**
// Length of the filter constructed at a point deeply inside
// the density support region
*/
virtual unsigned centralWeightLength() const = 0;
/**
// Should we keep all filters or can we assume that
// filters deeply inside the density support region
// are identical?
*/
virtual bool keepAllFilters() const = 0;
/**
// Build the filter from the given taper function, maximum
// polynomial degree, bin number for which this filter is
// constructed, and expected length of the data. The filter
// is constructed on the heap and later must be deleted.
*/
virtual PolyFilter1D* makeFilter(const double* taper,
unsigned maxDegree,
unsigned binnum,
unsigned datalen) const = 0;
};
/**
// Abstract interface class for building local polynomial filter
// weights in 1-d via orthogonal polynomial systems
*/
struct OrthoPolyFilter1DBuilder : public AbsFilter1DBuilder
{
inline virtual ~OrthoPolyFilter1DBuilder() {}
/** Implemented from the base */
virtual PolyFilter1D* makeFilter(const double* taper,
unsigned maxDegree,
unsigned binnum,
unsigned datalen) const;
/**
// Build the orthogonal polynomial system that can later
// be used to construct filters with different tapers.
// This is constructed on the heap and later must be deleted.
*/
virtual OrthoPoly1D* makeOrthoPoly(unsigned maxDegree,
unsigned binnum,
unsigned datalen,
unsigned* filterCenter) const = 0;
};
}
#endif // NPSTAT_ABSFILTER1DBUILDER_HH_

File Metadata

Mime Type
text/x-c
Expires
Tue, Sep 30, 5:48 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6560156
Default Alt Text
AbsFilter1DBuilder.hh (3 KB)

Event Timeline