KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVGaus2D.cpp
Go to the documentation of this file.
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 
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 
76  lfunc->Add(f2Dfit);
77 
80 
82  hclone->GetMean(1),
83  hclone->GetRMS(1),
84  hclone->GetMean(2),
85  hclone->GetRMS(2),
86  ((TH2*)hclone)->GetCorrelationFactor(),
87  hclone->Integral()
88  );
89 
90  return kTRUE;
91 }
92 
93 
94 
96 
98 {
99 
100  TF2* f2 = new TF2(nom,
101  this,
102  &KVGaus2D::f2D,
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 
126  userdefined = kTRUE;
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
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
bool Bool_t
double Double_t
const Bool_t kTRUE
double exp(double)
char * Form(const char *fmt,...)
Manage SemiAutomatic Fits.
Definition: KVAutoFit.h:25
KVHashList * lfunc
liste des fonctions de fit
Definition: KVAutoFit.h:28
Bool_t userdefined
Definition: KVAutoFit.h:50
Double_t Xmax
Borne en X du fit.
Definition: KVAutoFit.h:39
TF2 * f2Dfit
fonction de fit deux dimensions
Definition: KVAutoFit.h:31
Double_t Xmin
Definition: KVAutoFit.h:39
virtual void ExtraDrawing()
Definition: KVAutoFit.h:94
Double_t Ymax
Borne en Y du fit.
Definition: KVAutoFit.h:40
TH1 * hclone
clone de histogramme analyse
Definition: KVAutoFit.h:34
Double_t Ymin
Definition: KVAutoFit.h:40
Handle semi-automatic fit to 2D Gaussian distributions.
Definition: KVGaus2D.h:16
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)
TAxis * GetXaxis()
virtual Double_t GetMean(Int_t axis=1) const
TAxis * GetYaxis()
Double_t GetRMS(Int_t axis=1) const
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
virtual void Draw(Option_t *option="")
virtual const char * GetName() const
gr SetName("gr")
Double_t Power(Double_t x, Double_t y)