1 #ifndef __SUMERRSQRADIALPEAK_H__
2 #define __SUMERRSQRADIALPEAK_H__
6 #include "boost/type_traits/remove_cv.hpp"
7 #include "boost/variant/get.hpp"
8 #include "boost/variant/variant.hpp"
9 #include "boost/smart_ptr.hpp"
27 static const std::string
name;
30 if (args.size() != 4) {
32 "sumErrSqRadialPeak expects 4 arguments, " + std::to_string(args.size()) +
" given");
37 begin_ = boost::get<double>(args[2]);
38 end_ = boost::get<double>(args[3]);
43 boost::scoped_ptr<PeakReader> sim_peaks(
new PeakReader(sim_filename_));
45 sim_peaks->parseFile();
46 meas_peaks->parseFile();
48 if ( end_ < begin_ || end_ < 0 || begin_ < 0 )
50 "Error check turn number range");
58 int nPeaks = end_ - begin_ + 1;
60 for (
int turn = begin_; turn < end_ + 1; ++turn) {
61 double sim_value = 0.0, meas_value = 0.0;
63 sim_peaks->getPeak(turn, sim_value);
64 meas_peaks->getPeak(turn, meas_value);
66 std::cout <<
"Exception while getting value "
67 <<
"from peak file: " << e.
what()
71 double val = meas_value - sim_value;
75 return boost::make_tuple(
std::sqrt(sum) / (
double)nPeaks, is_valid);
virtual const char * what() const
constexpr double e
The value of .
Expressions::Result_t operator()(client::function::arguments_t args)
std::string sim_filename_
T::PETE_Expr_t::PETE_Return_t sum(const PETE_Expr< T > &expr)
boost::tuple< double, bool > Result_t
static const std::string name
std::string meas_filename_
std::vector< argument_t > arguments_t
Implements a parser and value extractor for peak files (*.peaks)
Tps< T > sqrt(const Tps< T > &x)
Square root.
boost::tuple< std::string, std::string, int, int > argument_types
Inform & endl(Inform &inf)