34     JParser<> zap(
"Program to test ROOT fit.");
 
   36     zap[
'e'] = 
make_field(precision)           = numeric_limits<double>::min();
 
   41   catch(
const exception& error) {
 
   42     FATAL(error.what() << endl);
 
   47   if (option.find(
'S') == string::npos) {
 
   51   if (
debug < 
debug_t && option.find(
'Q') == string::npos) {
 
   56   TH1D 
h1(
"h1", NULL, 1, -0.5, +0.5);
 
   68   for (
int i = 0; i != 
sizeof(data)/
sizeof(data[0]); ++i) {
 
   70     const double y = data[i].y;
 
   71     const double z = data[i].z;
 
   73     h1.SetBinContent(1, y);
 
   74     h1.SetBinError  (1, z);
 
   77       NOTICE(
"ROOT fit " << 
FIXED(7,3) << y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
   83       f1.SetParLimits(0, 0.0,  0.0);
 
   84       f1.GetParLimits(0, ymin, ymax);
 
   86       const TFitResultPtr 
result = 
h1.Fit(&f1, option.c_str());
 
   88       ASSERT(result.Get() != NULL, 
"TFitResultPtr");
 
   91             << 
FIXED(7,3) << f1.GetParameter(0) << 
" +/- "  
   92             << 
FIXED(7,3) << f1.GetParError (0) << 
" " 
   93             << 
"[" << 
FIXED(7,3) << ymin << 
"," << 
FIXED(7,3) << ymax << 
"]" << 
" " 
   94             << (result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
   95             << (result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
   99       NOTICE(
"Normal fit " << 
FIXED(7,3) << y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  106       const TFitResultPtr result = 
h1.Fit(&f1, option.c_str());
 
  108       ASSERT(result.Get() != NULL, 
"TFitResultPtr");
 
  111             << 
FIXED(7,3) << f1.GetParameter(0) << 
" +/- "  
  112             << 
FIXED(7,3) << f1.GetParError (0) << 
" " 
  113             << (result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  114             << (result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  117       ASSERT(result->IsValid());
 
  118       ASSERT(!result->IsParameterBound(0));
 
  119       ASSERT(!result->IsParameterFixed(0));
 
  120       ASSERT(fabs(f1.GetParameter(0) - y) < f1.GetParError(0));
 
  123       NOTICE(
"Fixed parameters fit " << 
FIXED(7,3) << y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  131       const JFitParameter_t parameter(0, 0.0);
 
  136       const TFitResultPtr result = 
h1.Fit(&f1, option.c_str());
 
  138       ASSERT(result.Get() != NULL, 
"TFitResultPtr");
 
  141             << 
FIXED(7,3) << f1.GetParameter(0) << 
" +/- "  
  142             << 
FIXED(7,3) << f1.GetParError (0) << 
" " 
  143             << (result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  144             << (result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  147       ASSERT(result->IsValid());
 
  148       ASSERT(!result->IsParameterBound(0));
 
  149       ASSERT(result->IsParameterFixed(0));
 
  150       ASSERT(fabs(f1.GetParameter(0) - parameter.value) < precision);
 
  151       ASSERT(fabs(f1.GetParError (0))                   < precision);
 
  154       NOTICE(
"Fixed parameters fit " << 
FIXED(7,3) << y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  162       const JFitParameter_t parameter(0, 0.0);
 
  167       const TFitResultPtr result = 
h1.Fit(&f1, option.c_str());
 
  169       ASSERT(result.Get() != NULL, 
"TFitResultPtr");
 
  172             << 
FIXED(7,3) << f1.GetParameter(0) << 
" +/- "  
  173             << 
FIXED(7,3) << f1.GetParError (0) << 
" " 
  174             << (result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  175             << (result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  178       ASSERT(result->IsValid());
 
  179       ASSERT(!result->IsParameterBound(0));
 
  180       ASSERT(result->IsParameterFixed(0));
 
  181       ASSERT(fabs(f1.GetParameter(0) - parameter.value) < precision);
 
  182       ASSERT(fabs(f1.GetParError (0))                   < precision);
 
  185       NOTICE(
"Released parameters fit " << 
FIXED(7,3) << y << 
" +/- " << 
FIXED(7,3) << z << endl);
 
  197       const TFitResultPtr result = 
h1.Fit(&f1, option.c_str());
 
  199       ASSERT(result.Get() != NULL, 
"TFitResultPtr");
 
  202             << 
FIXED(7,3) << f1.GetParameter(0) << 
" +/- "  
  203             << 
FIXED(7,3) << f1.GetParError (0) << 
" " 
  204             << (result->IsParameterBound(0) ? 
" *** bound *** " : 
"")  
 
  205             << (result->IsParameterFixed(0) ? 
" *** fixed *** " : 
"")  
 
  208       ASSERT(result->IsValid());
 
  209       ASSERT(!result->IsParameterBound(0));
 
  210       ASSERT(!result->IsParameterFixed(0));
 
  211       ASSERT(fabs(f1.GetParameter(0) - y) < f1.GetParError(0));
 
Utility class to parse command line options. 
 
bool releaseParameter(TF1 &f1, const Int_t index)
Release fit parameter. 
 
then for HISTOGRAM in h0 h1
 
Auxiliary data structure for floating point format specification. 
 
bool isParameterFixed(const TF1 &f1, const Int_t index)
Check if fit parameter is fixed. 
 
#define ASSERT(A,...)
Assert macro. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
bool setParameter(TF1 &f1, const JFitParameter_t ¶meter)
Set fit parameter. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
bool fixParameter(TF1 &f1, const JFitParameter_t ¶meter)
Fix fit parameter.