File: gaussSmall.cc

package info (click to toggle)
clhep 2.1.4.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,012 kB
  • sloc: cpp: 50,094; sh: 6,694; makefile: 2,694; perl: 28
file content (40 lines) | stat: -rwxr-xr-x 816 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "CLHEP/Random/Randomize.h"
#include "CLHEP/Random/NonRandomEngine.h"
#include "CLHEP/Random/defs.h"
#include <iostream>
#include <iomanip>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using namespace CLHEP;
//#ifndef _WIN32
//using std::exp;
//#endif


// ---------
// RandGauss
// ---------

int main() {

  cout << "\n--------------------------------------------\n";
  cout << "Test of Gauss distribution at small r \n\n";

  cout << "\nInstantiating distribution utilizing NonRandomEngine...\n";
  NonRandomEngine eng;
  RandGauss dist (eng);

  double r;
  while (true) {
    cout << "r -- ";
    cin  >> r;
    eng.setNextRandom(r);
    double x = dist.fire();
    cout << "                " << std::setprecision(16) << x << "\n";
    if ( x > 1.0e15 ) break;
  }
  return 0;
}