```
RooChebychev fBkgx ("fBkgx","fBkgx" ,varx,RooArgSet(ch0x,ch1x,ch2x,ch3x,ch4x,ch5x));
RooVoigtian fSigx ("fSigx","fSigx" ,varx,pMassx,pWidthx,pSlopex);
RooChebychev fBkgy ("fBkgy","fBkgy" ,vary,RooArgSet(ch0y,ch1y,ch2y,ch3y,ch4y,ch5x));
RooVoigtian fSigy ("fSigy","fSigy" ,vary,pMassy,pWidthy,pSlopey);
RooProdPdf fBB ("fBkg","fBkg" ,fBkgx,fBkgy);
RooProdPdf fSB ("fSigBkg","fSBWBkg" ,fSigx,fBkgy);
RooProdPdf fBS ("fBkgSig","fBkgSig" ,fBkgx,fSigy);
RooProdPdf fSS ("fSigSig","fSigSig" ,fSigx,fSigy);
RooAddPdf fMod ("fMod2D","fMod2D" ,RooArgList(fBB,fSS,fSB,fBS),RooArgList(n1,n0,n3,n2));
```

It’s a two-dimensional Fit for an invariant mass distribution. The exact expression for the fitTo is

```
if ( fRangb ) FitResults = fMod.fitTo(*data,Extended(kTRUE),SumW2Error(kTRUE),Save(),Range(fRangs.c_str()));
else FitResults = fMod.fitTo(*data,Extended(kTRUE),SumW2Error(kTRUE),Save(),Range("Full"));
```

I do this in a for cycle calling a function that performs the fit one time in a different range if `fRangb`

is true in the range defined by the string `fRangs.c_str()`

Edit: Thanks for the formatting!