Skip to content
Snippets Groups Projects
Commit bb17c947 authored by Sergey Linev's avatar Sergey Linev Committed by Axel Naumann
Browse files

web fitpanel: extract RFitPanel6Model into extra class

Apply clang-format to all sources
Simplify LinkDef
parent 5a0301c4
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,11 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ROOTFitPanelv7
HEADERS
ROOT/RFitPanel.hxx
ROOT/RFitPanel6.hxx
SOURCES
ROOT/RFitPanel6Model.hxx
SOURCES
RFitPanel.cxx
RFitPanel6.cxx
RFitPanel6Model.cxx
DICTIONARY_OPTIONS
-writeEmptyRootPCM
DEPENDENCIES
......
......@@ -9,15 +9,13 @@
#ifdef __CINT__
#pragma link C++ struct ROOT::Experimental::RFitPanelComboBoxItem+;
#pragma link C++ class std::vector<ROOT::Experimental::RFitPanelComboBoxItem>+;
#pragma link C++ struct ROOT::Experimental::RFitPanelModel+;
#pragma link C++ class ROOT::Experimental::RFitPanel+;
#pragma link C++ struct ROOT::Experimental::RComboBoxItem+;
#pragma link C++ class std::vector<ROOT::Experimental::RComboBoxItem>+;
#pragma link C++ struct ROOT::Experimental::RFitFuncParameter+;
#pragma link C++ struct ROOT::Experimental::RFitFunc+;
#pragma link C++ struct ROOT::Experimental::RFitPanelModel6+;
#pragma link C++ struct ROOT::Experimental::RFitPanel6Model+;
#pragma link C++ class ROOT::Experimental::RFitPanel6+;
#endif
......@@ -19,6 +19,8 @@
#include <ROOT/RWebWindow.hxx>
#include <ROOT/RFitPanel6Model.hxx>
#include "TH1.h"
#include <vector>
......@@ -26,115 +28,6 @@
namespace ROOT {
namespace Experimental {
struct RComboBoxItem {
std::string fId;
std::string fSet;
RComboBoxItem() = default;
RComboBoxItem(const std::string &id, const std::string &set) : fId(id), fSet(set) {}
};
struct RFitFuncParameter {
int ipar{0};
std::string name;
double value{0.};
bool fixed{false};
double error{0.};
double min{0.}, max{0.};
RFitFuncParameter() = default;
RFitFuncParameter(int _ipar, const std::string &_name) :
ipar(_ipar), name(_name) {}
};
struct RFitFunc {
std::string name;
std::vector<RFitFuncParameter> pars;
};
//Structure for the main fit panel model
struct RFitPanelModel6 {
std::vector<RComboBoxItem> fDataSet;
std::string fSelectDataId;
std::vector<RComboBoxItem> fTypeFunc;
std::string fSelectXYId;
std::vector<RComboBoxItem> fMethod;
std::string fSelectMethodId;
std::vector<RComboBoxItem> fContour1;
std::string fContourPar1Id;
std::vector<RComboBoxItem> fContour2;
std::string fContourPar2Id;
std::vector<RComboBoxItem> fScan;
std::string fScanId;
std::string fRealFunc;
std::string fOption;
std::string fFuncChange;
std::string fMinLibrary;
// all combo items for all methods
//Minimization Tab
std::vector<std::vector<RComboBoxItem>> fMethodMinAll;
//Fit Function --- Type
std::vector<std::vector<RComboBoxItem>> fTypeXYAll;
std::vector<RComboBoxItem> fMethodMin;
// std::vector<RComboBoxItem> fTypeXY;
std::string fSelectTypeId;
std::string fSelectMethodMinId;
float fUpdateMinRange{0};
float fUpdateMaxRange{1};
float fMinRange{0};
float fMaxRange{1};
float fStep{0.1};
float fRange[2];
float fUpdateRange[2];
//float fOperation{0};
float fFitOptions{0};
bool fLinear{false};
bool fRobust{false};
int fLibrary{0};
int fPrint{0};
float fErrorDef{1.00};
float fMaxTol{0.01};
int fMaxInter{0};
//convert fSelectTypeID from string to int
int fTypeId{0};
int fFuncChangeInt{0};
//Checkboxes Options
bool fIntegral{false};
bool fMinusErrors {false};
bool fWeights{false};
bool fBins{false};
bool fUseRange {false};
//bool fImproveFit {false};
bool fAddList {false};
bool fUseGradient {false};
bool fSame {false};
bool fNoDrawing {false};
bool fNoStore {false};
/////////Advanced Options
//Contour Tab
int fContourPar1{0};
int fContourPar2{0};
int fContourPoints{0};
float fConfLevel{0.};
bool fContourImpose{false};
std::string fColorContour[3];
int colorC[3];
//Scan Tab
int fScanPoints{0};
int fScanPar{0};
int fScanMin{0};
int fScanMax{0};
};
class RFitPanel6 {
std::string fTitle; ///<! title
......@@ -162,17 +55,13 @@ public:
// method required when any panel want to be inserted into the RCanvas
std::shared_ptr<RWebWindow> GetWindow();
void AssignHistogram(TH1 *hist)
{
fHist = hist;
}
void AssignHistogram(TH1 *hist) { fHist = hist; }
/// show FitPanel in specified place
void Show(const std::string &where = "");
/// hide FitPanel
void Hide();
};
} // namespace Experimental
......
// \file ROOT/RFitPanel6Model.hxx
/// \ingroup WebGui ROOT7
/// \author Sergey Linev <S.Linev@gsi.de>
/// \author Iliana Betsou <Iliana.Betsou@cern.ch>
/// \date 2019-04-11
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
/// is welcome!
/*************************************************************************
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_RFitPanel6Model
#define ROOT_RFitPanel6Model
#include <vector>
#include <string>
namespace ROOT {
namespace Experimental {
struct RComboBoxItem {
std::string fId;
std::string fSet;
RComboBoxItem() = default;
RComboBoxItem(const std::string &id, const std::string &set) : fId(id), fSet(set) {}
};
struct RFitFuncParameter {
int ipar{0};
std::string name;
double value{0.};
bool fixed{false};
double error{0.};
double min{0.}, max{0.};
RFitFuncParameter() = default;
RFitFuncParameter(int _ipar, const std::string &_name) : ipar(_ipar), name(_name) {}
};
struct RFitFunc {
std::string name;
std::vector<RFitFuncParameter> pars;
};
// Structure for the main fit panel model
struct RFitPanel6Model {
std::vector<RComboBoxItem> fDataSet;
std::string fSelectDataId;
std::vector<RComboBoxItem> fTypeFunc;
std::string fSelectXYId;
std::vector<RComboBoxItem> fMethod;
std::string fSelectMethodId;
std::vector<RComboBoxItem> fContour1;
std::string fContourPar1Id;
std::vector<RComboBoxItem> fContour2;
std::string fContourPar2Id;
std::vector<RComboBoxItem> fScan;
std::string fScanId;
std::string fRealFunc;
std::string fOption;
std::string fFuncChange;
std::string fMinLibrary;
// all combo items for all methods
// Minimization Tab
std::vector<std::vector<RComboBoxItem>> fMethodMinAll;
// Fit Function --- Type
std::vector<std::vector<RComboBoxItem>> fTypeXYAll;
std::vector<RComboBoxItem> fMethodMin;
// std::vector<RComboBoxItem> fTypeXY;
std::string fSelectTypeId;
std::string fSelectMethodMinId;
float fUpdateMinRange{0};
float fUpdateMaxRange{1};
float fMinRange{0};
float fMaxRange{1};
float fStep{0.1};
float fRange[2];
float fUpdateRange[2];
// float fOperation{0};
float fFitOptions{0};
bool fLinear{false};
bool fRobust{false};
int fLibrary{0};
int fPrint{0};
float fErrorDef{1.00};
float fMaxTol{0.01};
int fMaxInter{0};
// convert fSelectTypeID from string to int
int fTypeId{0};
int fFuncChangeInt{0};
// Checkboxes Options
bool fIntegral{false};
bool fMinusErrors{false};
bool fWeights{false};
bool fBins{false};
bool fUseRange{false};
// bool fImproveFit {false};
bool fAddList{false};
bool fUseGradient{false};
bool fSame{false};
bool fNoDrawing{false};
bool fNoStore{false};
/////////Advanced Options
// Contour Tab
int fContourPar1{0};
int fContourPar2{0};
int fContourPoints{0};
float fConfLevel{0.};
bool fContourImpose{false};
std::string fColorContour[3];
// Scan Tab
int fScanPoints{0};
int fScanPar{0};
int fScanMin{0};
int fScanMax{0};
};
} // namespace Experimental
} // namespace ROOT
#endif
/// \file ROOT/RFitPanel.cxx
/// \file RFitPanel.cxx
/// \ingroup WebGui ROOT7
/// \author Sergey Linev <S.Linev@gsi.de>
/// \date 2017-10-24
......@@ -106,8 +106,8 @@ void ROOT::Experimental::RFitPanel::ProcessData(unsigned connid, const std::stri
if (arg.find("DOFIT:") == 0) {
std::stringstream exec;
exec << "((ROOT::Experimental::RFitPanel *) " << std::hex << std::showbase << (size_t)this
<< ")->DoFit(" << arg.c_str() + 6 << ");";
exec << "((ROOT::Experimental::RFitPanel *) " << std::hex << std::showbase << (size_t)this << ")->DoFit("
<< arg.c_str() + 6 << ");";
std::cout << "Execute " << exec.str() << std::endl;
gROOT->ProcessLine(exec.str().c_str());
return;
......
This diff is collapsed.
/// \file RFitPanel6Model.cxx
/// \ingroup WebGui ROOT7
/// \author Sergey Linev <S.Linev@gsi.de>
/// \author Iliana Betsou <Iliana.Betsou@cern.ch>
/// \date 2019-04-11
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
/// is welcome!
/*************************************************************************
* Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include <ROOT/RFitPanel6Model.hxx>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment