ComPWA
Common Partial-Wave-Analysis Framework
FitFractions.hpp
Go to the documentation of this file.
1 // Copyright (c) 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 COMPWA_TOOLS_FITFRACTIONS_HPP_
6 #define COMPWA_TOOLS_FITFRACTIONS_HPP_
7 
8 #include "Core/Function.hpp"
9 
10 #include <map>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 namespace ComPWA {
16 struct FitResult;
17 class Kinematics;
18 namespace Data {
19 struct DataSet;
20 }
21 namespace Tools {
22 
23 struct FitFraction {
24  std::string Name;
25  double Value;
26  double Error;
27 };
28 
29 using FitFractionList = std::vector<FitFraction>;
30 
31 using IntensityComponent = std::pair<std::string, std::shared_ptr<Intensity>>;
32 
33 std::ostream &operator<<(std::ostream &os, const FitFractionList &FFList);
34 
35 class FitFractions {
36 public:
43  FitFractionList calculateFitFractionsWithCovarianceErrorPropagation(
44  const std::vector<std::pair<IntensityComponent, IntensityComponent>>
45  &Components,
46  const ComPWA::Data::DataSet &PhspSample, const ComPWA::FitResult &Result);
47 
48 private:
49  // internal helper structure, hidden from user
50  struct DerivativeData {
51  std::string ParameterName;
54  double StepSize;
55  };
56 
57  std::map<std::string, std::tuple<double, std::vector<DerivativeData>>>
59 
60  std::tuple<std::vector<double>, std::vector<std::vector<double>>>
61  buildJacobiAndCovariance(const std::tuple<double, std::vector<DerivativeData>>
62  &NominatorDerivatives,
63  const std::tuple<double, std::vector<DerivativeData>>
64  &DenominatorDerivatives,
65  const ComPWA::FitResult &Result);
66 
67  std::tuple<std::string, double, std::vector<FitFractions::DerivativeData>>
68  getIntegralData(IntensityComponent IntensComponent,
69  const ComPWA::Data::DataSet &PhspSample,
70  const ComPWA::FitResult &Result);
71 
72  std::tuple<double, std::vector<FitFractions::DerivativeData>>
73  calculateIntensityIntegralData(ComPWA::Intensity &Intens,
74  const ComPWA::Data::DataSet &PhspSample,
75  const ComPWA::FitResult &Result);
76 };
77 
78 } // namespace Tools
79 } // namespace ComPWA
80 
81 #endif
std::map< std::string, std::tuple< double, std::vector< DerivativeData > > > IntensityGradientDataMapping
std::ostream & operator<<(std::ostream &os, const Event &ev)
Definition: Event.cpp:11
std::vector< FitFraction > FitFractionList
Data structure which resembles a general fit result.
Definition: FitResult.hpp:19
std::pair< std::string, std::shared_ptr< Intensity > > IntensityComponent
Interface template for a general Function of the form OutputType Function(InputTypes) The concept clo...
Definition: Function.hpp:24