Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
CorrFit.h
1/*
2 * CorrFit.h
3 *
4 * Created on: 24 mar 2018
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#ifndef HALCORRFIT_H_
10#define HALCORRFIT_H_
11
12#include "Array.h"
13#include "FitParam.h"
14
15#include <Rtypes.h>
16#include <RtypesCore.h>
17#include <TString.h>
18#include <utility>
19#include <vector>
20
21class TLegend;
22class TLegendEntry;
23class TF1;
24class TVirtualPad;
25
30namespace Hal {
31 class CorrFitGUI;
32 class CorrFitPainter;
33 class CorrFit : public TObject {
34 friend class CorrFitGUI;
35
36 private:
40 Color_t fLineColor;
44 Style_t fLineStyle;
48 Width_t fLineWidth;
49 Int_t fParametersNo;
50
51 public:
57 enum EMinAlgo {
58 kMinuitMigrad,
59 kMinuitSimplex,
60 kMinuitCombined,
61 kMinuitScan,
62 kMinuitFumili,
63 kGLSMultiMinConjungateFR,
64 kGLSMultiMinConjugatePR,
65 kGLSMultiMinBFGS,
66 kGLSMultiMinBFGS2,
67 kGLSMultiMinSteppestDescent,
68 kGLSMultiFit,
69 kGLSSimAn,
70 kDefaultAlgo,
71 kHalScan,
72 kHalAnt,
73 kHalScanMigrad,
74 kHalScanScan
75 };
78 kSimple,
81 };
82
83 protected:
88 EMinFunc fMinFunc;
89 EMinAlgo fMinAlgo;
90 CorrFitPainter* fPainter = {nullptr};
91 std::vector<TString> AlgoToOptions(EMinAlgo algo) const;
95 Int_t fNDF;
99 Double_t fThreshold;
103 std::vector<FitParam> fParameters;
104 std::vector<Int_t> fFitOrder;
105 std::vector<std::pair<TF1*, TVirtualPad*>> fDrawFunc;
109 mutable Double_t* fTempParamsEval; // [fParametersNo]
113 void CheckOrder();
118 void ChangeParametersNo();
122 virtual void ParametersChanged() const {};
127 Color_t GetLineColor() const { return fLineColor; };
132 Style_t GetLineStyle() const { return fLineStyle; };
137 Width_t GetLineWidth() const { return fLineWidth; };
143 TF1* GetTF1(Int_t no) const { return fDrawFunc[no].first; };
148 std::vector<std::pair<TF1*, TVirtualPad*>> GetDrawFunctions() const { return fDrawFunc; };
154 void OverwriteParam(Int_t par, Double_t val) { fParameters[par].SetFittedValue(val); }
161 void CopyParamsToTF1(TF1* f, Bool_t copyNumPar = kTRUE, Bool_t copyGrapPar = kTRUE) const;
162
164 void SetErrorsNegative();
169 void SetFitOrder(std::initializer_list<Int_t> order);
170
171 public:
172 CorrFit(Int_t parameters_no = 2);
179 void SetParLimits(Int_t par, Double_t min, Double_t max);
185 void FixParameter(Int_t par, Double_t val);
191 void SetParameterName(Int_t par, TString name);
196 void SetLineColor(Color_t color) { fLineColor = color; };
201 void SetLineStyle(Style_t style) { fLineStyle = style; };
206 void SetLineWidth(Width_t width) { fLineWidth = width; };
213 void SetThreshold(Double_t thres) { fThreshold = thres; };
217 void PrintFitResults() const;
223 Bool_t IsParFixed(Int_t par) const;
229 Bool_t IsParDiscrete(Int_t par) const;
235 Double_t GetParMin(Int_t par) const;
241 Double_t GetParMax(Int_t par) const;
247 Double_t GetParError(Int_t par) const;
253 Double_t GetParameter(Int_t par) const;
259 const FitParam& GetParamConf(Int_t par) const { return fParameters[par]; }
264 Double_t GetNDF() const { return fNDF; };
269 Int_t GetParametersNo() const { return fParametersNo; };
274 Int_t GetParameterIndex(TString name) const;
280 TString GetParameterName(Int_t no) const { return fParameters[no].GetParName(); };
286 virtual void SetMinimizer(EMinAlgo alg) { fMinAlgo = alg; };
291 void SetMinimizedFunc(EMinFunc f) { fMinFunc = f; };
303 CorrFitPainter* GetPainter() const { return fPainter; }
304 virtual ~CorrFit();
305 ClassDef(CorrFit, 2)
306 };
307} // namespace Hal
308
309#endif /* HALCORRFIT_H_ */
const FitParam & GetParamConf(Int_t par) const
Definition CorrFit.h:259
void PrintFitResults() const
Definition CorrFit.cxx:157
void SetLineWidth(Width_t width)
Definition CorrFit.h:206
Width_t GetLineWidth() const
Definition CorrFit.h:137
Double_t GetParError(Int_t par) const
Definition CorrFit.cxx:149
void OverwriteParam(Int_t par, Double_t val)
Definition CorrFit.h:154
Int_t fNDF
Definition CorrFit.h:95
std::vector< std::pair< TF1 *, TVirtualPad * > > GetDrawFunctions() const
Definition CorrFit.h:148
Int_t GetParametersNo() const
Definition CorrFit.h:269
Double_t fThreshold
Definition CorrFit.h:99
ECalcOption fBinCalc
Definition CorrFit.h:87
void CopyParamsToTF1(TF1 *f, Bool_t copyNumPar=kTRUE, Bool_t copyGrapPar=kTRUE) const
Definition CorrFit.cxx:175
void SetCalculationOption(ECalcOption f)
Definition CorrFit.h:298
TString GetParameterName(Int_t no) const
Definition CorrFit.h:280
CorrFitPainter * GetPainter() const
Definition CorrFit.h:303
Double_t GetParameter(Int_t par) const
Definition CorrFit.cxx:141
Double_t GetParMax(Int_t par) const
Definition CorrFit.cxx:136
Double_t GetParMin(Int_t par) const
Definition CorrFit.cxx:131
Bool_t IsParDiscrete(Int_t par) const
Definition CorrFit.cxx:126
void SetErrorsNegative()
Definition CorrFit.cxx:196
void SetThreshold(Double_t thres)
Definition CorrFit.h:213
Double_t * fTempParamsEval
Definition CorrFit.h:109
void ChangeParametersNo()
Definition CorrFit.cxx:96
void CheckOrder()
Definition CorrFit.cxx:221
void SetLineColor(Color_t color)
Definition CorrFit.h:196
Style_t GetLineStyle() const
Definition CorrFit.h:132
void SetFitOrder(std::initializer_list< Int_t > order)
Definition CorrFit.cxx:201
virtual void ParametersChanged() const
Definition CorrFit.h:122
TF1 * GetTF1(Int_t no) const
Definition CorrFit.h:143
Double_t GetNDF() const
Definition CorrFit.h:264
Color_t GetLineColor() const
Definition CorrFit.h:127
void FixParameter(Int_t par, Double_t val)
Definition CorrFit.cxx:106
void SetParameterName(Int_t par, TString name)
Definition CorrFit.cxx:110
void SetMinimizedFunc(EMinFunc f)
Definition CorrFit.h:291
void SetParLimits(Int_t par, Double_t min, Double_t max)
Definition CorrFit.cxx:102
void SetLineStyle(Style_t style)
Definition CorrFit.h:201
std::vector< FitParam > fParameters
Definition CorrFit.h:103
@ kExtrapolated
Definition CorrFit.h:79
Int_t GetParameterIndex(TString name) const
Definition CorrFit.cxx:114
virtual void SetMinimizer(EMinAlgo alg)
Definition CorrFit.h:286
Bool_t IsParFixed(Int_t par) const
Definition CorrFit.cxx:121