9#include "MinimizerStepConf.h"
19 MinimizerStepConf::MinimizerStepConf() {}
21 MinimizerStepConf::~MinimizerStepConf() {}
24 if (step <= 0) step = 0.01;
31 Int_t points = 1 + (int) TMath::Ceil((max - min) / step);
32 Bool_t created = kFALSE;
33 for (
auto& iPar : fParams) {
34 if (iPar.GetParName().EqualTo(name)) {
35 iPar.SetMapRange(min, max, points);
36 iPar.SetIsDiscrete(kTRUE);
42 param.SetParName(name);
43 param.SetIsDiscrete(kTRUE);
44 param.SetMapRange(min, max, points);
45 fParams.push_back(param);
52 for (
auto iPar : fParams) {
54 par.SetParName(iPar.GetParName());
55 par.SetMapRange(iPar.GetMapMin(), iPar.GetMapMax(), iPar.GetNPoints());
56 par.SetIsDiscrete(kTRUE);
61 for (
auto iPar : fParams) {
62 for (
auto& oPar : input) {
63 if (iPar.GetParName().EqualTo(oPar.GetParName())) {
64 oPar.SetMapRange(iPar.GetMapMin(), iPar.GetMapMax(), iPar.GetNPoints());
65 oPar.SetIsDiscrete(kTRUE);
71 MinimizerStepConf::MinimizerStepConf(
const MinimizerStepConf& other, std::vector<int> order) {
72 std::cout <<
" > " << other.fParams.size() <<
" " << other.GetNParams() << std::endl;
73 if (order.size() != other.fParams.size()) {
74 Hal::Cout::PrintInfo(Form(
"Cannot configure MinimizerStepConf::MinimizerStepConf conf pars no: %i !=%i (order no)",
75 (
int) other.fParams.size(),
80 fParams.resize(other.fParams.size());
81 for (
unsigned int i = 0; i < order.size(); i++) {
82 fParams[i] = other.fParams[order[i]];
89 for (
int i = 0; i < root->GetNChildren(); i++) {
90 auto child = root->GetChild(i);
91 TString name = child->GetName();
93 if (name ==
"param") {
94 auto minim = child->GetAttrib(
"min");
95 auto maxim = child->GetAttrib(
"max");
96 auto step = child->GetAttrib(
"step");
97 auto paramname = child->GetAttrib(
"name");
98 if (minim && maxim && name && step) {
99 double min_val = minim->GetValue().Atof();
100 double max_val = maxim->GetValue().Atof();
101 double dx = step->GetValue().Atof();
102 TString parname = paramname->GetValue();
103 std::cout <<
"CONFIG " << parname <<
" " << dx <<
" " << min_val <<
" " << max_val << std::endl;
static void PrintInfo(TString text, Hal::EInfo status)
void SetParameters(std::vector< FitParam > &input, Bool_t overwrite) const
void ConfigureParameter(TString name, Double_t step, Double_t min, Double_t max, TString option="")
void LoadFromXML(TString xmlFile)
XMLNode * GetRootNode() const