1 #ifndef __MAX_NORM_RADIALPEAK_H__
2 #define __MAX_NORM_RADIALPEAK_H__
8 #include "boost/type_traits/remove_cv.hpp"
9 #include "boost/variant/get.hpp"
10 #include "boost/variant/variant.hpp"
11 #include "boost/smart_ptr.hpp"
29 static const std::string
name;
32 if (args.size() != 4) {
34 "maxNormRadialPeak expects 4 arguments, " + std::to_string(args.size()) +
" given");
39 begin_ = boost::get<double>(args[2]);
40 end_ = boost::get<double>(args[3]);
45 boost::scoped_ptr<PeakReader> sim_peaks(
new PeakReader(sim_filename_));
47 sim_peaks->parseFile();
48 meas_peaks->parseFile();
50 if ( end_ < begin_ || end_ < 0 || begin_ < 0 )
52 "Error check turn number range");
59 double maximum = -1.0;
61 for (
int turn = begin_; turn < end_ + 1; ++turn) {
62 double sim_value = 0.0, meas_value = 0.0;
64 sim_peaks->getPeak(turn, sim_value);
65 meas_peaks->getPeak(turn, meas_value);
67 std::cout <<
"Exception while getting value "
68 <<
"from peak file: " << e.
what()
72 double val =
std::abs(meas_value - sim_value);
76 return boost::make_tuple(maximum, is_valid);
virtual const char * what() const
boost::tuple< std::string, std::string, int, int > argument_types
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
std::string sim_filename_
constexpr double e
The value of .
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
boost::tuple< double, bool > Result_t
Expressions::Result_t operator()(client::function::arguments_t args)
std::string meas_filename_
std::vector< argument_t > arguments_t
Implements a parser and value extractor for peak files (*.peaks)
static const std::string name
Inform & endl(Inform &inf)