22 int nbins[3] = {10 , 10 , 100 };
28 const unsigned int ndim( bd.
NDim() );
29 const unsigned int npoints( bd.
NPoints() );
30 for (
unsigned int i = 0; i < npoints; ++i )
32 double value = 0, error = 0;
33 const double *
x = bd.
GetPoint(i, value, error);
34 for (
unsigned int j = 0; j < ndim; ++j )
36 out <<
" x[" << j <<
"]: " << x[j];
38 out <<
" value: " << value;
39 out <<
" error: " << error;
47 const unsigned int ndim = bd.
NDim();
48 const unsigned int npoints = bd.
NPoints();
50 for (
unsigned int i = 0; i < npoints; ++i )
52 double value1 = 0, error1 = 0;
53 const double *
x1 = bd.
GetPoint(i, value1, error1);
55 for (
unsigned int j = 0; j < ndim; ++j )
57 thisIsIt &=
fabs(x1[j] - x[j]) < 1
E-15;
59 if ( thisIsIt )
return i;
62 cout <<
"ERROR FINDING BIN!" << endl;
68 const unsigned int ndim = bd1.
NDim();
69 const unsigned int npoints = bd1.
NPoints();
74 cout <<
"Equals" << endl;
76 for (
unsigned int i = 0; i < npoints &&
equals; ++i )
78 double value1 = 0, error1 = 0 ;
79 const double *
x1 = bd1.
GetPoint(i, value1, error1);
83 double value2 = 0, error2 = 0;
84 const double *
x2 = bd2.
GetPoint(bin, value2, error2);
86 equals &= ( value1 == value2 );
88 equals &= ( error1 == error2 );
90 for (
unsigned int j = 0; j < ndim; ++j )
92 equals &=
fabs(x1[j] - x2[j]) < 1
E-15;
93 cout <<
" x[" << j <<
"]: " <<
equals;
97 std::copy(x1, &x1[ndim], ostream_iterator<double>(cout,
" "));
98 cout <<
" value:" << value1;
99 cout <<
" error:" << error1;
102 std::copy(x2, &x2[ndim], ostream_iterator<double>(cout,
" "));
103 cout <<
" value:" << value2;
104 cout <<
" error:" << error2;
106 cout <<
" equals: " <<
equals;
135 cout <<
" equals : ";
136 bool ok = (bd == bd2);
138 cout <<
"One Dimension test ............\t";
165 double initialPars[] = {300,0.,2.,0.,3.};
185 cout <<
" equals : ";
186 bool ok = (bd == bd2);
194 cout <<
"Two Dimension test............\t";
201 int main(
int argc,
char** argv)
205 for (
Int_t i=1 ; i<argc ; i++) {
206 std::string arg = argv[i] ;
215 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
217 cerr <<
" -g : graphics mode\n";
218 cerr <<
" -v : verbose mode";
229 cout <<
"\nONE DIMENSION" << endl;
231 cout <<
"\nTWO DIMENSIONS" << endl;
virtual void SetParameters(const Double_t *params)
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
int equals(Double_t n1, Double_t n2, double ERRORLIMIT=1.E-10)
const double * GetPoint(unsigned int ipoint, double &value) const
retrieve at the same time a pointer to the coordinate data and the fit value More efficient than call...
static const double x2[5]
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
double gaus2D(double *x, double *p)
int main(int argc, char **argv)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void FillData(BinData &dv, const TH1 *hist, TF1 *func=0)
fill the data vector from a TH1.
ostream & operator<<(ostream &out, ROOT::Fit::BinData &bd)
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
int findBin(ROOT::Fit::BinData &bd, const double *x)
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
A 2-Dim function with parameters.
tomato 1-D histogram with a double per channel (see TH1 documentation)}
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
static const double x1[5]
void GetBinData(BinData &) const
bool operator==(ROOT::Fit::BinData &bd1, ROOT::Fit::BinData &bd2)
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
double f2(const double *x)
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
unsigned int NPoints() const
return number of fit points
unsigned int NDim() const
return coordinate data dimension
tomato 2-D histogram with a double per channel (see TH1 documentation)}