npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
WeightTableFilter1DBuilder.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_WEIGHTTABLEFILTER1DBUILDER_HH_
2 #define NPSTAT_WEIGHTTABLEFILTER1DBUILDER_HH_
3 
4 /*!
5 // \file WeightTableFilter1DBuilder.hh
6 //
7 // \brief Build local polynomial filters using scanned tables of values
8 //
9 // The filters are intended for use with the "LocalPolyFilter1D" class.
10 // Boundary is handled by simple truncation of the weight.
11 //
12 // Author: I. Volobouev
13 //
14 // November 2009
15 */
16 
18 
19 namespace npstat {
20  /**
21  // This class will construct a local polynomial filter out of
22  // an arbitrary sampled even weight function.
23  */
25  {
26  public:
27  /**
28  // The constructor arguments are as follows:
29  //
30  // weight -- Tabulated weight function, in equidistant
31  // steps, in the order of increasing x.
32  // The first value corresponds to x = 0,
33  // the second to x + step, etc. The weight
34  // is assumed to be symmetric around 0.
35  //
36  // weightLen -- The length of the "weight" array.
37  //
38  // exclusionMask -- Set values of "exclusionMask" != 0 if
39  // corresponding data points have to be
40  // excluded when weights are generated.
41  // If no exclusions are necessary, just
42  // leave this array as NULL.
43  //
44  // exclusionMaskLen -- Length of the "exclusionMask" array. If
45  // it is not 0 then it must coinside with
46  // the "datalen" argument given to all future
47  // invocations of the "makeFilter" method.
48  //
49  // excludeCentralPoint -- If "true", the central point of the
50  // weight will be set to zero. This can be
51  // useful for certain types of cross validation
52  // calculations.
53  */
54  WeightTableFilter1DBuilder(const double* weight, unsigned weightLen,
55  const unsigned char* exclusionMask = 0,
56  unsigned exclusionMaskLen = 0,
57  bool excludeCentralPoint = false);
58 
59  inline virtual ~WeightTableFilter1DBuilder() {}
60 
61  inline virtual unsigned centralWeightLength() const {return w_.size();}
62 
63  inline virtual bool keepAllFilters() const
64  {return !exclusionMask_.empty();}
65 
66  virtual OrthoPoly1D* makeOrthoPoly(unsigned maxDegree,
67  unsigned binnum,
68  unsigned datalen,
69  unsigned* filterCenter) const;
70  private:
72 
73  std::vector<double> w_;
74  mutable std::vector<double> wexcl_;
75  std::vector<unsigned char> exclusionMask_;
76  };
77 
78  /**
79  // This class will construct a filter which does not smooth the input.
80  // Such a filter is sometimes useful for testing purposes.
81  */
83  {
84  public:
86 
87  inline virtual ~NonmodifyingFilter1DBuilder() {}
88 
89  virtual OrthoPoly1D* makeOrthoPoly(unsigned maxDegree,
90  unsigned binnum,
91  unsigned datalen,
92  unsigned* filterCenter) const;
93  };
94 }
95 
96 #endif // NPSTAT_WEIGHTTABLEFILTER1DBUILDER_HH_
Abstract interface for building local polynomial filter weights in 1-d.
Definition: WeightTableFilter1DBuilder.hh:83
virtual OrthoPoly1D * makeOrthoPoly(unsigned maxDegree, unsigned binnum, unsigned datalen, unsigned *filterCenter) const
Definition: OrthoPoly1D.hh:29
Definition: WeightTableFilter1DBuilder.hh:25
WeightTableFilter1DBuilder(const double *weight, unsigned weightLen, const unsigned char *exclusionMask=0, unsigned exclusionMaskLen=0, bool excludeCentralPoint=false)
virtual unsigned centralWeightLength() const
Definition: WeightTableFilter1DBuilder.hh:61
virtual OrthoPoly1D * makeOrthoPoly(unsigned maxDegree, unsigned binnum, unsigned datalen, unsigned *filterCenter) const
virtual bool keepAllFilters() const
Definition: WeightTableFilter1DBuilder.hh:63
Definition: AbsArrayProjector.hh:14
Definition: AbsFilter1DBuilder.hh:129