29   using TMath::PoissonI;
 
   60       this->push_back(
mean);
 
   61       this->push_back(
sigma);
 
   78   inline result_type 
g1(
const JGauss& 
gauss, 
const JElement_t& point) 
 
   82     const double u  = (point.getX() - 
gauss[0]) / 
gauss[1];
 
   83     const double fs =  
gauss[2] * exp(-0.5*
u*
u) / (sqrt(2.0*
PI) * 
gauss[1]);
 
   84     const double fb =  
gauss[3];
 
   85     const double f1 =  fs + fb;
 
   87     const double p  =  PoissonI(point.getY(), 
f1);
 
   96     result.gradient *= 1.0 - point.getY()/
f1;                                      
 
  109 int main(
int argc, 
char **argv)
 
  122     JParser<> zap(
"Program to test JGandalf algorithm.");
 
  132   catch(
const exception& error) {
 
  133     FATAL(error.what() << endl);
 
  136   using namespace JFIT;
 
  138   ASSERT(numberOfEvents > 0);
 
  142   TF1 fs(
"fs", 
"exp(-0.5 * (x-[0])*(x-[0]) / ([1]*[1]))");
 
  145   fs.FixParameter(0, 
gauss[0]);
 
  146   fs.FixParameter(1, 
gauss[1]);
 
  149   const Double_t 
xmin = -5.0;
 
  150   const Double_t 
xmax = +5.0;
 
  157   TH1D      
H[] = { TH1D(
"ha", 
"", 101,   -0.1,    +0.1),
 
  158                     TH1D(
"hb", 
"", 101,   -0.1,    +0.1),
 
  159                     TH1D(
"hc", 
"", 101, -100.0,  +100.0),
 
  160                     TH1D(
"hd", 
"", 101, -100.0,  +100.0) };
 
  164   for (
int i = 0; i != numberOfEvents; ++i) {
 
  166     STATUS(
"event: " << setw(10) << i << 
'\r'); 
DEBUG(endl);
 
  168     TH1D h0(
"h0", NULL, nx, 
xmin, 
xmax);
 
  172     h0.FillRandom(
"fs", (Int_t) 
gauss[2]);
 
  173     h0.FillRandom(
"fb", (Int_t) 
gauss[3]);
 
  177     for (Int_t i = 1; i <= h0.GetNbinsX(); ++i) {
 
  178       data.push_back(JElement_t(h0.GetBinCenter (i),
 
  179                                 h0.GetBinContent(i)));
 
  184     fit.parameters.resize(4);
 
  186     for (
size_t i = 0; i != 4; ++i) {
 
  187       fit.parameters[i] = i;
 
  190     fit.value = 
JGauss(h0.GetMean(),
 
  192                        h0.GetEntries() * (
xmax - 
xmin) / nx - h0.GetMinimum(),
 
  195     DEBUG(
"Start value " << fit.value << endl);
 
  199     const double chi2 = fit(
g1, 
data.begin(), 
data.end());
 
  203     DEBUG(
"Final value " << fit.value << endl);
 
  204     DEBUG(
"Chi2 " << chi2 << endl);
 
  206     const double Y[] = { fit.value[0]                       - 
gauss[0],
 
  207                          fit.value[1]                       - 
gauss[1],
 
  209                          fit.value[3] * nx                  - 
gauss[3] };
 
  211     for (
int i = 0; i != 
sizeof(Q)/
sizeof(Q[0]); ++i) {
 
  217   for (
int i = 0; i != 
sizeof(Q)/
sizeof(Q[0]); ++i) {
 
  229     for (
int i = 0; i != 
sizeof(
H)/
sizeof(
H[0]); ++i) {
 
  237   for (
int i = 0; i != 
sizeof(Q)/
sizeof(Q[0]); ++i) {
 
  241   ASSERT(Q[0].getSTDev() < precision[0]);
 
  242   ASSERT(Q[1].getSTDev() < precision[1]);
 
  243   ASSERT(Q[2].getSTDev() < precision[2]);
 
  244   ASSERT(Q[3].getSTDev() < precision[3]);
 
double getMean(vector< double > &v)
get mean of vector content
 
The elements in a collection are sorted according to their abscissa values and a given distance opera...
 
int main(int argc, char **argv)
 
std::ostream & shortprint(std::ostream &out)
Set short printing.
 
std::ostream & longprint(std::ostream &out)
Set long printing.
 
General purpose messaging.
 
#define DEBUG(A)
Message macros.
 
#define ASSERT(A,...)
Assert macro.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
I/O formatting auxiliaries.
 
Double_t g1(const Double_t x)
Function.
 
Place holder for custom implementation.
 
Auxiliary class for CPU timing and usage.
 
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
 
Utility class to parse command line options.
 
const JPolynome f1(1.0, 2.0, 3.0)
Function.
 
Auxiliary classes and methods for linear and iterative data regression.
 
static const double PI
Mathematical constants.
 
double gauss(const double x, const double sigma)
Gauss function (normalised to 1 at x = 0).
 
static const double H
Planck constant [eV s].
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Data structure for return value of fit function.
 
JGauss()
Default constructor.