63   TH1D * 
h1 = 
new TH1D(
"h1G",
"gaussian distribution from Unuran",100,-10,10);
 
   64   TH1D(
"h2G",
"gaussian distribution from TRandom",100,-10,10);
 
   66   cout << 
"\nTest using UNURAN string API \n\n";
 
   70   if (! 
unr.Init( 
"normal()", 
"method=arou") ) {
 
   71      cout << 
"Error initializing unuran" << endl;
 
   79   for (
int i = 0; i < 
n; ++i) {
 
   80       double x = 
unr.Sample();
 
   85   cout << 
"Time using Unuran method " << 
unr.MethodName() << 
"\t=\t " << 
w.CpuTime() << endl;
 
   90   for (
int i = 0; i < 
n; ++i) {
 
   96   cout << 
"Time using TRandom::Gaus  \t=\t " << 
w.CpuTime() << endl;
 
  108double distr(
double *
x, 
double *
p) {
 
  112double cdf(
double *
x, 
double *
p) {
 
  119   cout << 
"\nTest 1D Continous distributions\n\n";
 
  121   TH1D * 
h1 = 
new TH1D(
"h1BW",
"Breit-Wigner distribution from Unuran",100,-10,10);
 
  122   TH1D(
"h2BW",
"Breit-Wigner distribution from GetRandom",100,-10,10);
 
  127   double par[2] = {1,0};  
 
  128   f->SetParameters(par);
 
  131   fc->SetParameters(par);
 
  141   std::string 
method = 
"tdr";
 
  150      cout << 
"Error initializing unuran" << endl;
 
  160   for (
int i = 0; i < 
n; ++i) {
 
  161      double x = 
unr.Sample();
 
  166   cout << 
"Time using Unuran method " << 
unr.MethodName() << 
"\t=\t " << 
w.CpuTime() << endl;
 
  169   for (
int i = 0; i < 
n; ++i) {
 
  170      double x = 
f->GetRandom();
 
  175   cout << 
"Time using TF1::GetRandom()  \t=\t " << 
w.CpuTime() << endl;
 
  183   std::cout << 
" chi2 test of UNURAN vs GetRandom generated histograms:  " << std::endl;
 
  189double gaus3d(
double *
x, 
double *
p) {
 
  198   double c = 1 - rho*rho ;
 
  200      * exp (-(
u * 
u - 2 * rho * 
u * 
v + 
v * 
v + 
w*
w) / (2 * 
c));
 
  207   cout << 
"\nTest Multidimensional distributions\n\n";
 
  209   TH3D * 
h1 = 
new TH3D(
"h13D",
"gaussian 3D distribution from Unuran (vnrou)",50,-10,10,50,-10,10,50,-10,10);
 
  210   TH3D(
"h23D",
"gaussian 3D distribution from Unuran (hitro)",50,-10,10,50,-10,10,50,-10,10);
 
  211   TH3D(
"h33D",
"gaussian 3D distribution from GetRandom",50,-10,10,50,-10,10,50,-10,10);
 
  216   double par[3] = {2,2,0.5};
 
  217   f->SetParameters(par);
 
  225   std::string 
method = 
"vnrou";
 
  227      cout << 
"Error initializing unuran" << endl;
 
  235   for (
int i = 0; i < 
NGEN; ++i) {
 
  241   cout << 
"Time using Unuran method " << 
unr.MethodName() << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  252      cout << 
"Error re-initializing unuran" << endl;
 
  258   for (
int i = 0; i < 
NGEN; ++i) {
 
  264   cout << 
"Time using Unuran method " << 
unr.MethodName() << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  274   for (
int i = 0; i < 
NGEN; ++i) {
 
  275      f->GetRandom3(
x[0],
x[1],
x[2]);
 
  280   cout << 
"Time using TF1::GetRandom  \t\t=\t " << 
w.CpuTime() << endl;
 
  286   std::cout << 
" chi2 test of UNURAN vnrou vs GetRandom generated histograms:  " << std::endl;
 
  288   std::cout << 
" chi2 test of UNURAN hitro vs GetRandom generated histograms:  " << std::endl;
 
  289   h2->Chi2Test(h3,
"UUP");
 
  302   cout << 
"\nTest Discrete distributions\n\n";
 
  304   TH1D * 
h1 = 
new TH1D(
"h1PS",
"Unuran Poisson prob",20,0,20);
 
  305   TH1D(
"h2PS",
"Poisson dist from TRandom",20,0,20);
 
  309   TF1 * 
f = 
new TF1(
"fps",poisson,1,0,1);
 
  310   f->SetParameter(0,mu);
 
  316   dist2.SetMode(
int(mu) );
 
  317   dist2.SetProbSum(1.0);
 
  325   for (
int i = 0; i < 
n; ++i) {
 
  326      int k = 
unr.SampleDiscr();
 
  331   cout << 
"Time using Unuran method " << 
unr.MethodName() << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  334   for (
int i = 0; i < 
n; ++i) {
 
  337   cout << 
"Time using TRandom::Poisson " << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  344   std::cout << 
" chi2 test of UNURAN vs TRandom generated histograms:  " << std::endl;
 
  356   cout << 
"\nTest Empirical distributions using smoothing\n\n";
 
  360   const int Ndata = 1000;
 
  362   for (
int i = 0; i < 
Ndata; ++i) {
 
  369   TH1D * 
h0 = 
new TH1D(
"h0Ref",
"Starting data",100,-10,10);
 
  370   TH1D * 
h1 = 
new TH1D(
"h1Unr",
"Unuran unbin Generated data",100,-10,10);
 
  371   TH1D * 
h1b = 
new TH1D(
"h1bUnr",
"Unuran bin Generated data",100,-10,10);
 
  372   TH1D(
"h2GR",
"Data from TH1::GetRandom",100,-10,10);
 
  384   if (!
unr.Init(dist)) 
return;
 
  385   for (
int i = 0; i < 
n; ++i) {
 
  390   cout << 
"Time using Unuran unbin  " << 
unr.MethodName() << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  396   for (
int i = 0; i < 
n; ++i) {
 
  397      h1b->Fill( 
unr.Sample() );
 
  400   cout << 
"Time using Unuran bin  " << 
unr.MethodName() << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  403   for (
int i = 0; i < 
n; ++i) {
 
  406   cout << 
"Time using TH1::GetRandom " << 
"\t=\t\t " << 
w.CpuTime() << endl;
 
  431   c1 = 
new TCanvas(
"c1_unuranMulti",
"Multidimensional distribution",10,10,1000,1000);
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
 
R__EXTERN TRandom * gRandom
 
R__EXTERN TStyle * gStyle
 
R__EXTERN TSystem * gSystem
 
virtual void SetLineColor(Color_t lcolor)
Set the line color.
 
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
 
A 3-Dim function with parameters.
 
1-D histogram with a double per channel (see TH1 documentation)
 
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
 
void Draw(Option_t *option="") override
Draw this histogram with options.
 
virtual Double_t Chi2Test(const TH1 *h2, Option_t *option="UU", Double_t *res=nullptr) const
test for comparing weighted and unweighted histograms.
 
3-D histogram with a double per channel (see TH1 documentation)
 
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
 
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
 
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
 
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
 
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
 
TUnuranContDist class describing one dimensional continuous distribution.
 
TUnuranDiscrDist class for one dimensional discrete distribution.
 
TUnuranEmpDist class for describing empirical distributions.
 
TUnuranMultiContDist class describing multi dimensional continuous distributions.
 
double breitwigner_pdf(double x, double gamma, double x0=0)
Probability density function of Breit-Wigner distribution, which is similar, just a different definit...
 
double poisson_pdf(unsigned int n, double mu)
Probability density function of the Poisson distribution.
 
double breitwigner_cdf(double x, double gamma, double x0=0)
Cumulative distribution function (lower tail) of the Breit_Wigner distribution and it is similar (jus...
 
double dist(Rotation3D const &r1, Rotation3D const &r2)
 
double poisson(double x, double par)