Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
IProfilingStrategy.cpp
Go to the documentation of this file.
2
3IProfilingStrategy::IProfilingStrategy(std::size_t x_id, std::size_t y_id, const FitResult& fr)
4 : x_id(x_id), y_id(y_id), fr(fr)
5{}
6
8 double px,
9 double py,
10 const std::map<std::size_t, double>& current_argmin
11) const {
12 const std::size_t dim_p = fr.p_hat.size();
13 const std::size_t dim_nuis = fr.eta_hat.size();
14 const std::size_t dim = dim_p + dim_nuis;
15
17 pr.start.resize(dim);
18
19 for (std::size_t i = 0; i < dim_p; ++i) {
20 double val = fr.p_hat[i];
21 if (i == x_id) val = px;
22 if (i == y_id) val = py;
23 pr.fixed_params[i] = val;
24 pr.start[i] = val;
25 }
26
27 for (std::size_t i = 0; i < dim_nuis; ++i) {
28 const std::size_t idx = dim_p + i;
29 pr.free_params.push_back(idx);
30
31 auto it = current_argmin.find(idx);
32 if (it == current_argmin.end()) {
33 throw std::runtime_error("SliceProfilingStrategy: missing warm-start entry for nuisance index "
34 + std::to_string(idx));
35 }
36 pr.start[idx] = it->second;
37 }
38
39 return pr;
40}
41
42
43std::map<std::size_t, double> SliceProfilingStrategy::init_warm_start() const {
44 std::map<std::size_t, double> start;
45 const std::size_t dim_p = fr.p_hat.size();
46 const std::size_t dim_nuis = fr.eta_hat.size();
47
48 for (std::size_t i = 0; i < dim_nuis; ++i) {
49 start[dim_p + i] = fr.eta_hat.at(i);
50 }
51
52 return start;
53}
54
56 double px,
57 double py,
58 const std::map<std::size_t, double>& current_argmin
59) const {
60 const std::size_t dim_p = fr.p_hat.size();
61 const std::size_t dim_nuis = fr.eta_hat.size();
62 const std::size_t dim = dim_p + dim_nuis;
63
65 pr.start.resize(dim);
66
67 for (std::size_t i = 0; i < dim; ++i) {
68 if (i == x_id) {
69 pr.fixed_params[i] = px;
70 pr.start[i] = px;
71 } else if (i == y_id) {
72 pr.fixed_params[i] = py;
73 pr.start[i] = py;
74 } else {
75 pr.free_params.push_back(i);
76
77 auto it = current_argmin.find(i);
78 if (it == current_argmin.end()) {
79 throw std::runtime_error("ProjectionProfilingStrategy: missing warm-start entry for free index "
80 + std::to_string(i));
81 }
82 pr.start[i] = it->second;
83 }
84 }
85
86 return pr;
87}
88
89std::map<std::size_t, double> ProjectionProfilingStrategy::init_warm_start() const {
90 std::map<std::size_t, double> start;
91 const std::size_t dim_p = fr.p_hat.size();
92 const std::size_t dim_nuis = fr.eta_hat.size();
93
94 for (std::size_t i = 0; i < dim_p + dim_nuis; ++i) {
95 start[i] = (i < dim_p) ? fr.p_hat.at(i) : fr.eta_hat.at(i - dim_p);
96 }
97
98 start.erase(x_id);
99 start.erase(y_id);
100
101 return start;
102}
Profiling strategies used to build two-dimensional likelihood scan requests.
IProfilingStrategy(std::size_t x_id, std::size_t y_id, const FitResult &fr)
Constructs a profiling strategy.
FitResult fr
Reference global fit used for central values and warm starts.
std::size_t y_id
Global indices of the two profiled scan coordinates.
std::map< std::size_t, double > init_warm_start() const override
Creates the initial warm-start map for the strategy.
ProfileRequest build_request(double px, double py, const std::map< std::size_t, double > &current_argmin) const override
Builds a profiler request for one 2D scan point.
std::map< std::size_t, double > init_warm_start() const override
Creates the initial warm-start map for the strategy.
ProfileRequest build_request(double px, double py, const std::map< std::size_t, double > &current_argmin) const override
Builds a profiler request for one 2D scan point.
Summary of a global likelihood fit.
std::vector< double > eta_hat
Nuisance estimates at the global maximum-likelihood point.
std::vector< double > p_hat
Maximum-likelihood estimates for parameters of interest.
Input specification for a constrained profile minimization.
Definition Profiler.h:38
std::vector< std::size_t > free_params
Global indices of parameters released during profiling.
Definition Profiler.h:39
std::map< std::size_t, double > fixed_params
Fixed parameter values keyed by global parameter index.
Definition Profiler.h:40
std::vector< double > start
Initial full parameter vector used as a warm start.
Definition Profiler.h:41