43 for(
int i = 0; i < p[0]; i++)
53 for(
int i = 0; i < p[0]; i++)
68 if (
verbose) std::cout <<
"\nTesting IntegratorMultiDim class.." << std::endl;
74 unsigned int nmax = (
unsigned int) 1.E7;
82 std::cout.precision(12);
83 std::cout <<
"result: \t";
84 std::cout << ig1.
Result() <<
"\t" <<
"error: \t" << ig1.
Error() << std::endl;
85 std::cout <<
"Number of function evaluations: " << ig1.
NEval() << std::endl;
86 std::cout <<
"Time using IntegratorMultiDim: \t" << timer.
RealTime() << std::endl;
87 std::cout <<
"------------------------------------" << std::endl;
101 if (
verbose) std::cout <<
"\ntesting TF1::IntegralMultiple.." << std::endl;
111 result =
function.IntegralMultiple(dim, a, b, 0, (
int) 1.E7, 1.
E-5, error, iter, fail);
128 std::cout.precision(12);
129 std::cout <<
"result: \t";
130 std::cout << result <<
"\t" <<
"error: \t" << error << std::endl;
131 std::cout <<
"Number of function evaluations: " << iter << std::endl;
132 std::cout <<
"Time using TF1::IntegralMultiple : \t" << timer.
RealTime() << std::endl;
133 std::cout <<
"------------------------------------" << std::endl;
144 unsigned int Nmax =
NMAX;
145 unsigned int size = Nmax-1;
146 TH1D *num_performance =
new TH1D(
"cubature",
"", size, 1.5, Nmax+.5);
147 TH1D *TF1_performance =
new TH1D(
"montecarlo",
"", size, 1.5, Nmax+.5);
151 std::cout <<
"Testing multidim integration performances for various dimensions\n";
152 for(
unsigned int N = 2;
N <=Nmax;
N++)
155 std::cout<<
"*********************************************" << std::endl;
156 std::cout<<
"Number of dimensions: "<<
N << std::endl;
159 std::cout <<
"\tdim="<<
N << std::endl;
162 double *
a =
new double[
N];
163 double * b =
new double[
N];
166 for (
unsigned int i=0; i <
N; i++)
183 num_performance->
SetTitle(
"comparison of performance");
191 legend->
AddEntry(h1,
"AdaptiveIntegratorMultiDim",
"f");
192 legend->
AddEntry(h2,
"TF1::IntegralMultiple()",
"f");
197 std::cout <<
"Test Timing results\n";
198 std::cout <<
"N dim \t Adaptive time \t\t TF1 time \n";
199 for (
unsigned int i=1; i<=size; i++)
204 int main(
int argc,
char **argv)
207 for (
Int_t i=1 ; i<argc ; i++) {
208 std::string arg = argv[i] ;
217 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
219 cerr <<
" -g : graphics mode\n";
220 cerr <<
" -v : verbose mode";
int NEval() const
return number of function evaluations in calculating the integral
virtual void SetBarOffset(Float_t offset=0.25)
virtual void SetParameters(const Double_t *params)
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
This class displays a legend box (TPaveText) containing several legend entries.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
int main(int argc, char **argv)
void SetFunction(const IMultiGenFunction &f)
set the integration function (must implement multi-dim function interface: IBaseFunctionMultiDim) ...
double integral_TF1(unsigned int dim, double *a, double *b, double *p)
double integral_num(unsigned int dim, double *a, double *b, double *p)
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
Double_t SimpleFun(const double *x, const double *p)
double Result() const
return result of integration
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
virtual void SetBarWidth(Float_t width=0.5)
void Stop()
Stop the stopwatch.
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
std::map< std::string, std::string >::const_iterator iter
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
double Integral(const double *xmin, const double *xmax)
evaluate the integral with the previously given function between xmin[] and xmax[] ...
virtual void SetFillColor(Color_t fcolor)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
double Error() const
return integration error
1-D histogram with a double per channel (see TH1 documentation)}
Double_t Sum(const double *x, const double *p)
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual void SetTitle(const char *title)
Change (i.e.
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
class for adaptive quadrature integration in multi-dimensions using rectangular regions.
WrappedParamFunction class to wrap any multi-dimensional function pbject implementing the operator()(...