Sure!

```
ROOT_CODE
//Here I define the function (I can use also the "Voigt" pdf ... It's the same)
Double_t gauland(Double_t *x,Double_t *par) {
Double_t risq2pi = 0.3989422804014;
Int_t nstep = 10000;
Double_t sc = 5.0;
Double_t xlow, xupp,step;
Double_t sum;
Double_t sigma,km,pga,norm;
sum = 0; sigma=par[0]; km=par[1]; pga=par[2]; norm=par[3];
xlow = x[0] - sc*sigma;
xupp = x[0] + sc*sigma;
step = (xupp-xlow)/(nstep*2.);
for (Int_t ij=1;ij<=nstep;++ij){
Double_t xxl = xlow + (ij-0.5)*step;
Double_t xxc = xupp - (ij-0.5)*step;
Double_t smear = exp(-(x[0]-xxl)*(x[0]-xxl)*0.5/(sigma*sigma))*risq2pi/sigma;
Double_t landa = pga*risq2pi*risq2pi/((xxl-km)*(xxl-km)+0.25*pga*pga);
sum += smear*landa;
smear = exp(-(x[0]-xxc)*(x[0]-xxc)*0.5/(sigma*sigma))*risq2pi/sigma;
landa = pga*risq2pi*risq2pi/((xxc-km)*(xxc-km)+0.25*pga*pga);
sum += smear*landa;
}
Double_t fitval = norm*step*sum;
return fitval;
}
void ROOT_mass() {
TChain chain("h1");
....//Add ".root" file to the chain
TH1D *hma2 = new TH1D("hma2","Mass", 200, 475., 512.);
chain.Draw("Minvariant[0]>>hma2");
TF1 *fgauland = new TF1("gauland", gauland, 475., 512.,4);
fgauland->SetParameters(2., 493.677, 1., 1000.);
fgauland->SetParNames ("Sigma","Mean","Pga","Norm");
TCanvas *c3 = new TCanvas("c3", "c3");
hma2->Fit("gauland","RVE","", 483., 503.);
hma2->Draw();
gStyle->SetOptFit(111111);
hma2->Draw("samehisterror");
Double_t binwidth= 37./200.;
Double_t ierr;
Double_t fcha = (483. - 475.)/binwidth + 1.;
Double_t lcha = (503. - 475.)/binwidth + 1.;
Int_t ndof;
Double_t histen = hma2->IntegralAndError(fcha,lcha,ierr);
}
```

and this is the second one:

```
ROOFIT_CODE
void RooFit_Mass() {
TChain chain("h1");
...//Add ".root" file to the chain
TH1D *hma1 = new TH1D("hma1","M_invariant for 2-body decay", 200, 475., 512.);
chain.Draw("Minvariant[0]>>hma1");
RooRealVar x("x", "x", 475., 512.);
RooDataHist dh("dh", "dh", x, Import(*hma1));
RooPlot *frame = x.frame(Title("M_invariant for 2-body decay"));
dh.plotOn(frame);
RooRealVar mean("mean", "mean", 493.677, 490, 500);
RooRealVar sg("sg", "sg", 1, 0, 10);
RooGaussian gauss("gauss", "gauss", x, mean, sg);
RooRealVar mean1("mean1", "mean1", 0, -5, 5);
RooRealVar sbw("sbw", "sbw", 2, 0, 10);
RooBreitWigner bw("bw", "bw", x, mean1, sbw);
RooFFTConvPdf signal("signal","landau (X) gauss", x, gauss, bw) ;
signal.fitTo(dh, Range(483.,503.));
signal.plotOn(frame,DrawOption("L"));
frame->Draw();
}
```