#include "TObject.h" #include "TCanvas.h" #include "TH1D.h" #include "TH1F.h" #include "TROOT.h" class ABC : public TObject { public: // define a function with 2 parameters Double_t fitf(Double_t *x,Double_t *par) { Double_t fitval = par[0]*x[0] + par[1]; return fitval; } void fitexample() { TH1D *htest = new TH1D("htest", "Fake Data; Bin; Fake Data", 10, 0., 10.); for (Int_t i=0; i<10; i++) htest->SetBinContent(i,(float)i); // Create a TF1 object using the function defined above. The last three // parameters specify the number of parameters for the function. TF1 *func = new TF1("fit",fitf,-2,2,2); // call TH1::Fit with the name of the TF1 object htest->Fit("fit"); } // Define the class for the cint dictionary ClassDef (ABC, 1) }; // Call the ClassImp macro to give the ABC class RTTI and full I/O capabilities. #if !defined(__CINT__) ClassImp(ABC); #endif