#include "TH1.h" #include "TH1.h" void multifit() { Double_t par[12]; TF1 *g1 =new TF1("g1","gaus",9200,9700);//primo picco nello spettro TF1 *g2 =new TF1("g2","gaus",9800,10800);//secondo picco dello spettro TF1 *g4 =new TF1("g4","pol2",8000,11000);//fondo al segnale nello spettro TF1 *total =new TF1("total","gaus(0)+gaus(3)+pol2(6)",8000,11000);//funzione fit globale total->SetLineColor(2); g1->SetLineColor(4); g2->SetLineColor(3); g4->SetLineStyle(5); h1->Fit(g1,"R+"); h1->Fit(g2,"R+"); h1->Fit(g4,"R+"); g1->GetParameters(&par[0]); g2->GetParameters(&par[3]); g4->GetParameters(&par[6]); total->SetParameters(par); total->SetLineStyle(1); h1->Fit(total,"R+"); }