Classes | Functions
stan::test::unit Namespace Reference

Classes

class  instrumented_interrupt
 
class  instrumented_logger
 
class  instrumented_writer
 

Functions

double stod (const std::string &val)
 
void check_adaptation (const size_t &num_params, const std::vector< double > &param_vals, stan::test::unit::instrumented_writer &report, const double &err_margin)
 
void check_adaptation (const size_t &num_rows, const size_t &num_cols, const std::vector< double > &param_vals, stan::test::unit::instrumented_writer &report, const double &err_margin)
 
void check_different (const size_t &num_params, const std::vector< double > &param_vals, stan::test::unit::instrumented_writer &report, const double &margin)
 
void check_different (const size_t &num_rows, const size_t &num_cols, const std::vector< double > &param_vals, stan::test::unit::instrumented_writer &report, const double &margin)
 

Function Documentation

void stan::test::unit::check_adaptation ( const size_t &  num_params,
const std::vector< double > &  param_vals,
stan::test::unit::instrumented_writer report,
const double &  err_margin 
)

Definition at line 22 of file check_adaptation.hpp.

References MECModelEnuComparisons::i, PandAna.reco_validation.add_data::offset, split(), stod(), and stan::test::unit::instrumented_writer::string_values().

Referenced by TEST_F().

25  {
26  std::vector<std::string> param_strings = report.string_values();
27  size_t offset = 0;
28  for (size_t i = 0; i < param_strings.size(); i++) {
29  offset++;
30  if (param_strings[i].find("lements of inverse mass matrix:")
31  != std::string::npos) {
32  break;
33  }
34  }
35  std::vector<std::string> strs;
36  boost::split(strs, param_strings[offset], boost::is_any_of(", "),
37  boost::token_compress_on);
38  EXPECT_EQ(num_params, strs.size());
39  for (size_t i = 0; i < num_params; i++) {
40  ASSERT_NEAR(param_vals[i], test::unit::stod(strs[i]), err_margin);
41  }
42  }
void split(double tt, double *fr)
double stod(const std::string &val)
void stan::test::unit::check_adaptation ( const size_t &  num_rows,
const size_t &  num_cols,
const std::vector< double > &  param_vals,
stan::test::unit::instrumented_writer report,
const double &  err_margin 
)

Definition at line 44 of file check_adaptation.hpp.

References MECModelEnuComparisons::i, calib::j, PandAna.reco_validation.add_data::offset, split(), stod(), and stan::test::unit::instrumented_writer::string_values().

47  {
48  std::vector<std::string> param_strings = report.string_values();
49  size_t offset = 0;
50  for (size_t i = 0; i < param_strings.size(); i++) {
51  offset++;
52  if (param_strings[i].find("lements of inverse mass matrix:")
53  != std::string::npos) {
54  break;
55  }
56  }
57  for (size_t i = 0, ij = 0; i < num_rows; i++) {
58  std::vector<std::string> strs;
59  boost::split(strs, param_strings[offset+i], boost::is_any_of(", "),
60  boost::token_compress_on);
61  EXPECT_EQ(num_cols, strs.size());
62  for (size_t j = 0; j < num_cols; j++, ij++) {
63  ASSERT_NEAR(param_vals[ij], test::unit::stod(strs[j]), err_margin);
64  }
65  }
66  }
void split(double tt, double *fr)
double stod(const std::string &val)
const double j
Definition: BetheBloch.cxx:29
void stan::test::unit::check_different ( const size_t &  num_params,
const std::vector< double > &  param_vals,
stan::test::unit::instrumented_writer report,
const double &  margin 
)

Definition at line 68 of file check_adaptation.hpp.

References stan::math::fabs(), MECModelEnuComparisons::i, PandAna.reco_validation.add_data::offset, split(), stod(), and stan::test::unit::instrumented_writer::string_values().

71  {
72  std::vector<std::string> param_strings = report.string_values();
73  size_t offset = 0;
74  for (size_t i = 0; i < param_strings.size(); i++) {
75  offset++;
76  if (param_strings[i].find("lements of inverse mass matrix:")
77  != std::string::npos) {
78  break;
79  }
80  }
81  std::vector<std::string> strs;
82  boost::split(strs, param_strings[offset], boost::is_any_of(", "),
83  boost::token_compress_on);
84  EXPECT_EQ(num_params, strs.size());
85  for (size_t i = 0; i < num_params; i++) {
86  ASSERT_GT(fabs(param_vals[i]-test::unit::stod(strs[i])), margin);
87  }
88  }
void split(double tt, double *fr)
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double stod(const std::string &val)
void stan::test::unit::check_different ( const size_t &  num_rows,
const size_t &  num_cols,
const std::vector< double > &  param_vals,
stan::test::unit::instrumented_writer report,
const double &  margin 
)

Definition at line 90 of file check_adaptation.hpp.

References stan::math::fabs(), MECModelEnuComparisons::i, calib::j, PandAna.reco_validation.add_data::offset, split(), stod(), and stan::test::unit::instrumented_writer::string_values().

93  {
94  std::vector<std::string> param_strings = report.string_values();
95  size_t offset = 0;
96  for (size_t i = 0; i < param_strings.size(); i++) {
97  offset++;
98  if (param_strings[i].find("lements of inverse mass matrix:")
99  != std::string::npos) {
100  break;
101  }
102  }
103  for (size_t i = 0, ij = 0; i < num_rows; i++) {
104  std::vector<std::string> strs;
105  boost::split(strs, param_strings[offset+i], boost::is_any_of(", "),
106  boost::token_compress_on);
107  EXPECT_EQ(num_cols, strs.size());
108  for (size_t j = 0; j < num_cols; j++, ij++) {
109  ASSERT_GT(fabs(param_vals[ij]-test::unit::stod(strs[j])), margin);
110  }
111  }
112  }
void split(double tt, double *fr)
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double stod(const std::string &val)
const double j
Definition: BetheBloch.cxx:29
double stan::test::unit::stod ( const std::string &  val)

Definition at line 16 of file check_adaptation.hpp.

References tmp.

Referenced by BestFit(), check_adaptation(), check_different(), cet::sqlite::detail::convertTo< double >(), GetConfig(), GetOptionValue(), main(), make_fc_surfaces_2020_validation(), MakeCovarSim(), MakeSurface(), MakeSurfaceLLTest(), MakeSurfaceNoNDOsc(), and PlotCSV().

16  {
17  char tmp[val.length()];
18  strcpy(tmp,val.c_str());
19  return atof(tmp);
20  }
Float_t tmp
Definition: plot.C:36