9 #include "TFitResult.h" 
   25 int main(
int argc, 
char **argv)
 
   35     JParser<> zap(
"Program to test ROOT fit.");
 
   37     zap[
'e'] = 
make_field(precision)           = numeric_limits<double>::min();
 
   42   catch(
const exception& error) {
 
   43     FATAL(error.what() << endl);
 
   48   if (option.find(
'S') == string::npos) {
 
   52   if (
debug < 
debug_t && option.find(
'Q') == string::npos) {
 
   57   TH1D h1(
"h1", NULL, 1, -0.5, +0.5);
 
   69   for (
int i = 0; i != 
sizeof(
data)/
sizeof(
data[0]); ++i) {
 
   71     const double y = 
data[i].y;
 
   72     const double z = 
data[i].z;
 
   74     h1.SetBinContent(1, 
y);
 
   75     h1.SetBinError  (1, z);
 
   84       f1.SetParLimits(0, 0.0,  0.0);
 
   85       f1.GetParLimits(0, ymin, ymax);
 
   87       const TFitResultPtr 
result = h1.Fit(&
f1, option.c_str());
 
   92             << 
FIXED(7,3) << 
f1.GetParameter(0) << 
" +/- "  
   93             << 
FIXED(7,3) << 
f1.GetParError (0) << 
" " 
   94             << 
"[" << 
FIXED(7,3) << ymin << 
"," << 
FIXED(7,3) << ymax << 
"]" << 
" " 
   95             << (
result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
   96             << (
result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  107       const TFitResultPtr 
result = h1.Fit(&
f1, option.c_str());
 
  112             << 
FIXED(7,3) << 
f1.GetParameter(0) << 
" +/- "  
  113             << 
FIXED(7,3) << 
f1.GetParError (0) << 
" " 
  114             << (
result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  115             << (
result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  121       ASSERT(fabs(
f1.GetParameter(0) - 
y) < 
f1.GetParError(0));
 
  124       NOTICE(
"Fixed parameters fit " << 
FIXED(7,3) << 
y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  137       const TFitResultPtr 
result = h1.Fit(&
f1, option.c_str());
 
  142             << 
FIXED(7,3) << 
f1.GetParameter(0) << 
" +/- "  
  143             << 
FIXED(7,3) << 
f1.GetParError (0) << 
" " 
  144             << (
result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  145             << (
result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  151       ASSERT(fabs(
f1.GetParameter(0) - parameter.
value) < precision);
 
  152       ASSERT(fabs(
f1.GetParError (0))                   < precision);
 
  155       NOTICE(
"Fixed parameters fit " << 
FIXED(7,3) << 
y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  168       const TFitResultPtr 
result = h1.Fit(&
f1, option.c_str());
 
  173             << 
FIXED(7,3) << 
f1.GetParameter(0) << 
" +/- "  
  174             << 
FIXED(7,3) << 
f1.GetParError (0) << 
" " 
  175             << (
result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  176             << (
result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  182       ASSERT(fabs(
f1.GetParameter(0) - parameter.
value) < precision);
 
  183       ASSERT(fabs(
f1.GetParError (0))                   < precision);
 
  186       NOTICE(
"Released parameters fit " << 
FIXED(7,3) << 
y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  198       const TFitResultPtr 
result = h1.Fit(&
f1, option.c_str());
 
  203             << 
FIXED(7,3) << 
f1.GetParameter(0) << 
" +/- "  
  204             << 
FIXED(7,3) << 
f1.GetParError (0) << 
" " 
  205             << (
result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  206             << (
result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  212       ASSERT(fabs(
f1.GetParameter(0) - 
y) < 
f1.GetParError(0));
 
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.
 
int main(int argc, char **argv)
 
Utility class to parse command line options.
 
const JPolynome f1(1.0, 2.0, 3.0)
Function.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
bool fixParameter(TF1 &f1, const JFitParameter_t ¶meter)
Fix fit parameter.
 
bool setParameter(TF1 &f1, const JFitParameter_t ¶meter)
Set fit parameter.
 
bool isParameterFixed(const TF1 &f1, const Int_t index)
Check if fit parameter is fixed.
 
bool releaseParameter(TF1 &f1, const Int_t index)
Release fit parameter.
 
Auxiliary data structure for floating point format specification.
 
Auxiliary data structure for a parameter index and its value.