I am trying to do a quick calculation/simulation of Synchrotron radiation using root. The procedure is described in: H. Burkhardt, CERN-OPEN-2007-018 (and implemented in GEANT4).
To be able to do that, one must evaluate Chebyshev polynomials at a given value x, in range [a,b] and for a given set of coefficients - i.e.: Chebyshev(a,b,coeffs,n,x), n=number of coefficients.
Is there a call in root to do that? searched but could not find any. Or, is there an example of Synchrotron radiation in root?
Sorry, I should have been more specific. I am trying to evaluate the series for a given number; see attached macro file. But not sure how to do it. Cheby.C (693 Bytes)
You can use them as TF1, they are already defined as predefined functions in gROOT as “chebyshevN”.
So for example for using a chebyshev polynomial of degree 4 you can do:
TF1 * f = (TF1*) gROOT->GetFunction("chebyshev4");
f->SetParameters(1,1,1,1);
f->Draw();
Thank you very much. It seems that “cheb4” is Chebyshev series - not polynomial. To get the polynomial one has to set: SetParameters(0,0,0,0,1) which givesT4 = 8x^4 - 8x^2 + 1. This is not a problem.
However, it seems only up to n=9 are defined; i.e., “cheb10” will not work:
root [0] TF1 * f = (TF1*) gROOT->GetFunction(“cheb10”);
root [1] f->Draw();
Error: illegal pointer to class object f 0x0 1205 (tmpfile):1:
*** Interpreter error recovered ***
Notices also that SetParameters only takes up to 10 parameters. So cannot access Chebyshev series above n=9. I needed n=30.
For larger number of parameters you can use directly the ROOT::Math::ChebyshevPol class :
// example for n = 20
const int n = 20;
ROOT::Math::ChebyshevPol * pol = new ROOT::Math::ChebyshevPol(n);
Double_t min = -1;
Double_t max = 1;
TF1 * f1 = new TF1(TString::Format("chebyshev%d",n),pol,min,max,n+1,1);
double p[n] = {0};
p[n-1] = 1;
f1->SetParameters(p);
My question is also about Chebyshev polynomials but maybe not related to main question too much.
So I am doing gaus + chebyshev fit for my case, bellow is the background determinig part:
My question is if I do (a0,a1) it’s supposed to be a line(right?), so what is the a0 parameter by itself? Is it like a degree? If I take only a0 for my fit what will it do with background?
I’ll be very thankful if someone can explain me this.