Skip to content

Commit 1722160

Browse files
committed
Add TMath.BreitWigner function
1 parent 9005a82 commit 1722160

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

scripts/JSRootCore.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,6 +1857,7 @@
18571857
this._math = JSROOT.Math;
18581858
_func = _func.replace(/TMath::Prob\(/g, 'this._math.Prob(')
18591859
.replace(/TMath::Gaus\(/g, 'this._math.Gaus(')
1860+
.replace(/TMath::BreitWigner\(/g, 'this._math.BreitWigner(')
18601861
.replace(/xygaus\(/g, 'this._math.gausxy(this, x, y, ')
18611862
.replace(/gaus\(/g, 'this._math.gaus(this, x, ')
18621863
.replace(/gausn\(/g, 'this._math.gausn(this, x, ')

scripts/JSRootMath.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,11 @@
637637
return Math.exp(-0.5 * Math.pow((x-mean) / sigma, 2));
638638
};
639639

640+
/** @memberOf JSROOT.Math */
641+
JSROOT.Math.BreitWigner = function(x, mean, gamma) {
642+
return gamma/((x-mean)*(x-mean) + gamma*gamma/4) / 2 / Math.PI;
643+
}
644+
640645
/** @memberOf JSROOT.Math */
641646
JSROOT.Math.gaus = function(f, x, i) {
642647
// function used when gaus(0) used in the TFormula

0 commit comments

Comments
 (0)