TF1 with complex number

Hello everybody!

I want to describe my mass distribution in TH1 histogram with help interference two Breit-Wigner function: BW1 + Z * exp(i * phi) * BW2. In code I expect to see something this:

TF1* core = new TF1("core","[0]*TMath::BreitWigner(x, [1], [2]) + [3] * TMath::Exp(i * [4]) * TMath::BreitWigner(x, [5], [6])", inf, sup);

But I haven’t worked with complex numbers in TF1 object. How can I realize my idea?


ROOT Version: 6.22/8
Platform: Ubuntu
Compiler: Not Provided


TMath, TF1, and the most of ROOT, know only real numbers.

Hi,
You can create a TF1 or better a TF2 (a two dimensional function) using as input the real and imaginary part of a complex number or the module and the phase phi of the number.
Remember you can pass to a TF1 a string expression (a TFormula) as above or a C++ function. See ROOT: TF1 Class Reference

Cheers

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.