KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVGaus1D.cpp
1//Created by KVClassFactory on Tue Feb 7 16:09:40 2012
2//Author: bonnet
3
4#include "KVGaus1D.h"
5#include "TFrame.h"
6
8
9
10
12
14{
15 // Default constructor
16 SetName("Gaus1D");
17}
18
19
20
27
29{
30 // Copy constructor
31 // This ctor is used to make a copy of an existing object (for example
32 // when a method returns an object), and it is always a good idea to
33 // implement it.
34 // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
35
36}
37
38
39
42
44{
45 // Destructor
46}
47
48
49
50
52
54{
55
56 Int_t nf = lfunc->GetEntries();
57
58 f1Dfit = new TF1(Form("func_%d", ++nf), "gaus", Xmin, Xmax);
60
64 hclone->GetMean(),
65 hclone->GetRMS()
66 );
67 return kTRUE;
68
69}
70
71
72
74
76{
77
78 Int_t event = gPad->GetEvent();
79 TObject* select = gPad->GetSelected();
80 if (!select) return;
81
82 if (event == kButton1Down) {
83 if (!strcmp("Gather", select->GetTitle())) {
84 Info("", "On fit tous les pics gaussiens");
85
86 Double_t xdeb = c1->GetFrame()->GetX1();
87 Double_t xfin = c1->GetFrame()->GetX2();
88 Int_t nfin = 0;
89 TF1* f1;
90 TIter it(lfunc);
91 while ((f1 = (TF1*)it.Next())) {
92 if (xdeb <= f1->GetParameter(1) && f1->GetParameter(1) <= xfin) {
93 nfin += 1;
94 }
95 }
96 TString expr = "";
97 TString ff = "";
98 for (Int_t ii = 0; ii < nfin; ii += 1) {
99 ff.Form("gaus(%d)", ii * 3);
100 expr += ff;
101 if (ii < nfin - 1)
102 expr += "+";
103 }
104
105 TF1* fsum = new TF1("sum", expr.Data(), xdeb, xfin);
106 Int_t np = 0;
107 it.Reset();
108 while ((f1 = (TF1*)it.Next())) {
109 for (Int_t ii = 0; ii < f1->GetNpar(); ii += 1) {
110 fsum->SetParameter(np++, f1->GetParameter(ii));
111 }
112 }
113 hfit->Fit(fsum, "0N", "", xdeb, xfin);
114 fsum->SetLineColor(4);
115 fsum->SetLineWidth(2);
116 fsum->Draw("same");
117
118 lfunc->Add(fsum);
119 c1->Update();
120 }
121 }
122
123}
124
125
kButton1Down
int Int_t
bool Bool_t
double Double_t
constexpr Bool_t kTRUE
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
char * Form(const char *fmt,...)
#define gPad
Manage SemiAutomatic Fits.
Definition KVAutoFit.h:26
KVHashList * lfunc
liste des fonctions de fit
Definition KVAutoFit.h:29
Double_t Xmax
Borne en X du fit.
Definition KVAutoFit.h:40
Double_t Xmin
Definition KVAutoFit.h:40
TH1 * hfit
histogramme analyse
Definition KVAutoFit.h:34
TCanvas * c1
Canvas ou est trace l histo a analyse.
Definition KVAutoFit.h:36
TH1 * hclone
clone de histogramme analyse
Definition KVAutoFit.h:35
TF1 * f1Dfit
fonction de fit une dimension
Definition KVAutoFit.h:31
Handle semi-automatic fit to 1D Gaussian distributions.
Definition KVGaus1D.h:16
virtual ~KVGaus1D()
Destructor.
Definition KVGaus1D.cpp:43
void Gather()
Definition KVGaus1D.cpp:75
KVGaus1D(Bool_t batch=kFALSE)
Default constructor.
Definition KVGaus1D.cpp:13
Bool_t NewFunction_1D()
Definition KVGaus1D.cpp:53
virtual void Add(TObject *obj)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Double_t GetX1() const
Double_t GetX2() const
void Update() override
virtual Int_t GetEntries() const
virtual Double_t GetParameter(const TString &name) const
virtual Int_t GetNpar() const
void Draw(Option_t *option="") override
virtual void SetParameters(const Double_t *params)
virtual void SetParameter(const TString &name, Double_t value)
virtual Double_t GetMean(Int_t axis=1) const
TAxis * GetXaxis()
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Double_t GetRMS(Int_t axis=1) const
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
TObject * Next()
void Reset()
virtual const char * GetTitle() const
virtual void Info(const char *method, const char *msgfmt,...) const
TFrame * GetFrame() override
const char * Data() const
void Form(const char *fmt,...)
gr SetName("gr")
TF1 * f1
ClassImp(TPyArg)