ComPWA
Common Partial-Wave-Analysis Framework
FitResult.hpp
Go to the documentation of this file.
1 // Copyright (c) 2015, 2017 The ComPWA Team.
2 // This file is part of the ComPWA framework, check
3 // https://github.com/ComPWA/ComPWA/license.txt for details.
4 
5 #ifndef CORE_FITRESULT_HPP_
6 #define CORE_FITRESULT_HPP_
7 
8 #include "Core/FitParameter.hpp"
9 #include "Core/Function.hpp"
10 
11 #include <boost/serialization/vector.hpp>
12 
13 #include <chrono>
14 
15 namespace ComPWA {
16 
19 struct FitResult {
22  unsigned int NumFreeParameters;
23  bool IsValid = false;
24 
25  double InitialEstimatorValue = 0.0;
26  double FinalEstimatorValue = 0.0;
27  std::chrono::seconds FitDuration = std::chrono::seconds(0);
28 
29  std::vector<std::vector<double>> CovarianceMatrix;
30 
31  friend std::ostream &operator<<(std::ostream &os, const FitResult &Result);
32 
33  void write(std::string filename) const;
34 
35 private:
36  friend class boost::serialization::access;
37  template <class archive>
38  void serialize(archive &ar, const unsigned int version) {
39  ar &BOOST_SERIALIZATION_NVP(InitialParameters);
40  ar &BOOST_SERIALIZATION_NVP(FinalParameters);
41  ar &BOOST_SERIALIZATION_NVP(NumFreeParameters);
42  ar &BOOST_SERIALIZATION_NVP(IsValid);
43  ar &BOOST_SERIALIZATION_NVP(InitialEstimatorValue);
44  ar &BOOST_SERIALIZATION_NVP(FinalEstimatorValue);
45  auto x = FitDuration.count();
46  ar &boost::serialization::make_nvp("FitDurationInSeconds", x);
47  FitDuration = std::chrono::seconds(x);
48  ar &BOOST_SERIALIZATION_NVP(CovarianceMatrix);
49  }
50 };
51 
52 FitResult load(std::string filename);
53 
55 
57  ComPWA::FitResult Result);
58 } // namespace ComPWA
59 
60 #endif
unsigned int NumFreeParameters
Definition: FitResult.hpp:22
std::vector< std::vector< double > > CovarianceMatrix
Definition: FitResult.hpp:29
friend std::ostream & operator<<(std::ostream &os, const FitResult &Result)
Definition: FitResult.cpp:35
void serialize(archive &ar, const unsigned int version)
Definition: FitResult.hpp:38
void initializeWithFitResult(ComPWA::Intensity &Intens, ComPWA::FitResult Result)
Definition: FitResult.cpp:166
std::vector< FitParameter< double > > FitParameterList
std::chrono::seconds FitDuration
Definition: FitResult.hpp:27
double InitialEstimatorValue
Definition: FitResult.hpp:25
double FinalEstimatorValue
Definition: FitResult.hpp:26
Data structure which resembles a general fit result.
Definition: FitResult.hpp:19
FitParameterList FinalParameters
Definition: FitResult.hpp:21
FitParameterList InitialParameters
Definition: FitResult.hpp:20
void write(std::string filename) const
Definition: FitResult.cpp:151
FitResult load(std::string filename)
Definition: FitResult.cpp:157
std::string makeFitParameterString(ComPWA::FitParameter< double > p)
Definition: FitResult.cpp:20
Interface template for a general Function of the form OutputType Function(InputTypes) The concept clo...
Definition: Function.hpp:24