ROOTTools
 
Loading...
Searching...
No Matches
GUIFit.hpp
Go to the documentation of this file.
1
11#ifndef ROOT_TOOLS_GUI_FIT_HPP
12#define ROOT_TOOLS_GUI_FIT_HPP
13
14#include <stdio.h>
15
16#include <iostream>
17#include <fstream>
18#include <sstream>
19#include <string>
20#include <vector>
21#include <iomanip>
22
23#include "TPad.h"
24#include "TFrame.h"
25#include "TH1.h"
26#include "TLatex.h"
27#include "TGraph.h"
28#include "TF1.h"
29
31namespace ROOTTools
32{
38 class GUIFit
39 {
40 public:
41
42 GUIFit();
43
44 void AddFitType(const std::string& outputFileName);
45 void AddHist(TH1F *dataHist, const std::string& xVal);
46 void AddFit(TF1 *fit, TF1 *bgFit, const int bgFitParStartNumber, const unsigned int histNumber);
47 void AddFit(TF1 *fit, TF1 *bgFit, Double_t (*fcn)(Double_t *, Double_t *),
48 const int bgFitParStartNumber, const unsigned int histNumber);
49 void AddFit(TF1 *fit, TF1 *bgFit, const int bgFitParStartNumber);
50 void AddFit(TF1 *fit, TF1 *bgFit, Double_t (*fcn)(Double_t *, Double_t *),
51 const int bgFitParStartNumber);
52 void Start();
53
54 ~GUIFit();
55
56 private:
57
58 void SetBgPoints();
59 void SetActiveFit();
60 void PerformFreeFit();
61 void ResetFit();
62 bool IsActivePoint();
63 void ActivatePoint(const int pointNumber, const double x, const double y);
64 void DeactivatePoint();
65 void PrintHelp();
66 void Draw(bool doDrawHist = true, bool isFirstDraw = true);
67
68 std::vector<TH1F *> hists;
69 std::vector<std::string> histsXValues;
70
71 std::vector<std::string> outputFilesNames;
72 std::vector<std::ofstream> outputFiles;
73
74 std::vector<std::vector<TF1 *>> fits, bgFits;
75 std::vector<std::vector<int>> bgFitParNumbersStart;
76
77 TLatex fitsNames = TLatex(0.2, 0.2, "");
78 TLatex chi2NDF = TLatex(0.8, 0.9, "");
79
80 //graph that contains points for background tweaking
81 TGraph *bgPointsGr;
82
83 long unsigned int currentHistId = -1;
84 unsigned long currentFitModeId = 0;
85
86 bool isFitPointActive = false;
87 int currentActivePointId = -1;
88 TGraph *currentActivePointGr;
89
90 const Color_t activeColor = kRed + 1;
91 };
92}
93
94#endif /* ROOT_TOOLS_GUI_FIT_HPP */
~GUIFit()
Definition GUIFit.cpp:253
void AddFitType(const std::string &outputFileName)
Definition GUIFit.cpp:22
void AddFit(TF1 *fit, TF1 *bgFit, const int bgFitParStartNumber, const unsigned int histNumber)
Definition GUIFit.cpp:40
void AddHist(TH1F *dataHist, const std::string &xVal)
Definition GUIFit.cpp:29
void Start()
Definition GUIFit.cpp:91
GUIFit()
Definition GUIFit.cpp:16