File indexing completed on 2025-09-17 09:14:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_RFitPanel
0014 #define ROOT_RFitPanel
0015
0016 #include <ROOT/RWebWindow.hxx>
0017
0018 #include <ROOT/RFitPanelModel.hxx>
0019
0020 #include <ROOT/RCanvas.hxx>
0021
0022 #include "TFitResultPtr.h"
0023
0024 #include <memory>
0025 #include <vector>
0026 #include <list>
0027
0028 class TPad;
0029 class TH1;
0030 class TF1;
0031
0032 namespace ROOT {
0033 namespace Experimental {
0034
0035 class RFitPanel {
0036
0037 std::unique_ptr<RFitPanelModel> fModel;
0038
0039 std::vector<TObject*> fObjects;
0040 std::string fCanvName;
0041 std::string fPadName;
0042
0043 std::shared_ptr<RCanvas> fCanvas;
0044
0045 std::shared_ptr<ROOT::RWebWindow> fWindow;
0046 unsigned fConnId{0};
0047
0048 std::vector<std::unique_ptr<TF1>> fSystemFuncs;
0049
0050 struct FitRes {
0051 std::string objid;
0052 std::unique_ptr<TF1> func;
0053 TFitResultPtr res;
0054 FitRes() = default;
0055 FitRes(const std::string &_objid, std::unique_ptr<TF1> &_func, TFitResultPtr &_res);
0056 ~FitRes();
0057 };
0058
0059 std::list<FitRes> fPrevRes;
0060
0061 TF1 *copyTF1(TF1 *f);
0062
0063 void GetFunctionsFromSystem();
0064
0065 void ProcessData(unsigned connid, const std::string &arg);
0066
0067 RFitPanelModel &model();
0068
0069 int UpdateModel(const std::string &json);
0070
0071 void SelectObject(const std::string &objid);
0072 TObject *GetSelectedObject(const std::string &objid);
0073 RFitPanelModel::EFitObjectType GetFitObjectType(TObject *obj);
0074 void UpdateDataSet();
0075
0076 void UpdateFunctionsList();
0077 TF1 *FindFunction(const std::string &funcid);
0078 TFitResult *FindFitResult(const std::string &funcid);
0079 std::unique_ptr<TF1> GetFitFunction(const std::string &funcid);
0080 void SelectFunction(const std::string &funcid);
0081
0082 TObject *MakeConfidenceLevels(TFitResult *res);
0083
0084 Color_t GetColor(const std::string &colorid);
0085
0086 TPad *GetDrawPad(TObject *obj, bool force = false);
0087
0088 void DoPadUpdate(TPad *pad);
0089
0090 void SendModel();
0091
0092 bool DoFit();
0093 bool DoDraw();
0094
0095 public:
0096 RFitPanel(const std::string &title = "Fit panel");
0097 ~RFitPanel();
0098
0099
0100 std::shared_ptr<ROOT::RWebWindow> GetWindow();
0101
0102 void AssignHistogram(TH1 *hist);
0103
0104 void AssignHistogram(const std::string &hname);
0105
0106 void AssignCanvas(const std::string &cname) { fCanvName = cname; }
0107
0108 void AssignCanvas(std::shared_ptr<RCanvas> &canv);
0109
0110
0111 void Show(const RWebDisplayArgs &args = "");
0112
0113
0114 void Hide();
0115
0116 void ClearOnClose(const std::shared_ptr<void> &handle);
0117 };
0118
0119 }
0120 }
0121
0122 #endif