Logo ROOT   6.12/07
Reference Guide
TFitPanel.hxx
Go to the documentation of this file.
1 /// \file ROOT/TFitPanel.hxx
2 /// \ingroup WebGui ROOT7
3 /// \author Sergey Linev <S.Linev@gsi.de>
4 /// \date 2017-10-24
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6 /// is welcome!
7 
8 /*************************************************************************
9  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
10  * All rights reserved. *
11  * *
12  * For the licensing terms see $ROOTSYS/LICENSE. *
13  * For the list of contributors see $ROOTSYS/README/CREDITS. *
14  *************************************************************************/
15 
16 #ifndef ROOT7_TFitPanel
17 #define ROOT7_TFitPanel
18 
19 #include <ROOT/TWebWindow.hxx>
20 
21 #include <ROOT/TCanvas.hxx>
22 
23 #include "ROOT/THist.hxx"
24 
25 #include <vector>
26 
27 namespace ROOT {
28 namespace Experimental {
29 
30 /** struct ROOT::Experimental::ComboBoxItem
31  * \ingroup webdisplay
32  * Descriptor for the openui5 ComboBox, used in FitPanel
33  */
34 
35 struct ComboBoxItem {
36  std::string fId;
37  std::string fName;
38  ComboBoxItem() = default;
39  ComboBoxItem(const std::string &id, const std::string &name) : fId(id), fName(name) {}
40 };
41 
42 /** struct ROOT::Experimental::TFitPanelModel
43  * \ingroup webdisplay
44  * Model, used to initialized openui5 FitPanel
45  */
46 
48  std::vector<ComboBoxItem> fDataNames;
49  std::string fSelectDataId;
50  std::vector<ComboBoxItem> fModelNames;
51  std::string fSelectModelId;
52  TFitPanelModel() = default;
53 };
54 
55 class TFitPanel {
56 
57  std::string fTitle; ///<! title
58  unsigned fConnId{0}; ///<! connection id
59 
60  std::shared_ptr<TWebWindow> fWindow; ///!< configured display
61 
62  std::shared_ptr<TCanvas> fCanvas; ///!< canvas used to display results
63 
64  std::shared_ptr<TH1D> fFitHist; ///!< histogram created when fit is performed
65 
66  /// Disable copy construction.
67  TFitPanel(const TFitPanel &) = delete;
68 
69  /// Disable assignment.
70  TFitPanel &operator=(const TFitPanel &) = delete;
71 
72  /// process data from UI
73  void ProcessData(unsigned connid, const std::string &arg);
74 
75 public:
76  /// normal constructor
77  TFitPanel(const std::string &title = "Fit panel") : fTitle(title) {}
78 
79  /// destructor
80  virtual ~TFitPanel() { printf("Fit panel destructor!!!\n"); }
81 
82  // method required when any panel want to be inserted into the TCanvas
83  std::shared_ptr<TWebWindow> GetWindow();
84 
85  /// show FitPanel in specified place
86  void Show(const std::string &where = "");
87 
88  /// hide FitPanel
89  void Hide();
90 
91  /// let use canvas to display fit results
92  void UseCanvas(std::shared_ptr<TCanvas> &canv);
93 
94  /// Dummy function, called when "Fit" button pressed in UI
95  void DoFit(const std::string &dname, const std::string &mname);
96 };
97 
98 } // namespace Experimental
99 } // namespace ROOT
100 
101 #endif
std::vector< ComboBoxItem > fModelNames
Definition: TFitPanel.hxx:50
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
std::vector< ComboBoxItem > fDataNames
Definition: TFitPanel.hxx:48
ComboBoxItem(const std::string &id, const std::string &name)
Definition: TFitPanel.hxx:39
TFitPanel(const std::string &title="Fit panel")
normal constructor
Definition: TFitPanel.hxx:77
std::shared_ptr< TH1D > fFitHist
!< canvas used to display results
Definition: TFitPanel.hxx:64
std::string fTitle
! title
Definition: TFitPanel.hxx:57
virtual ~TFitPanel()
destructor
Definition: TFitPanel.hxx:80
struct ROOT::Experimental::TFitPanelModelModel, used to initialized openui5 FitPanel ...
Definition: TFitPanel.hxx:47
std::shared_ptr< TWebWindow > fWindow
Definition: TFitPanel.hxx:60
web-based FitPanel prototype.
Definition: TFitPanel.hxx:55
Binding & operator=(OUT(*fun)(void))
struct ROOT::Experimental::ComboBoxItemDescriptor for the openui5 ComboBox, used in FitPanel ...
Definition: TFitPanel.hxx:35
char name[80]
Definition: TGX11.cxx:109
std::shared_ptr< TCanvas > fCanvas
!< configured display
Definition: TFitPanel.hxx:62