Double_t myFuncBWG(Double_t *x, Double_t *par) { Float_t xx =x[0]; Double_t f=0.; Double_t a = 1.; if(xx>0.){ a=TMath::Sqrt(xx/par[1]); } f = par[0]*TMath::Voigt(xx-par[1],par[2],par[3]*a,4); return f; } //======================================================== void Voigtfun(){ double par[4] = {25,0.2,.1,0.2}; //{A,mean,sigma,Gamma} f1 = new TF1("f1",myFuncBWG,-10,10,4); f1->SetParameters(&par[0]); f1->SetNpx(1000); f1->SetLineColor(2); f1->SetLineWidth(3); TH2F *h = new TH2F("h","h",200,-1,2,1000,0,120); h->SetTitle(0); h->SetStats(0); h->SetXTitle("E^{*} MeV"); h->SetYTitle("Counts"); h->SetLabelFont(22,"X"); h->SetLabelFont(22,"Y"); h->SetTitleFont(22,"X"); h->SetTitleFont(22,"Y"); h->GetXaxis()->CenterTitle(); h->GetYaxis()->CenterTitle(); h->GetXaxis()->SetTitleSize(0.05); h->GetYaxis()->SetTitleSize(0.05); h->GetXaxis()->SetTitleOffset(.8); h->GetYaxis()->SetTitleOffset(.8); TCanvas *c = new TCanvas("c","c",800,800); c->cd(); h->Draw(); f1->Draw("same"); }