Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
RFitPanel.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_RFitPanel
14#define ROOT_RFitPanel
15
16#include <ROOT/RWebWindow.hxx>
17
19
20#include <ROOT/RCanvas.hxx>
21
22#include "TFitResultPtr.h"
23
24#include <memory>
25#include <vector>
26#include <list>
27
28class TPad;
29class TH1;
30class TF1;
31
32namespace ROOT {
33namespace Experimental {
34
35class RFitPanel {
36
37 std::unique_ptr<RFitPanelModel> fModel;
38
39 std::vector<TObject*> fObjects; ///<! objects provided directly to panel for fitting
40 std::string fCanvName; ///<! v6 canvas name used to display fit, will be created if not exists
41 std::string fPadName; ///<! v6 pad name in the canvas, where object is (was) drawn
42
43 std::shared_ptr<RCanvas> fCanvas; ///<! v7 canvas used to display results
44
45 std::shared_ptr<ROOT::RWebWindow> fWindow; ///<! configured display
46 unsigned fConnId{0}; ///<! client connection id
47
48 std::vector<std::unique_ptr<TF1>> fSystemFuncs; ///<! local copy of all internal system funcs
49
50 struct FitRes {
51 std::string objid; // object used for fitting
52 std::unique_ptr<TF1> func; // function
53 TFitResultPtr res; // result
54 FitRes() = default;
55 FitRes(const std::string &_objid, std::unique_ptr<TF1> &_func, TFitResultPtr &_res);
56 ~FitRes();
57 };
58
59 std::list<FitRes> fPrevRes; ///<! all previous functions used for fitting
60
61 TF1 *copyTF1(TF1 *f);
62
64
65 void ProcessData(unsigned connid, const std::string &arg);
66
68
69 int UpdateModel(const std::string &json);
70
71 void SelectObject(const std::string &objid);
72 TObject *GetSelectedObject(const std::string &objid);
74 void UpdateDataSet();
75
77 TF1 *FindFunction(const std::string &funcid);
78 TFitResult *FindFitResult(const std::string &funcid);
79 std::unique_ptr<TF1> GetFitFunction(const std::string &funcid);
80 void SelectFunction(const std::string &funcid);
81
83
84 Color_t GetColor(const std::string &colorid);
85
86 TPad *GetDrawPad(TObject *obj, bool force = false);
87
88 void DoPadUpdate(TPad *pad);
89
90 void SendModel();
91
92 bool DoFit();
93 bool DoDraw();
94
95public:
96 RFitPanel(const std::string &title = "Fit panel");
97 ~RFitPanel();
98
99 // method required when any panel want to be inserted into the RCanvas
100 std::shared_ptr<ROOT::RWebWindow> GetWindow();
101
102 void AssignHistogram(TH1 *hist);
103
104 void AssignHistogram(const std::string &hname);
105
106 void AssignCanvas(const std::string &cname) { fCanvName = cname; }
107
108 void AssignCanvas(std::shared_ptr<RCanvas> &canv);
109
110 /// show FitPanel in specified place
111 void Show(const RWebDisplayArgs &args = "");
112
113 /// hide FitPanel
114 void Hide();
115
116 void ClearOnClose(const std::shared_ptr<void> &handle);
117};
118
119} // namespace Experimental
120} // namespace ROOT
121
122#endif
nlohmann::json json
#define f(i)
Definition RSha256.hxx:104
short Color_t
Definition RtypesCore.h:85
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
RFitPanel(const std::string &title="Fit panel")
Constructor.
Definition RFitPanel.cxx:83
TPad * GetDrawPad(TObject *obj, bool force=false)
Returns pad where histogram is drawn If canvas not exists, create new one.
void UpdateDataSet()
Update list of available data.
void UpdateFunctionsList()
Update list of available functions.
void SelectFunction(const std::string &funcid)
Select fit function.
void GetFunctionsFromSystem()
Looks for all the functions registered in the current ROOT session.
void ClearOnClose(const std::shared_ptr< void > &handle)
Set handle which will be cleared when connection is closed.
RFitPanelModel::EFitObjectType GetFitObjectType(TObject *obj)
Returns kind of object.
std::shared_ptr< RCanvas > fCanvas
! v7 canvas used to display results
Definition RFitPanel.hxx:43
TF1 * FindFunction(const std::string &funcid)
Search for existing functions, ownership still belongs to FitPanel or global lists.
std::string fCanvName
! v6 canvas name used to display fit, will be created if not exists
Definition RFitPanel.hxx:40
std::unique_ptr< RFitPanelModel > fModel
Definition RFitPanel.hxx:37
Color_t GetColor(const std::string &colorid)
Extract color from string Should be coded as #ff00ff string.
unsigned fConnId
! client connection id
Definition RFitPanel.hxx:46
std::string fPadName
! v6 pad name in the canvas, where object is (was) drawn
Definition RFitPanel.hxx:41
bool DoFit()
Perform fitting using current model settings Returns true if any action was done.
std::shared_ptr< ROOT::RWebWindow > fWindow
! configured display
Definition RFitPanel.hxx:45
TObject * MakeConfidenceLevels(TFitResult *res)
Create confidence levels drawing tab.
std::vector< TObject * > fObjects
! objects provided directly to panel for fitting
Definition RFitPanel.hxx:39
std::unique_ptr< TF1 > GetFitFunction(const std::string &funcid)
Creates new instance to make fitting.
void AssignHistogram(TH1 *hist)
Assign histogram to use with fit panel - without ownership.
TFitResult * FindFitResult(const std::string &funcid)
Creates new instance to make fitting.
TObject * GetSelectedObject(const std::string &objid)
Returns object based on it string id Searches either in gDirectory or in internal panel list.
void SendModel()
Send model object to the client.
void Hide()
hide FitPanel
int UpdateModel(const std::string &json)
Update fit model returns -1 if JSON fails return 0 if nothing large changed return 1 if important sel...
void DoPadUpdate(TPad *pad)
Mark pad modified and do update For web canvas set async mode first to avoid blocking here.
void Show(const RWebDisplayArgs &args="")
show FitPanel in specified place
RFitPanelModel & model()
Return reference on model object Model created if was not exists before.
TF1 * copyTF1(TF1 *f)
Copies f into a new TF1 to be stored in the fitpanel with it's own ownership.
std::vector< std::unique_ptr< TF1 > > fSystemFuncs
! local copy of all internal system funcs
Definition RFitPanel.hxx:48
std::list< FitRes > fPrevRes
! all previous functions used for fitting
Definition RFitPanel.hxx:59
void ProcessData(unsigned connid, const std::string &arg)
Process data from FitPanel OpenUI5-based FitPanel sends commands or status changes.
void AssignCanvas(const std::string &cname)
bool DoDraw()
Perform drawing using current model settings Returns true if any action was done.
void SelectObject(const std::string &objid)
Select object for fitting.
std::shared_ptr< ROOT::RWebWindow > GetWindow()
Returns RWebWindow instance, used to display FitPanel.
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
1-Dim function class
Definition TF1.h:234
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
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
Mother of all ROOT objects.
Definition TObject.h:41
The most important graphics class in the ROOT system.
Definition TPad.h:28
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Data structure for the fit panel.