ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
math
minuit2
test
MnSim
GaussDataGen.cxx
Go to the documentation of this file.
1
// @(#)root/minuit2:$Id$
2
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4
/**********************************************************************
5
* *
6
* Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7
* *
8
**********************************************************************/
9
10
#include "
GaussDataGen.h
"
11
#include "
GaussFunction.h
"
12
#include "
GaussRandomGen.h
"
13
#include "
FlatRandomGen.h
"
14
15
namespace
ROOT {
16
17
namespace
Minuit2 {
18
19
20
GaussDataGen::GaussDataGen
(
unsigned
int
n
) {
21
22
// create random generator for mean values of Gaussian [-50, 50)
23
FlatRandomGen
rand_mean(0., 50.);
24
25
// create random generator for sigma values of Gaussian [1., 11.)
26
FlatRandomGen
rand_var(6., 5.);
27
28
// errors of measurements (Gaussian, mean=0., sig = 0.01)
29
double
mvariance = 0.01*0.01;
30
GaussRandomGen
rand_mvar(0., 0.01);
31
32
// simulate data
33
fSimMean
= rand_mean();
34
fSimVar
= rand_var();
35
double
sim_sig =
sqrt
(
fSimVar
);
36
double
sim_const = 1.;
37
GaussFunction
gauss_sim(
fSimMean
, sim_sig, sim_const);
38
39
for
(
unsigned
int
i = 0; i <
n
; i++) {
40
41
//x-position, from -5sigma < mean < +5sigma
42
double
position =
fSimMean
-5.*sim_sig +
double
(i)*10.*sim_sig/
double
(n);
43
fPositions
.push_back(position);
44
45
//y-position (function Value)
46
double
epsilon
= rand_mvar();
47
fMeasurements
.push_back(gauss_sim(position) + epsilon);
48
fVariances
.push_back(mvariance);
49
}
50
51
}
52
53
}
// namespace Minuit2
54
55
}
// namespace ROOT
ROOT::Minuit2::GaussDataGen::fSimVar
double fSimVar
Definition:
GaussDataGen.h:39
ROOT::Minuit2::FlatRandomGen
Definition:
FlatRandomGen.h:20
ROOT::Minuit2::GaussDataGen::GaussDataGen
GaussDataGen(unsigned int npar=100)
Definition:
GaussDataGen.cxx:20
ROOT::Minuit2::GaussDataGen::fVariances
std::vector< double > fVariances
Definition:
GaussDataGen.h:42
sqrt
double sqrt(double)
double
double
Definition:
RooCFunction2Binding.cxx:40
GaussRandomGen.h
GaussDataGen.h
FlatRandomGen.h
GaussFunction.h
epsilon
REAL epsilon
Definition:
triangle.c:617
ROOT::Minuit2::GaussDataGen::fMeasurements
std::vector< double > fMeasurements
Definition:
GaussDataGen.h:41
ROOT::Minuit2::GaussFunction
Definition:
GaussFunction.h:21
ROOT::Minuit2::GaussRandomGen
Definition:
GaussRandomGen.h:21
ROOT::Minuit2::GaussDataGen::fPositions
std::vector< double > fPositions
Definition:
GaussDataGen.h:40
ROOT::Minuit2::GaussDataGen::fSimMean
double fSimMean
Definition:
GaussDataGen.h:38
n
const Int_t n
Definition:
legend1.C:16