Go to the source code of this file.
Definition at line 13 of file ana_track.C.
References c1, ctime, Double_t, f, fitf(), func, h, rtime, s, and timer.
17 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
19 gSystem->Load(
"libHyp");
25 gStyle->SetPalette(1);
27 TFile*
f =
new TFile(
"HypIdrecdos2.root");
28 TCanvas *
c1 =
new TCanvas(
"c1",
"the fit canvas",700,800);
29 TH1F*
h = (TH1F*)f->Get(
"PndHypDKalman/pH");
32 cout<<
" Peak search and gauss fit on the spectrum..."<<endl;
34 TSpectrum *
s =
new TSpectrum(50);
35 Int_t nfound = s->Search(h,0.006,
"",0.2);
36 cout<<
" **** "<<nfound <<
" peaks are found by the peak search."<<endl;
38 Float_t *xpeaks = s->GetPositionX();
39 Float_t xp =xpeaks[0];
40 Int_t bin = h->GetXaxis()->FindBin(xp);
41 Float_t yp = h->GetBinContent(bin);
46 TF1 *
func =
new TF1(
"fitf",
fitf,0.,0.2,3);
50 func->SetParameter(0,yp);
52 func->SetParName(0,
"A");
54 func->SetParameter(1,xp);
56 func->SetParName(1,
"m2");
58 func->SetParameter(2,0.003);
60 func->SetParName(2,
"sigma");
62 cout <<
"Starting the fitting" << endl;
67 Float_t Mean =func->GetParameter(1);
68 Float_t sig =func->GetParameter(2);
70 cout<<
" fit parameters "<<
" Mean "<<Mean<<
" "<<
" sigma "<<sig<<endl;
77 cout <<
"Macro finished succesfully." << endl;
80 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
Double_t fitf(Double_t *v, Double_t *par)