/*!\class TPeakFit
\author Alexandre A. P. Suaide 
*/
#ifndef TPeakFit_HH

#define TPeakFit_HH

#include "TObject.h"

#include "TH1.h"

#include "TF1.h"

#include "TGraph.h"

#include "TContainer.h"

#include "TMinuit.h"

#include "TCanvas.h"

#include "TROOT.h"

#include <fstream>

#include <math.h>

#include "TGTextView.h"

#include <iostream>

#include "log.hh"

using namespace std;

#define MAXFUNC1 1000


class TPeakFit : public TObject
{
  private:    
    
    float            mPeakVar;
    float            mWidVar;
    float            mMinArea;
    float            mMaxArea;
    float            mMinAssym;
    float            mMaxAssym;
    float            mBackVar;
    bool             mAssym;
    bool             mSameWid;
    bool             mBackMode;
    
    int              mBackDegree;
    int              mMaxBackDegree;
    
    float            mFitMin;
    float            mFitMax;
    
    float            mChi;
    float            mNDF;
    
    int              mNP;
    int              mNF;
    
    TH1*             mHist;
    TH1F*            mSum;
    TGraph*          mBack;
    TContainer*      mFunctions;

  public:
                     TPeakFit();
    virtual         ~TPeakFit();
    
    void             fit();
    void             fitBack();
    void             draw(TVirtualPad* = gPad);
    void             print();
    
    void             removeAll() { mNP=0; mFunctions->empty();}
    
    void             setBackground(int,float*,float*);
    void             addPeak(float,float,float,float=1);
    
    void             setHist(TH1* h)      { mHist = h;}
        
    void             setPeakVar(float a)  { mPeakVar = a;}
    void             setWidthVar(float a) { mWidVar = a;}
    void             setMinArea(float a)  { mMinArea = a;}
    void             setMaxArea(float a)  { mMaxArea = a;}
    void             setMinAssym(float a) { mMinAssym = a;}
    void             setMaxAssym(float a) { mMaxAssym = a;}
    
    void             setAssymOnOff(bool a){ mAssym = a;}
    void             setSameWidth(bool a) { mSameWid = a;}
        
    void             setBackDegree(int a) { mBackDegree = a;}
    void             setBackVar(float a)  { mBackVar = a;}
    void             setIndependentBack(bool a) { mBackMode = a;}
    
    void             setXmin(float a)     { mFitMin = a;}
    void             setXmax(float a)     { mFitMax = a;}
    
    float            getPeakVar()         { return mPeakVar;}
    float            getWidthVar()        { return mWidVar;}
    float            getMinArea()         { return mMinArea;}
    float            getMaxArea()         { return mMaxArea;}
    float            getMinAssym()        { return mMinAssym;}
    float            getMaxAssym()        { return mMaxAssym;}
    
    float            getXmin()            { return mFitMin;}
    float            getXmax()            { return mFitMax;}
    
    TF1*             getBack()            { return (TF1*)mFunctions->get("back");}
    TF1*             getPeak(int);
    
    float            getChiSqr()          { return mChi;}
    float            getNDF()             { return mNDF;}
       
    int              getBackDegree()      { return mBackDegree;}
    float            getBackVar()         { return mBackVar;}
   
  ClassDef(TPeakFit,1)
};

#endif



ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.