30 #define NPOINTS_DEFAULT 129
31 #define NLEFT_DEFAULT 64
32 #define NRIGHT_DEFAULT 64
33 #define POLYORDER_DEFAULT 1
37 using namespace Physics;
60 "The \"FILTER\" statement defines a 1 dimensional filter to be "
61 "applied on histogram."),
64 (
"TYPE",
"Specifies the type of filter: SavitzkyGolay, fixedFFTLowPass, relativeFFTLowPass, Stencil");
67 (
"NFREQ",
"Number of frequencies to use in fixedFFTLowPass filter", 9.);
70 (
"THRESHOLD",
"Relative threshold for amplitude of frequencies in relativeFFTLowPass filter", 1.
e-6);
73 (
"NPOINTS",
"Number of points in Savitzky-Golay filter",
NPOINTS_DEFAULT);
76 (
"NLEFT",
"Number of points to the left in Savitzky-Golay filter",
NLEFT_DEFAULT);
79 (
"NRIGHT",
"Number of points to the right in Savitzky-Golay filter",
NRIGHT_DEFAULT);
82 (
"POLYORDER",
"Polynomial order for local fit-function in Savitzky-Golay filter",
POLYORDER_DEFAULT);
112 return dynamic_cast<OpalFilter *
>(object) != 0;
130 throw OpalException(
"OpalFilter::find()",
"OpalFilter \"" + name +
"\" not found.");
144 *gmsg <<
"* ************* F I L T E R ************************************************************" <<
endl;
145 *gmsg <<
"OpalFilter::initOpalFilterfunction " <<
endl;
146 *gmsg <<
"* **********************************************************************************" <<
endl;
149 if (type ==
"SAVITZKY-GOLAY") {
155 Inform svg(
"Savitzky-Golay: ");
156 if (num_points_left < 0) {
157 svg <<
"Number of points to the left negative; using default (" <<
NLEFT_DEFAULT <<
");" <<
endl;
160 if (num_points_right < 0) {
161 svg <<
"Number of points to the right negative; using default (" <<
NRIGHT_DEFAULT <<
");" <<
endl;
164 if (num_points < num_points_left + num_points_right) {
165 svg <<
"Total number of points small than sum of the ones to the left and to the right plus 1; using default (NLEFT + NRIGHT + 1);" <<
endl;
166 num_points = num_points_left + num_points_right + 1;
168 if (polynomial_order > num_points_left + num_points_right) {
169 svg <<
"Polynomial order bigger than sum of points to the left and to the right; using default (NLEFT + NRIGHT);" <<
endl;
170 polynomial_order = num_points_left + num_points_right;
174 }
else if (type ==
"FIXEDFFTLOWPASS") {
176 }
else if (type ==
"RELATIVEFFTLOWPASS") {
178 }
else if (type ==
"STENCIL") {
182 INFOMSG(
"no filter attached" << endl);
188 os <<
"* ************* F I L T E R ********************************************************\n"
197 <<
"* ********************************************************************************** " <<
std::endl;
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
constexpr double e
The value of .
void print(std::ostream &os) const
Print the object.
void define(Object *newObject)
Define a new object.
The base class for all OPAL definitions.
The base class for all OPAL exceptions.
std::string toUpper(const std::string &str)
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
static OpalData * getInstance()
virtual void update()
Update the OpalFilter data.
const std::string & getOpalName() const
Return object name.
OpalFilter()
Exemplar constructor.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
virtual void execute()
Check the OpalFilter data.
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
Object * find(const std::string &name)
Find entry.
The base class for all OPAL objects.
void setOpalName(const std::string &name)
Set object name.
#define POLYORDER_DEFAULT
static OpalFilter * find(const std::string &name)
Find named FILTER.
bool builtin
Built-in flag.
double getReal(const Attribute &attr)
Return real value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Inform & endl(Inform &inf)
virtual OpalFilter * clone(const std::string &name)
Make clone.
std::string getString(const Attribute &attr)
Get string value.