KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVGumbelDistribution.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Mon Mar 19 12:14:55 2012
2 //Author: John Frankland,,,
3 
4 #include "KVGumbelDistribution.h"
5 #include "TMath.h"
6 
8 
9 
10 
11 
12 
16  : TF1()
17 {
18  // default ctor
19 }
20 
21 
22 
23 
28 
30  Double_t xmin, Double_t xmax)
31  : TF1(name, this, &KVGumbelDistribution::GDk, xmin, xmax, 3 - (int)norm,
32  "KVGumbelDistribution", "GDk")
33 {
34  // Gumbel distribution of k-th rank
35  // if norm=kTRUE: normalised PDF, 2 free parameters (a,b)
36  // if norm=kFALSE: 3 parameters (a,b,Integral)
37  fRank = k;
38  fkFac = TMath::Power(k, k) / TMath::Factorial(k - 1);
39  fNormalised = norm;
40  SetParName(0, "a_{m}");
41  SetParLimits(0, 0, 100);
42  SetParName(1, "b_{m}");
43  SetParLimits(1, 0, 100);
44  if (!norm) SetParName(2, "Integral");
45 }
46 
47 
48 
49 
56 
58 {
59  // Copy constructor
60  // This ctor is used to make a copy of an existing object (for example
61  // when a method returns an object), and it is always a good idea to
62  // implement it.
63  // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
64 
65  obj.Copy(*this);
66 }
67 
68 
69 
72 
74 {
75  // Destructor
76 }
77 
78 
79 
80 
88 
90 {
91  // This method copies the current state of 'this' object into 'obj'
92  // You should add here any member variables, for example:
93  // (supposing a member variable KVGumbelDistribution::fToto)
94  // CastedObj.fToto = fToto;
95  // or
96  // CastedObj.SetToto( GetToto() );
97 
98  TF1::Copy(obj);
99  KVGumbelDistribution& CastedObj = (KVGumbelDistribution&)obj;
100  CastedObj.fRank = fRank;
101  CastedObj.fkFac = fkFac;
102  CastedObj.fNormalised = fNormalised;
103 }
104 
105 
106 
107 
115 
117 {
118  // Evaluate Gumbel distribution of rank fRank for x
119  // with parameters
120  // par[0] = a
121  // par[1] = b
122  // If distribution is not normalised, then we have
123  // par[2] = normalisation
124 
125  if (p[1] == 0.) return 0.;
126  Double_t s = (*x - p[0]) / p[1];
127  Double_t gum = (fkFac / p[1]);
128  Double_t es = -fRank * (s + TMath::Exp(-s));
129  gum *= TMath::Exp(es);
130  if (!fNormalised) gum *= p[2];
131  return gum;
132 }
133 
134 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
bool Bool_t
double Double_t
float xmin
float xmax
Gumbel distributions for rank-ordered extremal variables.
void Copy(TObject &) const
KVGumbelDistribution()
default ctor
Bool_t fNormalised
=kTRUE if distribution is normalised
virtual ~KVGumbelDistribution()
Destructor.
Double_t GDk(Double_t *x, Double_t *p)
Int_t fRank
rank of distribution
virtual void Copy(TObject &f1) const
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
virtual void SetParName(Int_t ipar, const char *name)
Double_t x[n]
const long double s
Definition: KVUnits.h:94
Double_t Factorial(Int_t i)
Double_t Exp(Double_t x)
Double_t Power(Double_t x, Double_t y)