KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
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
16
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
49
51{
52 // Destructor
53}
54
55
56
58
60{
61
62 Int_t nf = lfunc->GetEntries();
63
64 f2Dfit = new TF2(Form("func_%d", ++nf),
65 this,
67 Xmin,
68 Xmax,
69 Ymin,
70 Ymax,
71 6,
72 GetName(),
73 "f2D"
74 );
75
77
80
82 hclone->GetMean(1),
83 hclone->GetRMS(1),
84 hclone->GetMean(2),
85 hclone->GetRMS(2),
86 ((TH2*)hclone)->GetCorrelationFactor(),
88 );
89
90 return kTRUE;
91}
92
93
94
96
98{
99
100 TF2* f2 = new TF2(nom,
101 this,
103 0, 1, 0, 1,
104 npar,
105 GetName(),
106 "f2D"
107 );
108
109 return f2;
110}
111
112
113
118
120{
121
122//Function gaussienne 2D
123//
124// E1 vs E2
125
127
128 Double_t e2 = xx[0];
129 Double_t e1 = xx[1];
130
131 Double_t E2 = para[0];
132 Double_t sigE2 = para[1];
133 Double_t E1 = para[2];
134 Double_t sigE1 = para[3];
135 Double_t rho = para[4];
136 Double_t norm = para[5];
137
138 Double_t dE1 = E1 - e1;
139 Double_t dE2 = E2 - e2;
140
141 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);
142 Double_t det = (1. - TMath::Power(rho, 2.)) * TMath::Power(sigE1 * sigE2, 2.);
143 Double_t P = norm * 1. / det * exp(A);
144
145 return P;
146
147}
148
149
150
152
154{
155 TMarker* m1 = new TMarker(f2Dfit->GetParameter(0), f2Dfit->GetParameter(2), 8);
156 m1->SetMarkerSize(0.7);
157
158 m1->Draw();
159}
160
161
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
virtual void ExtraDrawing()
Definition KVAutoFit.h:95
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
virtual ~KVGaus2D()
Destructor.
Definition KVGaus2D.cpp:50
virtual Double_t f2D(Double_t *xx, Double_t *para)
Definition KVGaus2D.cpp:119
virtual TF1 * ReloadFunction_2D(const Char_t *, Int_t)
Definition KVGaus2D.cpp:97
KVGaus2D(Bool_t batch=kFALSE)
Default constructor.
Definition KVGaus2D.cpp:17
virtual Bool_t NewFunction_2D()
Definition KVGaus2D.cpp:59
virtual void Add(TObject *obj)
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)