KaliVeda
Toolkit for HIC analysis
KVGaus2D.cpp
1 //Created by KVClassFactory on Tue Feb 7 16:49:15 2012
2 //Author: bonnet
3 
4 #include "KVGaus2D.h"
5 #include "TH2.h"
6 #include "Riostream.h"
7 #include "TMath.h"
8 #include "TMarker.h"
9 
11 
12 //________________________________________________________________
13 
14 
18 {
19  // Default constructor
20  SetName("Gaus2D");
21  is2D = kTRUE;
22 
23 }
24 
25 
26 
27 
34 
36 {
37  // Copy constructor
38  // This ctor is used to make a copy of an existing object (for example
39  // when a method returns an object), and it is always a good idea to
40  // implement it.
41  // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
42 
43 }
44 
45 
46 
48 
50 {
51 
52  Int_t nf = lfunc->GetEntries();
53 
54  f2Dfit = new TF2(Form("func_%d", ++nf),
55  this,
57  Xmin,
58  Xmax,
59  Ymin,
60  Ymax,
61  6,
62  GetName(),
63  "f2D"
64  );
65 
66  lfunc->Add(f2Dfit);
67 
70 
72  hclone->GetMean(1),
73  hclone->GetRMS(1),
74  hclone->GetMean(2),
75  hclone->GetRMS(2),
76  ((TH2*)hclone)->GetCorrelationFactor(),
77  hclone->Integral()
78  );
79 
80  return kTRUE;
81 }
82 
83 
84 
86 
88 {
89 
90  TF2* f2 = new TF2(nom,
91  this,
93  0, 1, 0, 1,
94  npar,
95  GetName(),
96  "f2D"
97  );
98 
99  return f2;
100 }
101 
102 
103 
108 
110 {
111 
112 //Function gaussienne 2D
113 //
114 // E1 vs E2
115 
116  userdefined = kTRUE;
117 
118  Double_t e2 = xx[0];
119  Double_t e1 = xx[1];
120 
121  Double_t E2 = para[0];
122  Double_t sigE2 = para[1];
123  Double_t E1 = para[2];
124  Double_t sigE1 = para[3];
125  Double_t rho = para[4];
126  Double_t norm = para[5];
127 
128  Double_t dE1 = E1 - e1;
129  Double_t dE2 = E2 - e2;
130 
131  Double_t A = -0.5 / ((1. - TMath::Power(rho, 2.)) * TMath::Power(sigE1 * sigE2, 2.)) * (TMath::Power(dE1 * sigE2, 2.) + TMath::Power(dE2 * sigE1, 2.) - 2.*rho * dE1 * dE2 * sigE1 * sigE2);
132  Double_t det = (1. - TMath::Power(rho, 2.)) * TMath::Power(sigE1 * sigE2, 2.);
133  Double_t P = norm * 1. / det * exp(A);
134 
135  return P;
136 
137 }
138 
139 
140 
142 
144 {
145  TMarker* m1 = new TMarker(f2Dfit->GetParameter(0), f2Dfit->GetParameter(2), 8);
146  m1->SetMarkerSize(0.7);
147 
148  m1->Draw();
149 }
150 
151 
int Int_t
bool Bool_t
char Char_t
double Double_t
constexpr Bool_t kTRUE
char * Form(const char *fmt,...)
Manage SemiAutomatic Fits.
Definition: KVAutoFit.h:26
KVHashList * lfunc
liste des fonctions de fit
Definition: KVAutoFit.h:29
Bool_t userdefined
Definition: KVAutoFit.h:51
Double_t Xmax
Borne en X du fit.
Definition: KVAutoFit.h:40
TF2 * f2Dfit
fonction de fit deux dimensions
Definition: KVAutoFit.h:32
Double_t Xmin
Definition: KVAutoFit.h:40
Double_t Ymax
Borne en Y du fit.
Definition: KVAutoFit.h:41
TH1 * hclone
clone de histogramme analyse
Definition: KVAutoFit.h:35
Double_t Ymin
Definition: KVAutoFit.h:41
Handle semi-automatic fit to 2D Gaussian distributions.
Definition: KVGaus2D.h:17
Bool_t NewFunction_2D() override
Definition: KVGaus2D.cpp:49
TF1 * ReloadFunction_2D(const Char_t *, Int_t) override
Definition: KVGaus2D.cpp:87
void ExtraDrawing() override
Definition: KVGaus2D.cpp:143
KVGaus2D(Bool_t batch=kFALSE)
Default constructor.
Definition: KVGaus2D.cpp:17
Double_t f2D(Double_t *xx, Double_t *para) override
Definition: KVGaus2D.cpp:109
void Add(TObject *obj) override
virtual void SetMarkerSize(Size_t msize=1)
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
virtual Int_t GetEntries() const
virtual Double_t GetParameter(const TString &name) const
virtual void SetParameters(const Double_t *params)
virtual Double_t GetMean(Int_t axis=1) const
TAxis * GetXaxis()
TAxis * GetYaxis()
Double_t GetRMS(Int_t axis=1) const
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
void Draw(Option_t *option="") override
const char * GetName() const override
RVec< PromoteType< T > > exp(const RVec< T > &v)
gr SetName("gr")
Double_t Power(Double_t x, Double_t y)
ClassImp(TPyArg)