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