Logo ROOT   6.08/07
Reference Guide
TF1Convolution.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: L. Moneta May 2015
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2015 ROOT Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 //
11 //
12 // TF1Convolution.h
13 //
14 // Created by AurĂ©lie Flandi on 27.08.14.
15 //
16 //
17 
18 #ifndef ROOT_TF1Convolution__
19 #define ROOT_TF1Convolution__
20 
21 #include <iostream>
22 #include "TF1.h"
23 #include "TGraph.h"
24 #include <memory>
25 
27 {
28  std::shared_ptr <TF1> fFunction1;
29  std::shared_ptr <TF1> fFunction2;
30  std::shared_ptr <TGraph> fGraphConv;
31 
32  std::vector < Double_t > fParams1;
33  std::vector < Double_t > fParams2;
34 
35  std::vector< TString > fParNames; // parameter names
36 
37  Double_t fXmin; //minimal bound of the range of the convolution
38  Double_t fXmax; //maximal bound of the range of the convolution
41  Int_t fCstIndex; //index of the constant parameter f the first function
42  Int_t fNofPoints; //number of point for FFT array
43  Bool_t fFlagFFT; //choose fft or numerical convolution
44  Bool_t fFlagGraph; //tells if the graph is already done or not
45 
46 
49  void InitializeDataMembers(TF1* function1, TF1* function2, Bool_t useFFT);
50  void MakeFFTConv();
51 
52  public:
53 
54  TF1Convolution(TF1* function1, TF1* function2, Bool_t useFFT = true);
55  TF1Convolution(TF1* function1, TF1* function2, Double_t xmin, Double_t xmax, Bool_t useFFT = true);
56  TF1Convolution(TString formula, Double_t xmin = 1., Double_t xmax = 0., Bool_t useFFT = true);
57  TF1Convolution(TString formula1, TString formula2, Double_t xmin = 1., Double_t xmax = 0., Bool_t useFFT = true);
58 
59  void SetParameters(Double_t* p);
61  Double_t p4=0., Double_t p5=0., Double_t p6=0., Double_t p7=0.);
62  void SetRange(Double_t a, Double_t b);
63  void SetExtraRange(Double_t percentage);
64  void SetNofPointsFFT(Int_t n);
65  void SetNumConv(Bool_t flag = true){fFlagFFT=!flag;}
66 
67  Int_t GetNpar() const {return (fNofParams1+fNofParams2);}
68  Double_t GetXmin() const {return fXmin;}
69  Double_t GetXmax() const {return fXmax;}
70  const char * GetParName(Int_t ipar) const { return fParNames.at(ipar).Data(); }
71 
73 };
74 
75 
76 #endif
float xmin
Definition: THbookFile.cxx:93
static double p3(double t, double a, double b, double c, double d)
const char * GetParName(Int_t ipar) const
std::shared_ptr< TGraph > fGraphConv
Basic string class.
Definition: TString.h:137
std::vector< Double_t > fParams2
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
Class wrapping convolution of two functions.
static double p2(double t, double a, double b, double c)
void MakeFFTConv()
perform the FFT of the two functions
void InitializeDataMembers(TF1 *function1, TF1 *function2, Bool_t useFFT)
use copy instead of Clone
void SetRange(Double_t a, Double_t b)
Double_t EvalNumConv(Double_t t)
perform numerical convolution could in principle cache the integral in a Graph as it is done for the ...
void SetNofPointsFFT(Int_t n)
static double p1(double t, double a, double b)
float xmax
Definition: THbookFile.cxx:93
TF1Convolution(TF1 *function1, TF1 *function2, Bool_t useFFT=true)
constructor from the two function pointer and a flag is using FFT
std::shared_ptr< TF1 > fFunction2
Int_t GetNpar() const
double Double_t
Definition: RtypesCore.h:55
Double_t operator()(Double_t *t, Double_t *p)
std::shared_ptr< TF1 > fFunction1
void SetParameters(Double_t *p)
Double_t EvalFFTConv(Double_t t)
1-Dim function class
Definition: TF1.h:149
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Double_t GetXmin() const
std::vector< TString > fParNames
Double_t GetXmax() const
void SetNumConv(Bool_t flag=true)
std::vector< Double_t > fParams1
const Int_t n
Definition: legend1.C:16
void SetExtraRange(Double_t percentage)