File indexing completed on 2025-01-30 10:22:33
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_RFitPanelModel
0014 #define ROOT_RFitPanelModel
0015
0016 #include "Foption.h"
0017 #include "Fit/DataRange.h"
0018 #include "Math/MinimizerOptions.h"
0019 #include "TString.h"
0020
0021 #include <vector>
0022 #include <string>
0023
0024 class TH1;
0025 class TF1;
0026 class TFitResult;
0027
0028 namespace ROOT {
0029 namespace Experimental {
0030
0031 class RLogChannel;
0032
0033 RLogChannel &FitPanelLog();
0034
0035
0036
0037 struct RFitPanelModel {
0038
0039 enum EFitObjectType {
0040 kObjectNone,
0041 kObjectHisto,
0042 kObjectGraph,
0043 kObjectGraph2D,
0044 kObjectHStack,
0045
0046 kObjectMultiGraph,
0047 kObjectNotSupported
0048 };
0049
0050
0051 struct RComboBoxItem {
0052 std::string key;
0053 std::string value;
0054 RComboBoxItem() = default;
0055 RComboBoxItem(const std::string &_key, const std::string &_value) : key(_key), value(_value) {}
0056 };
0057
0058 struct RMethodInfo {
0059 int id{0};
0060 std::string text;
0061 RMethodInfo() = default;
0062 RMethodInfo(int _id, const std::string &_text) : id(_id), text(_text) {}
0063 };
0064
0065
0066 struct RMinimezerAlgorithm {
0067 int lib{0};
0068 int id{0};
0069 std::string text;
0070 RMinimezerAlgorithm() = default;
0071 RMinimezerAlgorithm(int _lib, int _id, const std::string &_text) : lib(_lib), id(_id), text(_text) {}
0072 };
0073
0074
0075 struct RItemInfo {
0076 std::string group;
0077 std::string id;
0078 std::string name;
0079
0080 RItemInfo() = default;
0081 RItemInfo(const std::string &_name) : group("Predefined"), name(_name) { id = "dflt::"; id.append(_name); }
0082 RItemInfo(const std::string &_group, const std::string &_id, const std::string &_name) : group(_group), id(_id), name(_name) {}
0083 };
0084
0085
0086
0087 struct RFuncPar {
0088 int ipar{0};
0089 std::string name;
0090 std::string value;
0091 bool fixed{false};
0092 std::string error;
0093 std::string min;
0094 std::string max;
0095 RFuncPar() = default;
0096 RFuncPar(int _ipar, const std::string &_name) : ipar(_ipar), name(_name) {}
0097 };
0098
0099
0100 struct RFuncParsList {
0101 bool haspars{false};
0102 std::string id;
0103 std::string name;
0104 std::vector<RFuncPar> pars;
0105 void GetParameters(TF1 *f1);
0106 void SetParameters(TF1 *f1);
0107 void Clear();
0108 };
0109
0110 std::string fTitle;
0111
0112 std::vector<RItemInfo> fDataSet;
0113 std::string fSelectedData;
0114 EFitObjectType fDataType{kObjectNone};
0115
0116 int fDim{0};
0117
0118 std::vector<RItemInfo> fFuncList;
0119 std::string fSelectedFunc;
0120
0121 std::string fSelectedTab;
0122
0123
0124
0125
0126 std::vector<RMethodInfo> fFitMethods;
0127 int fFitMethod{0};
0128
0129 bool fLinearFit{false};
0130 bool fRobust{false};
0131 float fRobustLevel{0.95};
0132
0133
0134 bool fIntegral{false};
0135 bool fUseRange{false};
0136 bool fBestErrors{false};
0137 bool fImproveFitResults{false};
0138 bool fAllWeights1{false};
0139 bool fAddToList{false};
0140 bool fEmptyBins1{false};
0141 bool fUseGradient{false};
0142
0143
0144 bool fSame{false};
0145 bool fNoDrawing{false};
0146 bool fNoStoreDraw{false};
0147
0148
0149
0150
0151
0152 int fLibrary{0};
0153 bool fHasGenetics{false};
0154 std::vector<RMinimezerAlgorithm> fMethodMinAll;
0155 int fSelectMethodMin{0};
0156
0157 float fErrorDef{1.00};
0158 float fMaxTolerance{0.01};
0159 int fMaxIterations{0};
0160 int fPrint{0};
0161
0162
0163
0164 float fMinRangeX{0};
0165 float fMaxRangeX{1};
0166 float fStepX{0.01};
0167 float fRangeX[2] = {0,1};
0168
0169 float fMinRangeY{0};
0170 float fMaxRangeY{1};
0171 float fStepY{0.01};
0172 float fRangeY[2] = {0,1};
0173
0174
0175
0176
0177 RFuncParsList fFuncPars;
0178
0179
0180
0181 bool fHasAdvanced{false};
0182 std::string fAdvancedTab;
0183 std::vector<RComboBoxItem> fAdvancedPars;
0184 float fConfidenceLevel{0.683};
0185
0186
0187 int fContourPoints{0};
0188 std::string fContourPar1Id;
0189 std::string fContourPar2Id;
0190 std::string fContourColor;
0191 bool fContourSuperImpose{false};
0192
0193
0194 int fScanPoints{0};
0195 std::string fScanId;
0196 float fScanMin{0};
0197 float fScanMax{0};
0198 std::string fScanColor;
0199
0200
0201 std::string fConfidenceColor;
0202
0203 bool fInitialized{false};
0204
0205 RFitPanelModel() = default;
0206
0207 void Initialize();
0208
0209 bool SelectHistogram(const std::string &hname, TH1 *hist);
0210
0211 void SetObjectKind(EFitObjectType kind);
0212
0213 bool HasFunction(const std::string &id);
0214
0215 void SelectedFunc(const std::string &name, TF1 *func);
0216
0217 void UpdateRange(TH1 *hist);
0218
0219 void UpdateAdvanced(TFitResult *res);
0220
0221 bool IsDataSelected() const { return !fSelectedData.empty(); }
0222
0223 ROOT::Fit::DataRange GetRanges();
0224 Foption_t GetFitOptions();
0225 ROOT::Math::MinimizerOptions GetMinimizerOptions();
0226
0227 TString GetDrawOption();
0228 };
0229
0230 }
0231 }
0232
0233 #endif