43class TF1Convolution_EvalWrapper
61 return fFunc1->
EvalPar(xx,
nullptr) * fFunc2->
EvalPar(xx+1,
nullptr);
73 Error(
"InitializeDataMembers",
"function1 %s is not of dimension 1 ",function1->
GetName());
81 Error(
"InitializeDataMembers",
"function2 %s is not of dimension 1 ",function2->
GetName());
87 Fatal(
"InitializeDataMembers",
"Invalid functions - Abort");
154 Info(
"TF1Convolution",
"Using default range [-inf, inf] for TF1Convolution");
167 std::vector < TString > stringarray(2);
168 std::vector < TF1* > funcarray(2);
169 for (
int i=0; i<2; i++)
171 stringarray[i] = ((
TObjString*)((*objarray)[i])) -> GetString();
172 stringarray[i].ReplaceAll(
" ",
"");
175 if (funcarray[i] ==
nullptr) {
177 if (!
f->GetFormula()->IsValid() )
178 Error(
"TF1Convolution",
"Invalid formula : %s",stringarray[i].Data() );
190 Info(
"TF1Convolution",
"Using default range [-inf, inf] for TF1Convolution");
212 Error(
"TF1Convolution",
"Invalid formula for : %s",
formula1.Data() );
215 fFunction2 = std::unique_ptr<TF1>(
new TF1(
"f_conv_1", formula2));
217 Error(
"TF1Convolution",
"Invalid formula for : %s",formula2.
Data() );
225 Info(
"TF1Convolution",
"Using default range [-inf, inf] for TF1Convolution");
262 if (fft1 ==
nullptr || fft2 ==
nullptr) {
263 Warning(
"MakeFFTConv",
"Cannot use FFT, probably FFTW package is not available. Switch to numerical convolution");
277 fft1 -> SetPoint(i, in1[i]);
278 fft2 -> SetPoint(i, in2[i]);
286 Double_t re1, re2, im1, im2, out_re, out_im;
290 fft1 -> GetPointComplex(i,re1,im1);
291 fft2 -> GetPointComplex(i,re2,im2);
292 out_re = re1*re2 - im1*im2;
293 out_im = re1*im2 + re2*im1;
294 fftinverse -> SetPoint(i, out_re, out_im);
296 fftinverse -> Transform();
383 bool equalParams =
true;
386 equalParams &= (
fParams1[i] == params[i]);
401 fFunction2->SetParameter(k, params[i - offset2]);
402 equalParams &= (
fParams2[k - offset2] == params[i - offset2]);
403 fParams2[k - offset2] = params[i - offset2];
415 Double_t params[]={p0,p1,p2,p3,p4,p5,p6,p7};
423 if (percentage<0)
return;
425 fXmin -= percentage * range;
426 fXmax += percentage * range;
435 Warning(
"SetRange",
"Invalid range: %f >= %f",
a,
b);
443 Warning(
"TF1Convolution::SetRange()",
"In FFT mode, range can not be infinite. Infinity has been replaced by range of first function plus a bufferzone to avoid spillover.");
static const double x2[5]
TRObject operator()(const T1 &t1) const
static IntegrationOneDim::Type DefaultIntegratorType()
User Class for performing numerical integration of a function in one dimension.
double IntegralUp(const IGenFunction &f, double a)
evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
double Integral(Function &f, double a, double b)
evaluate the Integral of a function f over the defined interval (a,b)
double IntegralLow(const IGenFunction &f, double b)
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,...
Class wrapping convolution of two functions.
std::vector< Double_t > fParams1
void Copy(TObject &obj) const
Copy this to obj.
Int_t fCstIndex
Index of the constant parameter f the first function.
void SetRange(Double_t a, Double_t b)
void GetRange(Double_t &a, Double_t &b) const
std::vector< TString > fParNames
Parameters' names.
std::unique_ptr< TF1 > fFunction1
First function to be convolved.
Int_t fNofPoints
Number of point for FFT array.
std::vector< Double_t > fParams2
Double_t fXmin
Minimal bound of the range of the convolution.
void SetExtraRange(Double_t percentage)
Double_t EvalNumConv(Double_t t)
Perform numerical convolution.
Bool_t fFlagFFT
Choose FFT or numerical convolution.
TF1Convolution & operator=(const TF1Convolution &rhs)
Operator =.
void MakeFFTConv()
Perform the FFT of the two functions.
Double_t operator()(const Double_t *x, const Double_t *p)
Used in TF1 when doing the fit, will be evaluated at each point.
void SetParameters(const Double_t *params)
void SetNofPointsFFT(Int_t n)
TF1Convolution()
constructor without arguments
const char * GetParName(Int_t ipar) const
Double_t EvalFFTConv(Double_t t)
Double_t fXmax
Maximal bound of the range of the convolution.
std::unique_ptr< TF1 > fFunction2
Second function to be convolved.
Bool_t fFlagGraph
! Tells if the graph is already done or not
void InitializeDataMembers(TF1 *function1, TF1 *function2, Bool_t useFFT)
Use copy instead of Clone.
void Update()
Update the two component functions of the convolution.
std::unique_ptr< TGraph > fGraphConv
! Graph of the convolution
virtual void Copy(TObject &f1) const
Copy this F1 to a new F1.
static void InitStandardFunctions()
Create the basic function objects.
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
virtual Int_t GetNdim() const
A TGraph is an object made of two arrays X and Y with npoints each.
@ kIsSortedX
graph is sorted in X points
virtual const char * GetName() const
Returns name of object.
Collectable string class.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
TVirtualFFT is an interface class for Fast Fourier Transforms.
static TVirtualFFT * FFT(Int_t ndim, Int_t *n, Option_t *option)
Returns a pointer to the FFT of requested size and type.
virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput=kFALSE) const =0
Double_t Infinity()
Returns an infinity as defined by the IEEE standard.