Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
CorrFitFunc.h
1/*
2 * CorrFit.h
3 *
4 * Created on: 08-04-2015
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#ifndef HALCORRFITFUNC_H_
11#define HALCORRFITFUNC_H_
12
13#include "CorrFit.h"
14
15#include "Array.h"
16#include "FemtoConst.h"
17#include "MinimizerStepConf.h"
18
19#include <Rtypes.h>
20#include <RtypesCore.h>
21#include <TMath.h>
22#include <TString.h>
23
24
25class TF1;
26class TH1;
27
28
32//#define CF_FIT_TRACKING
33namespace ROOT {
34 namespace Math {
35 class Minimizer;
36 }
37} // namespace ROOT
38namespace Hal {
39 class CorrFitGUI;
40 class CorrFitMask;
41 class ChiSqMap2D;
42 class CorrFitHDFunc;
43 class CorrFitPainter;
44 class CorrFitFunc : public CorrFit {
45 friend class Femto1DCF;
46 friend class Femto3DCF;
47 friend class FemtoSHCF;
48 friend class CorrFitPainter;
49
50 void PrepareSecondMiminizer(ROOT::Math::Minimizer* min, const double* pars, const double* errors) const;
51 void SetParsOfMinimizer(ROOT::Math::Minimizer* min) const;
52 Int_t CountNDF() const;
53 ROOT::Math::Minimizer* GetMinimizer1(EMinAlgo algo) const;
54 ROOT::Math::Minimizer* GetMinimizer2(EMinAlgo algo) const;
55
56 protected:
61 virtual void RecalculateFunction() const {};
65 virtual void RecalculateSmoothFunction() const = 0;
69 Femto::EKinematics fKinematics;
73 const Int_t fDim;
77 Double_t fChi[2];
85 Int_t fNormParIndex = {0};
89 Double_t fTolerance;
93 Double_t fActiveBins;
101 Bool_t fTrace;
109 TObject* fCF;
130 MinimizerStepConf fDiscretteMinimzerConf;
141 virtual void PrepareHalMinimizer() const;
145 virtual void PrepareRootMinimizer(ROOT::Math::Minimizer* minizer) const;
149 virtual void EstimateActiveBins() = 0;
154 void SetupFunction(TF1* f) const;
168 void NumericalPreMinimization(Double_t bins);
178 void ParametersChanged() const { // TODO optimize
181 }
187 virtual void Fit(TObject* histo);
191 virtual void FitDummy(TObject* histo);
195 virtual void Check();
200 virtual void Prepare();
204 virtual void PrepareRaw() = 0;
208 virtual void MakePainter(TString options) = 0;
213 void FitStep(Int_t /*step*/) {};
219 double FunctorChiTFD(const double* params);
225 double FunctorChiTF(const double* params);
233 double FunctorLogTFD(const double* params);
234 //{ParametersChanged(params);return
235 // GetLogTFD(params);};//fgMinimizer->GetLogTFD(params);}
236 virtual double GetChiTFD(const double* params) const = 0;
237 virtual double GetLogTFD(const double* params) const = 0;
238 virtual double GetChiTF(const double* params) const = 0;
245 virtual void SetErrors(TH1* num, const TH1* den) const = 0;
255 void CalcError(const Double_t Num,
256 const Double_t NumErr,
257 const Double_t Den,
258 const Double_t DenErr,
259 Double_t& cf,
260 Double_t& cfe) const;
261
262 public:
268 CorrFitFunc(Int_t nparams = 1, Int_t dim = 1);
273 void SetTolerance(Double_t tol) { fTolerance = tol; };
278 void SetMaxIteration(Int_t max) { fMaxIterations = max; };
284 void SetRange(Double_t min, Double_t max);
288 void TraceFitting() { fTrace = kTRUE; };
293 virtual void SetFittingMask(const CorrFitMask& map) = 0;
298 void SetMinimizerConf(const MinimizerStepConf& conf) { fDiscretteMinimzerConf = conf; };
303 void SetMinimizerConf(TString xmlFile);
308 void MakeDummyXMLConfig(TString xmlFile);
313 Int_t GetFreeParamsNo() const;
320 Double_t GetChiSquare(Option_t* opt = "fitted") const;
328 Double_t GetChiNDF(Option_t* opt = "fitted") const;
334 Double_t GetRangeMin(Int_t flag = 0) const;
340 Double_t GetRangeMax(Int_t flag = 0) const;
352 GetChiSquareMap(Int_t par1, Int_t par1_steps, Int_t par2, Int_t par2_steps, Bool_t scale = kTRUE, EMinFunc = kChi2) const;
366 ChiSqMap2D* GetChiSquareMap(Int_t par1,
367 Int_t par1_steps,
368 Double_t par1_min,
369 Double_t par1_max,
370 Int_t par2,
371 Int_t par2_steps,
372 Double_t par2_min,
373 Double_t par2_max,
374 Bool_t scale = kTRUE,
375 EMinFunc = kChi2) const;
376 TF1* GetFittedFunction() const;
377 CorrFitHDFunc* GetHD() const { return fHDMaps; };
384 virtual void PreFit(TObject* histo, Double_t bins = 1);
389 Double_t GetNorm() const { return GetParameter(NormID()); };
394 inline Int_t NormID() const { return fNormParIndex; };
399 Double_t GetNormError() const { return GetParError(fNormParIndex); };
405 void SetNormLimits(Double_t min, Double_t max) { SetParLimits(NormID(), min, max); }
406 virtual void Draw(Option_t* option = "");
407 virtual void Repaint();
413 Hal::CorrFitGUI* StartGui(Int_t prec = -1);
414 CorrFitPainter* GetPainter() const { return fPainter; }
415 virtual ~CorrFitFunc();
416 ClassDef(CorrFitFunc, 1)
417 };
418} // namespace Hal
419#endif /* HALCORRFITFUNC_H_ */
TH1 * fDenominatorHistogram
virtual void PrepareRootMinimizer(ROOT::Math::Minimizer *minizer) const
Double_t fTolerance
Definition CorrFitFunc.h:89
double FunctorLogTFD(const double *params)
CorrFitPainter * fPainter
void ParametersChanged() const
virtual void PreFit(TObject *histo, Double_t bins=1)
Double_t GetNormError() const
void MakeDummyXMLConfig(TString xmlFile)
TH1 * fCorrelationFunctionHistogram
virtual void SetErrors(TH1 *num, const TH1 *den) const =0
Int_t NormID() const
double FunctorChiTF(const double *params)
CorrFitHDFunc * fHDMaps
ChiSqMap2D * GetChiSquareMap(Int_t par1, Int_t par1_steps, Int_t par2, Int_t par2_steps, Bool_t scale=kTRUE, EMinFunc=kChi2) const
virtual void SetFittingMask(const CorrFitMask &map)=0
Double_t GetRangeMin(Int_t flag=0) const
void NumericalPreMinimization(Double_t bins)
void DummyNumericalFunction()
virtual void RecalculateFunction() const
Definition CorrFitFunc.h:61
Double_t GetNorm() const
Femto::EKinematics fKinematics
Definition CorrFitFunc.h:69
virtual void Prepare()
Double_t fActiveBins
Definition CorrFitFunc.h:93
virtual void FitDummy(TObject *histo)
virtual void Fit(TObject *histo)
void FitStep(Int_t)
void NumericalMinimization()
void SetTolerance(Double_t tol)
Hal::CorrFitGUI * StartGui(Int_t prec=-1)
Double_t fChi[2]
Definition CorrFitFunc.h:77
virtual void EstimateActiveBins()=0
void SetupFunction(TF1 *f) const
CorrFitMask * fMask
void SetNormLimits(Double_t min, Double_t max)
Double_t GetChiNDF(Option_t *opt="fitted") const
virtual void PrepareHalMinimizer() const
virtual void MakePainter(TString options)=0
void CalcError(const Double_t Num, const Double_t NumErr, const Double_t Den, const Double_t DenErr, Double_t &cf, Double_t &cfe) const
void SetMinimizerConf(const MinimizerStepConf &conf)
void SetRange(Double_t min, Double_t max)
virtual void Check()
Int_t GetFreeParamsNo() const
TH1 * fNumeratorHistogram
virtual void RecalculateSmoothFunction() const =0
void SetMaxIteration(Int_t max)
double FunctorChiTFD(const double *params)
virtual void PrepareRaw()=0
const Int_t fDim
Definition CorrFitFunc.h:73
Double_t GetRangeMax(Int_t flag=0) const
CorrFitFunc(Int_t nparams=1, Int_t dim=1)
Array_1< Double_t > fRange
Definition CorrFitFunc.h:97
Double_t GetChiSquare(Option_t *opt="fitted") const
Double_t GetParError(Int_t par) const
Definition CorrFit.cxx:149
Double_t GetParameter(Int_t par) const
Definition CorrFit.cxx:141
void SetParLimits(Int_t par, Double_t min, Double_t max)
Definition CorrFit.cxx:102