Dear experts,

**PART 1**

I would like to fit a 2-D gaussian, whose axes are not parallel to the x and y axes.

For example:

So, I tried to use RooFormulaVar to define x1 and y1 as:

```
RooRealVar theta_rot("theta_rot","theta_rot",3.1415926/5);
RooFormulaVar x1("x1","x1","cos(theta_rot)*(x-5.28)+sin(theta_rot)*y+5.28",RooArgList(theta_rot,x,y));
RooFormulaVar y1("y1","y1","-sin(theta_rot)*(x-5.28)+cos(theta_rot)*y",RooArgList(theta_rot,x,y));
```

And then I constructed a PDF and generated the toy data.

RooFitRotate_testsig.cc (2.3 KB)

The histogram of the generated toy data (left) and the PDF (right) look consistent:

However, in the X projection (left), I found that the red line does not fit the data points well:

Why does this happen? How to fix it?

**PART 2**

The situation becomes worse when I try to float the PDF parameters like this:

```
RooRealVar meanx("mean1","mean of gaussian x1",5.28,5.27,5.29) ;
RooRealVar meany("mean2","mean of gaussian y1",0,-0.1,0.1) ;
RooRealVar sigmax("sigmax","width of gaussian x1",0.0025,0.0001,0.01) ;
RooRealVar sigmay("sigmay","width of gaussian y1",0.01,0.001,0.1) ;
```

And then it continues to print lots of warning messages like:

```
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 6.93939e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 6.3406e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 8.49857e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 9.52489e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 9.07818e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 9.17086e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 6.69686e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 4.6005e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 8.2697e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 7.62193e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 6.55296e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 1.02203e+09
[#0] WARNING:Eval -- RooAbsPdf::getLogVal(sigpdf) WARNING: large likelihood value: 3.38952e+08
```

How to solve this? Thanks!