3.2.3. Simple example

The following piece shows how to generate a sample using the TSampling class.

    TUniformDistribution *xunif = new TUniformDistribution("x1", 3., 4.);  // 1
    TNormalDistribution  *xnorm = new TNormalDistribution("x2", 0.5, 1.5);  // 2

    TDataServer * tds = new TDataServer("tdsSampling", "Demonstration Sampling");
    tds->addAttribute(xunif);
    tds->addAttribute(xnorm);

    // Generate the sampling from the TDataServer object
    TSampling *sampling = new TSampling(tds, "lhs", 1000);  // 3
    sampling->generateSample();  // 4
    tds->drawTufte("x1:x2");  // 5

Generation of a design-of-experiments with stochastic attributes

  1. Generating a uniform random variable in [3., 4.]

  2. Generating a gaussian random variable with a mean of 0.5 and a standard deviation of 1.5

  3. Construct the sampler object requesting a sample of 1000 events, using the Lhs algorithm.

  4. Method to generate the sample.

  5. Draw the plot as the right side of Figure 3.3