[ROOT] CINT fit in function problem

From: K.-Michael Aye (klaus-michael.aye@durham.ac.uk)
Date: Thu Dec 11 2003 - 17:49:23 MET


Hello,

why does the following not compile under CINT, but work without problems 
  in the uncompiled version?
I took the tutorial fit1.C, reduced it to the essentials and changed it 
to the way I would like it to work.
The idea I want to achieve is to jump out of a loop, do a fit with the 
current state of a histogram and continue looping afterwards.
But it doesn't compile even in this simple version, so how do I do it 
correctly?

Many thanks,
Michael

PS.:root3.03/09cvs20020930 with gcc3.2.2, can't change root version 
unfortunately.

#ifndef __CINT__

#include "TCanvas.h"
#include "TSystem.h"
#include "TFrame.h"
#include "TFile.h"
#include "TH1F.h"
#include "TF1.h"
#include "TPaveText.h"

#endif

void DoFit(TH1F* h1f, TFile* fill)
{
    TF1* sqroot = (TF1*)fill->Get("sqroot");
    h1f->Fit("sqroot");
    return;
}
void MyFit1()
{
    //
    // To see the output of this macro, click begin_html <a 
href="gif/fit1.gif">here</a>. end_html
    //
    gROOT->Reset();
    TCanvas* c1 = new TCanvas("c1","The Fit Canvas",200,10,700,500);
    //
    // We connect the ROOT file generated in a previous tutorial
    // (see begin_html <a href="fillrandom.C.html">Filling histograms 
with random numbers from a function</a>) end_html
    //
    TFile* fill=new TFile("fillrandom.root");
    //
    // Get object "sqroot" from the file. Undefined objects are searched
    // for using gROOT->FindObject("xxx"), e.g.:
    TF1 *sqroot = (TF1*)fill->Get("sqroot");
    //
    sqroot->Print();

    //
    // Now fit histogram h1f with the function sqroot
    //
    TH1F* h1f =(TH1F*)fill->Get("h1f");
    h1f->SetFillColor(45);
//   h1f->Fit("sqroot","+");
    DoFit(h1f, fill);

    c1->Update();
    return;
}

-- 
Michael Aye, Dept. of Physics, University of Durham
Phone@Office:+44-191-374-2345, Fax@Office:+44-191-374-3749
"If a nation expects to be ignorant and free in a state of civilization,
it expects what never was and never will be." --- Thomas Jefferson



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET