Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RFitPanelModel.hxx
Go to the documentation of this file.
1// Authors: Sergey Linev <S.Linev@gsi.de> Iliana Betsou <Iliana.Betsou@cern.ch>
2// Date: 2019-04-11
3// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
4
5/*************************************************************************
6 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_RFitPanelModel
14#define ROOT_RFitPanelModel
15
16#include "Foption.h"
17#include "Fit/DataRange.h"
19#include "TString.h"
20
21#include <vector>
22#include <string>
23
24class TH1;
25class TF1;
26class TFitResult;
27
28namespace ROOT {
29namespace Experimental {
30
31class RLogChannel;
32/// Log channel for FitPanel diagnostics.
33RLogChannel &FitPanelLog();
34
35/** Data structure for the fit panel */
36
38
45 // kObjectTree,
48 };
49
50 /// Generic item for ui5 ComboBox
52 std::string key;
53 std::string value;
54 RComboBoxItem() = default;
55 RComboBoxItem(const std::string &_key, const std::string &_value) : key(_key), value(_value) {}
56 };
57
58 struct RMethodInfo {
59 int id{0}; // method id
60 std::string text; // text shown in combobox
61 RMethodInfo() = default;
62 RMethodInfo(int _id, const std::string &_text) : id(_id), text(_text) {}
63 };
64
65 /// Entry in minimizer algorithm combo
67 int lib{0}; // to which library belongs
68 int id{0}; // identifier
69 std::string text; // text shown in combobox
71 RMinimezerAlgorithm(int _lib, int _id, const std::string &_text) : lib(_lib), id(_id), text(_text) {}
72 };
73
74 /// Basic function info, used in combo boxes
75 struct RItemInfo {
76 std::string group;
77 std::string id;
78 std::string name;
79
80 RItemInfo() = default;
81 RItemInfo(const std::string &_name) : group("Predefined"), name(_name) { id = "dflt::"; id.append(_name); }
82 RItemInfo(const std::string &_group, const std::string &_id, const std::string &_name) : group(_group), id(_id), name(_name) {}
83 };
84
85 /// Function parameter info, used in edit parameters dialog
86
87 struct RFuncPar {
88 int ipar{0};
89 std::string name;
90 std::string value;
91 bool fixed{false};
92 std::string error;
93 std::string min;
94 std::string max;
95 RFuncPar() = default;
96 RFuncPar(int _ipar, const std::string &_name) : ipar(_ipar), name(_name) {}
97 };
98
99 /// Class used to transfer functions parameters list from/to client
101 bool haspars{false};
102 std::string id; ///< function id in the FitPanel
103 std::string name; ///< display name
104 std::vector<RFuncPar> pars; ///< parameters
105 void GetParameters(TF1 *f1);
106 void SetParameters(TF1 *f1);
107 void Clear();
108 };
109
110 std::string fTitle; ///< title of the fit panel
111
112 std::vector<RItemInfo> fDataSet; ///< list of available data sources
113 std::string fSelectedData; ///< selected data
114 EFitObjectType fDataType{kObjectNone}; ///< selected object type, provided by server
115
116 int fDim{0}; ///< number of dimensions in selected data object
117
118 std::vector<RItemInfo> fFuncList; ///< all available fit functions
119 std::string fSelectedFunc; ///< id of selected fit function like dflt::gaus
120
121 std::string fSelectedTab; ///< key of selected tab, useful for drawing
122
123 // General tab
124
125 // Method
126 std::vector<RMethodInfo> fFitMethods; ///< all supported for selected data
127 int fFitMethod{0}; ///< selected fit method
128
129 bool fLinearFit{false};
130 bool fRobust{false};
131 float fRobustLevel{0.95};
132
133 // Fit Options
134 bool fIntegral{false};
135 bool fUseRange{false};
136 bool fBestErrors{false};
138 bool fAllWeights1{false};
139 bool fAddToList{false};
140 bool fEmptyBins1{false};
141 bool fUseGradient{false};
142
143 // Draw Options
144 bool fSame{false};
145 bool fNoDrawing{false};
146 bool fNoStoreDraw{false};
147
148
149 // all combo items for all methods
150
151 // Minimization Tab
152 int fLibrary{0}; ///< selected minimization library
153 bool fHasGenetics{false}; ///< is genetics available
154 std::vector<RMinimezerAlgorithm> fMethodMinAll; ///< all items for all methods
156
157 float fErrorDef{1.00};
158 float fMaxTolerance{0.01};
160 int fPrint{0};
161
162
163 // range selection, shown depending on fDim
164 float fMinRangeX{0};
165 float fMaxRangeX{1};
166 float fStepX{0.01};
167 float fRangeX[2] = {0,1};
168
169 float fMinRangeY{0};
170 float fMaxRangeY{1};
171 float fStepY{0.01};
172 float fRangeY[2] = {0,1};
173
174
175 /// Parameters
176
178
179 /// Advanced Options
180
181 bool fHasAdvanced{false};
182 std::string fAdvancedTab;
183 std::vector<RComboBoxItem> fAdvancedPars;
184 float fConfidenceLevel{0.683};
185
186 /// Contour sub-tab
188 std::string fContourPar1Id;
189 std::string fContourPar2Id;
190 std::string fContourColor;
192
193 // Scan sub-tab
195 std::string fScanId;
196 float fScanMin{0};
197 float fScanMax{0};
198 std::string fScanColor;
199
200 /// Confidence sub-tab
201 std::string fConfidenceColor;
202
203 bool fInitialized{false}; ///<! indicates if data were initialized
204
205 RFitPanelModel() = default;
206
207 void Initialize();
208
209 bool SelectHistogram(const std::string &hname, TH1 *hist);
210
211 void SetObjectKind(EFitObjectType kind);
212
213 bool HasFunction(const std::string &id);
214
215 void SelectedFunc(const std::string &name, TF1 *func);
216
217 void UpdateRange(TH1 *hist);
218
219 void UpdateAdvanced(TFitResult *res);
220
221 bool IsDataSelected() const { return !fSelectedData.empty(); }
222
226
228};
229
230} // namespace Experimental
231} // namespace ROOT
232
233#endif
char name[80]
Definition TGX11.cxx:110
class describing the range in the coordinates it supports multiple range in a coordinate.
Definition DataRange.h:35
1-Dim function class
Definition TF1.h:233
Extends the ROOT::Fit::Result class with a TNamed inheritance providing easy possibility for I/O.
Definition TFitResult.h:34
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
Basic string class.
Definition TString.h:139
TF1 * f1
Definition legend1.C:11
RLogChannel & FitPanelLog()
Log channel for FitPanel diagnostics.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
RComboBoxItem(const std::string &_key, const std::string &_value)
Function parameter info, used in edit parameters dialog.
RFuncPar(int _ipar, const std::string &_name)
Class used to transfer functions parameters list from/to client.
void GetParameters(TF1 *f1)
Extract TF1 parameters, used in editor on client sides.
std::string id
function id in the FitPanel
void SetParameters(TF1 *f1)
Set parameters to TF1.
Basic function info, used in combo boxes.
RItemInfo(const std::string &_group, const std::string &_id, const std::string &_name)
RMethodInfo(int _id, const std::string &_text)
RMinimezerAlgorithm(int _lib, int _id, const std::string &_text)
Data structure for the fit panel.
std::vector< RItemInfo > fFuncList
all available fit functions
EFitObjectType fDataType
selected object type, provided by server
RFuncParsList fFuncPars
Parameters.
int fLibrary
selected minimization library
TString GetDrawOption()
Retrun draw option - dummy now.
ROOT::Math::MinimizerOptions GetMinimizerOptions()
Provide initialized ROOT::Math::MinimizerOptions instance.
void Initialize()
Initialize model - set some meaningful default values.
std::vector< RComboBoxItem > fAdvancedPars
std::string fSelectedData
selected data
bool HasFunction(const std::string &id)
Check if function id is exists.
bool SelectHistogram(const std::string &hname, TH1 *hist)
std::vector< RItemInfo > fDataSet
list of available data sources
std::string fSelectedFunc
id of selected fit function like dflt::gaus
void UpdateAdvanced(TFitResult *res)
Update advanced parameters associated with fit function.
void SelectedFunc(const std::string &name, TF1 *func)
Select function.
std::string fSelectedTab
key of selected tab, useful for drawing
void UpdateRange(TH1 *hist)
Update range values.
void SetObjectKind(EFitObjectType kind)
Update setting dependent from object type.
Foption_t GetFitOptions()
Provide initialized Foption_t instance.
std::vector< RMinimezerAlgorithm > fMethodMinAll
all items for all methods
std::string fConfidenceColor
Confidence sub-tab.
bool fInitialized
! indicates if data were initialized
std::string fTitle
title of the fit panel
int fDim
number of dimensions in selected data object
std::vector< RMethodInfo > fFitMethods
all supported for selected data
bool fHasGenetics
is genetics available