KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVGumGumDistribution.cpp
1//Created by KVClassFactory on Wed Jun 13 11:49:37 2012
2//Author: dgruyer
3
4#include "KVGumGumDistribution.h"
5#include "TMath.h"
6#include "Riostream.h"
7
9
10
11
12
14
15KVGumGumDistribution::KVGumGumDistribution(): TF1(), fFirstGumbel(0), fLastGumbel(0)
16{
17 // Default constructor
19 SetNpx(2000);
20 fkFac = 0.;
21}
22
23
24
25
30
32 : TF1(name, this, &KVGumGumDistribution::GDk, xmin, xmax, 5,
33 "KVGumGumDistribution", "GDk"), fFirstGumbel(0), fLastGumbel(0)
34{
35 // normalised sum of Gumbel distribution and Gumbel distribution of k-th rank
36 // f = eta*Gumbel(mu,sigma) + (1-eta)*Gumbel(ap,bp)
37 // free parameters: gauss: (mean,sigma) gumbel: (a,b) eta
38 fRank = k;
39 fkFac = TMath::Power(k, k) / TMath::Factorial(k - 1);
40
41 SetParName(0, "#eta");
42 SetParName(1, "#mu");
43 SetParName(2, "#sigma");
44 SetParName(3, "#mu-a_{m}");
45 SetParName(4, "b_{m}");
46
47 SetParLimits(0, 0., 1.);
49 SetParLimits(2, 0.01, 200.);
50 SetParLimits(3, 0.01, 300.);
51 SetParLimits(4, 0.01, 200.);
52
54 SetNpx(2000);
55}
56
57
58
59
66
68{
69 // Copy constructor
70 // This ctor is used to make a copy of an existing object (for example
71 // when a method returns an object), and it is always a good idea to
72 // implement it.
73 // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
74
75 obj.Copy(*this);
76}
77
78
79
82
89
90
91
92
100
102{
103 // This method copies the current state of 'this' object into 'obj'
104 // You should add here any member variables, for example:
105 // (supposing a member variable KVGumGumDistribution::fToto)
106 // CastedObj.fToto = fToto;
107 // or
108 // CastedObj.SetToto( GetToto() );
109
110 TF1::Copy(obj);
112 CastedObj.fRank = fRank;
113 CastedObj.fkFac = fkFac;
114}
115
116
117
118
121
123{
124 // Draw total distribution and the two component distributions
125
127
128 if (!fLastGumbel) fLastGumbel = new KVGumbelDistribution("GumbelLast", fRank, false, GetXmin(), GetXmax());
129 if (!fFirstGumbel) fFirstGumbel = new KVGumbelDistribution("GumbelFirst", fRank, false, GetXmin(), GetXmax());
132
136 fLastGumbel->SetNpx(2000);
137
140 fFirstGumbel->SetNpx(2000);
141
144}
145
146
147
148
149
159
161{
162 // Evaluate normalised sum of Gaussian and Gumbel distribution of rank fRank for x
163 // with parameters
164 // par[0] = eta
165 // par[1] = mu
166 // par[2] = sigma
167 // par[3] = distance between gaussian and gumbel >=0
168 // par[4] = b
169
170// if(p[4]==0) return 0;
171
172 Double_t am = p[1] - p[3];
173 Double_t s = (*x - am) / p[4];
174 Double_t gum = (fkFac / p[4]);
175 Double_t es = -fRank * (s + TMath::Exp(-s));
176 gum *= TMath::Exp(es);
177
178 Double_t am2 = p[1];
179 Double_t bm2 = -p[2];
180 Double_t s2 = (*x - am2) / bm2;
181 Double_t gum2 = -(fkFac / bm2);
182 Double_t es2 = -fRank * (s2 + TMath::Exp(-s2));
183 gum2 *= TMath::Exp(es2);
184
185 Double_t gg = p[0] * gum2 + (1. - p[0]) * gum;
186 return gg;
187}
188
189
190
int Int_t
#define SafeDelete(p)
char Char_t
double Double_t
const char Option_t
kRed
kBlack
kBlue
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t SetLineColor
char name[80]
float xmin
float xmax
Sum of normalised Gumbel first asymptote and Gumbel last asymptote.
Double_t GDk(Double_t *x, Double_t *p)
void Copy(TObject &) const
void Paint(Option_t *option="")
Draw total distribution and the two component distributions.
KVGumGumDistribution()
Default constructor.
virtual ~KVGumGumDistribution()
Destructor.
KVGumbelDistribution * fFirstGumbel
non-persistent (not written to disk)
Int_t fRank
rank of Gumbel distribution
KVGumbelDistribution * fLastGumbel
non-persistent (not written to disk)
Gumbel distributions for rank-ordered extremal variables.
virtual void SetLineStyle(Style_t lstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual Double_t GetXmax() const
virtual Double_t GetParameter(const TString &name) const
virtual void SetNpx(Int_t npx=100)
void Copy(TObject &f1) const override
void Paint(Option_t *option="") override
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
virtual void SetParName(Int_t ipar, const char *name)
virtual void SetParameters(const Double_t *params)
virtual Double_t GetXmin() const
Double_t x[n]
Double_t Factorial(Int_t i)
Double_t Exp(Double_t x)
Double_t Power(Double_t x, Double_t y)
ClassImp(TPyArg)