/*
  This class implements the fitting basics for different
  HBT studies. Right now it processes the 1-dimentional
  case only. It should be easy to expand it to 3D case.
  For the example of the implementation see TryNewFitter.C
*/
#ifndef HbtFitter_h
#define HbtFitter_h

#include <TH1.h>
#include <TH2.h>
#include <TH3.h>
#include <TF1.h>
#include <TF2.h>
#include <TF3.h>
#include <TMinuit.h>
#include <vector>

//#define MESSAGING
//using namespace std;


//1fm
double KK_LONG[50] = { 0.273707, 0.697738, 0.823735, 0.881777, 0.914707,
                       0.936038, 0.950835, 0.961148, 0.968602, 0.974788,
                       0.979086, 0.982599, 0.985363, 0.987413, 0.989307,
                       0.990824, 0.991961, 0.992976, 0.993674, 0.994269,
                       0.995043, 0.995395, 0.995902, 0.996183, 0.996628,
                       0.996828, 0.997042, 0.997301, 0.997473, 0.997612,
                       0.997758, 0.99783,  0.998072, 0.998223, 0.998325,
                       0.998349, 0.998441, 0.998541, 0.998638, 0.998712,
                       0.998765, 0.998821, 0.998893, 0.998901, 0.998976,
                       0.999042, 0.999062, 0.999104, 0.999157, 0.999139  };


/*
//0.5fm
double KK_LONG[50] = { 0.268129, 0.683624, 0.807178, 0.864549, 0.8975,
                       0.919023, 0.934211, 0.945184, 0.953503, 0.960384,
                       0.965604, 0.97009,  0.973684, 0.976676, 0.979422,
                       0.981683, 0.98353,  0.985301, 0.986679, 0.987884,
                       0.989182, 0.990022, 0.990995, 0.991648, 0.992426,
                       0.993047, 0.993507, 0.994047, 0.994508, 0.994853,
                       0.995177, 0.995451, 0.995844, 0.996168, 0.996398,
                       0.99654,  0.996779, 0.996912, 0.997158, 0.997283,
                       0.997389, 0.99755,  0.997672, 0.997731, 0.997861,
                       0.997994, 0.998054, 0.998162, 0.99824,  0.998291  };
*/

/*
//0.75fm
double KK_LONG[50] = { 0.270902, 0.690659, 0.815473, 0.873245, 0.906272,
                       0.927801, 0.94292,  0.953665, 0.961657, 0.968311,
                       0.973152, 0.977253, 0.980482, 0.983045, 0.985411,
                       0.987326, 0.988796, 0.990185, 0.991195, 0.992056,
                       0.993069, 0.993616, 0.994309, 0.994725, 0.995284,
                       0.995649, 0.995945, 0.996293, 0.996556, 0.996744,
                       0.996967, 0.997099, 0.997373, 0.997583, 0.997725,
                       0.997793, 0.997926, 0.998039, 0.998179, 0.998258,
                       0.998328, 0.998409, 0.998512, 0.998522, 0.998618,
                       0.998707, 0.998736, 0.998797, 0.998855, 0.998864  };
*/

/*
//1.25fm
double KK_LONG[50] = { 0.276544, 0.704849, 0.831921, 0.890064, 0.922686,
                       0.943586, 0.957802, 0.967498, 0.974251, 0.9798,
                       0.983482, 0.98635,  0.988659, 0.990242, 0.991732,
                       0.992899, 0.993813, 0.994582, 0.995075, 0.995513,
                       0.996124, 0.996359, 0.996782, 0.996986, 0.997362,
                       0.997496, 0.997649, 0.99786,  0.998001, 0.998105,
                       0.998217, 0.99826,  0.998471, 0.998586, 0.998666,
                       0.99867,  0.99875,  0.998818, 0.998909, 0.998984,
                       0.999002, 0.999053, 0.999111, 0.999125, 0.999173,
                       0.999238, 0.999252, 0.999281, 0.999324, 0.999315  };
*/

/*
//1.5fm
double KK_LONG[50] = { 0.279412, 0.711976, 0.839987, 0.898032, 0.930118,
                       0.950357, 0.963763, 0.97271,  0.97868,  0.983532,
                       0.986616, 0.988915, 0.990848, 0.992065, 0.993266,
                       0.994181, 0.994944, 0.995577, 0.995949, 0.996313,
                       0.996802, 0.996958, 0.997347, 0.997503, 0.997826,
                       0.997938, 0.998043, 0.998226, 0.998341, 0.998422,
                       0.998532, 0.998528, 0.998727, 0.998826, 0.998888,
                       0.998898, 0.998957, 0.999003, 0.999094, 0.999157,
                       0.999155, 0.999202, 0.999251, 0.999276, 0.999304,
                       0.999366, 0.999384, 0.999401, 0.999435, 0.999436  };
*/

//1fm
/*
double PI_LONG[50] = { 0.722252, 0.907553, 0.948263, 0.965878, 0.9756,
                       0.981806, 0.986068, 0.989019, 0.991139, 0.992895,
                       0.99411,  0.995101, 0.99588,  0.996457, 0.99699,
                       0.997416, 0.997736, 0.998022, 0.998217, 0.998385,
                       0.998603, 0.998701, 0.998844, 0.998923, 0.999049,
                       0.999105, 0.999165, 0.999238, 0.999287, 0.999326,
                       0.999367, 0.999387, 0.999456, 0.999498, 0.999527,
                       0.999534, 0.99956,  0.999588, 0.999615, 0.999636,
                       0.999651, 0.999667, 0.999687, 0.99969,  0.999711,
                       0.999729, 0.999735, 0.999747, 0.999762, 0.999757  };
*/

//4fm
double PI_LONG[40] = {  0.516417, 0.839253, 0.917381, 0.950586, 0.967903,
			0.978306, 0.984714, 0.98884, 0.991354, 0.993379,
			0.994595, 0.995465, 0.996283, 0.996711, 0.997174,
			0.997565, 0.997882, 0.998155, 0.998293, 0.998465,
			0.998667, 0.998695, 0.998887, 0.998964, 0.999085,
			0.999136, 0.999163, 0.999259, 0.999287, 0.999344,
			0.999383, 0.999361, 0.999455, 0.999501, 0.999544,
			0.999536, 0.999556, 0.999572, 0.999619, 0.999636 };

//_________________
class HbtFitter {

 public:

  HbtFitter(Int_t PartType=4, Int_t SourceForm=0,
            Int_t NonFemtoForm=0, Bool_t ExcludePoints=false);
  ~HbtFitter();
  void Clear();
  
  static HbtFitter* objHbtFitter;

  static void SetObject(HbtFitter *obj) {objHbtFitter = obj;} //Do I need void?

  static void FitFunc1DChiSquare(Int_t &npar, Double_t *gin, Double_t &f, 
				 Double_t *par, Int_t iflag);
  static void FitFunc1DLogLike(Int_t &npar, Double_t *gin, Double_t &f, 
			       Double_t *par, Int_t iflag);
  static void FitFunc3DChiSquare(Int_t &npar, Double_t *gin, Double_t &f, 
				 Double_t *par, Int_t iflag);
  static void FitFunc3DLogLike(Int_t &npar, Double_t *gin, Double_t &f, 
			       Double_t *par, Int_t iflag);

  //////////////// Setters /////////////

  //General settings
  void SetNonFemtoForm(Int_t NonFemtoFrom = 0);
  void SetSourceForm(Int_t SourceForm = 0);  //0-Gaus,1-Expo
  void SetPartType(Int_t PartType) {mPartType = PartType;}
  void SetFitMethod(Int_t method = 1); //0-ChiSquare, 1-LogLikelihod; 0 is default

  //Apply non-femto correction or not; true by default
  void SetCorrectOnMc(Bool_t DoCorrect = false);

  //Fix fit parameters
  void FixFitParameter1D(Int_t iPar) {mFixParameters1D.push_back(iPar);}
  void FixFitParameter3D(Int_t iPar) {mFixParameters3D.push_back(iPar);}

  //Call this functions to fit histograms
  void Fit1D();
  void Fit3D();
 
  //Project fit
  void MakeProjections(); //This function calls three below
  void MakeExpProjections();
  void MakeMcProjections();
  void MakeFitNumerator();
  void MakeFitProjections();

  void Make1DFunctions();
  void Make1DCorrFctn();
  void Make1DFitFunction();

  //Histogram projections
  void Project3DCorrFctn(TH3F* hNumer, TH3F* hDenom, 
			 TH1F *&hOutProjNum, TH1F *&hSideProjNum, TH1F *&hLongProjNum,
			 TH1F *&hOutProjDen, TH1F *&hSideProjDen, TH1F *&hLongProjDen,
			 Int_t mOutBinLow, Int_t mOutBinHi,
			 Int_t mSideBinLow, Int_t mSideBinHi,
			 Int_t mLongBinLow, Int_t mLongBinHi);

  void Project3DCorrFctn(TH3F* hNumer, TH3F* hDenom, 
			 TH1F *&hOutProjNum, TH1F *&hSideProjNum, TH1F *&hLongProjNum,
			 TH1F *&hOutProjDen, TH1F *&hSideProjDen, TH1F *&hLongProjDen,
			 Double_t mQoutLow, Double_t mQoutH1i,
			 Double_t mQsideLow, Double_t mQsideHi,
			 Double_t mQlongLow, Double_t mQlongHi);

  void Project3DDistribution(TH3F* hQdist, 
			     TH1F *&hQoutProj, TH1F *&hQsideProj, TH1F *&hQlongProj,
			     Int_t mOutBinLow, Int_t mOutBinHi,
			     Int_t mSideBinLow, Int_t mSideBinHi,
			     Int_t mLongBinLow, Int_t mLongBinHi);

  void Project3DDistribution(TH3F* hQdist, 
			     TH1F *&hQoutProj, TH1F *&hQsideProj, TH1F *&hQlongProj,
			     Double_t mQoutLow, Double_t mQoutHi,
			     Double_t mQsideLow, Double_t mQsideHi,
			     Double_t mQlongLow, Double_t mQlongHi);

  //Set number of bins and ranges
  void Set1DHistoRange(Double_t lo, Double_t hi) {mQinvVal[0]=lo; mQinvVal[1]=hi;}
  void Set1DBinsNum(Int_t nbins) {mQinvNbins = nbins;}
  void Set3DHistoRange(Double_t outLo, Double_t outHi,
		       Double_t sideLo, Double_t sideHi,
		       Double_t longLo, Double_t longHi);
  void Set3DBinsNum(Int_t OutNBins, Int_t SideNBins, Int_t LongNBins);

  //Fit ranges
  void Set1DFitRange(Double_t lo=0., Double_t hi=0.4);
  void Set3DFitRange(Double_t qOutLo=0., Double_t qOutHi=0.4,
		     Double_t qSideLo=0., Double_t qSideHi=0.4,
		     Double_t qLongLo=0., Double_t qLongHi=0.4);

  //Set 3D projection ranges
  void SetProjectionType(Bool_t type) {mProjectionType = type;} //Default is by bins
  void SetProjectionBins(Int_t oLow, Int_t oHi, Int_t sLow, Int_t sHi, Int_t lLow, Int_t lHi);
  void SetOutProjectionBins(Int_t oLow, Int_t oHi) {mOutProjBins[0]=oLow; mOutProjBins[1]=oHi;}
  void SetSideProjectionBins(Int_t sLow, Int_t sHi) {mSideProjBins[0]=sLow; mSideProjBins[1]=sHi;}
  void SetLongProjectionBins(Int_t lLow, Int_t lHi) {mLongProjBins[0]=lLow; mLongProjBins[1]=lHi;}

  void SetProjectionVals(Double_t oLo, Double_t oHi, Double_t sLo, Double_t sHi,
			 Double_t lLo, Double_t lHi);
  void SetOutProjectionVals(Double_t lo, Double_t hi) {mOutProjVals[0]=lo; mOutProjVals[1]=hi;}
  void SetSideProjectionVals(Double_t lo, Double_t hi) {mSideProjVals[0]=lo; mSideProjVals[1]=hi;}
  void SetLongProjectionVals(Double_t lo, Double_t hi) {mLongProjVals[0]=lo; mLongProjVals[1]=hi;}

  //In case of the excluding the region from the fit
  void SetExcludeFromFit(Bool_t ExcludePoints) {mExcludeRange = ExcludePoints;}
  void SetExcludeRange(Double_t xMin, Double_t xMax);
  
  //Set non-femtscopic parameters
  void Set1DNonFemtoParameters(vector<double> par);
  void Set3DNonFemtoParameters(vector<double> parOut,
			       vector<double> parSide,
			       vector<double> parLong);

  //Operations on histograms
  void Set1DHistos(TH1* rat, TH1* num, TH1* den);
  void Set1DNumer(TH1* histo) {h1dNumer = (TH1F*)histo;}
  void Set1DDenom(TH1* histo) {h1dDenom = (TH1F*)histo;}
  void Set1DCorrFctn(TH1* histo) {h1dCorrFctn = (TH1F*)histo;}
  void Set1DMcHistos(TH1* rat, TH1* num, TH1* den);
  void Set1DMcNumer(TH1* histo) {h1dMcNumer = (TH1F*)histo;}
  void Set1DMcDenom(TH1* histo) {h1dMcDenom = (TH1F*)histo;}
  void Set1DMcCorrFctn(TH1* histo) {h1dMcCorrFctn = (TH1F*)histo;}

  void Set3DHistos(TH3* hCorr, TH3* hNum, TH3* hDen, TH3* hCoul);
  void Set3DNumer(TH3* histo) {h3dNumer = (TH3F*)histo;}
  void Set3DDenom(TH3* histo) {h3dDenom = (TH3F*)histo;}
  void Set3DCorrFctn(TH3* histo) {h3dCorrFctn = (TH3F*)histo;}
  void Set3DCoulomb(TH3* histo) {h3dCoulombWeight = (TH3F*) histo;}
  void Set3DMcHistos(TH3* rat, TH3* num, TH3* den);
  void Set3DMcNumer(TH3* histo) {h3dMcNumer = (TH3F*)histo;}
  void Set3DMcDenom(TH3* histo) {h3dMcDenom = (TH3F*)histo;}
  void Set3DMcCorrFctn(TH3* histo) {h3dMcCorrFctn = (TH3F*)histo;}

  /////////////////// Getters /////////////////////

  TH1F* Get1DNumer() {return h1dNumer;}
  TH1F* Get1DDenom() {return h1dDenom;}
  TH1F* Get1DCorrFctn() {return h1dCorrFctn;}
  TH1F* Get1DMcNumer() {return h1dMcNumer;}
  TH1F* Get1DMcDenom() {return h1dMcDenom;}
  TH1F* Get1DMcCorrFctn() {return h1dMcCorrFctn;}

  TH3F* Get3DNumer() {return h3dNumer;}
  TH3F* Get3DDenom() {return h3dDenom;}
  TH3F* Get3DCorrFctn() {return h3dCorrFctn;}
  TH3F* Get3DCoulombWeight() {return h3dCoulombWeight;}
  TH3F* Get3DMcNumer() {return h3dMcNumer;}
  TH3F* Get3DMcDenom() {return h3dMcDenom;}
  TH3F* Get3DMcCorrFctn() {return h3dMcCorrFctn;}

  TH1F* Get3DOutProjection() {return h3dCorrFctnOutProj;}
  TH1F* Get3DFitOutProjection() {return h3dCorrFctnFitOutProj;}
  TH1F* Get3DSideProjection() {return h3dCorrFctnSideProj;}
  TH1F* Get3DFitSideProjection() {return h3dCorrFctnFitSideProj;}
  TH1F* Get3DLongProjection() {return h3dCorrFctnLongProj;}
  TH1F* Get3DFitLongProjection() {return h3dCorrFctnFitLongProj;}

  //Return number of femto and non-femto parameters
  Int_t GetFemto1DParNum() {return mFemto1DParNum;}
  Int_t GetNonFemto1DParNum() {return mNonFemto1DParNum;}
  Int_t GetFemto3DParNum() {return mFemto3DParNum;}
  Int_t GetNonFemto3DParNum() {return mNonFemto3DParNum;}

  //Return fit parameters
  double GetChi2() {return mChi2;}
  double GetNDF() {return mNDF;}
  double GetChi2PerNDF() {return mChi2PerNDF;}
  vector<double> GetFemto1DParameters() {return mFemto1DVal;}
  vector<double> GetFemto1DParError() {return mFemto1DValErr;}
  vector<double> GetNonFemto1DParameters() {return mNonFemto1DVal;}
  vector<double> GetNonFemto1DParError() {return mNonFemto1DValErr;}

  vector<double> GetFemto3DParameters() {return mFemto3DVal;}
  vector<double> GetFemto3DParError() {return mFemto3DValErr;}
  vector<double> GetNonFemto3DParameters() {return mNonFemto3DVal;}
  vector<double> GetNonFemto3DParError() {return mNonFemto3DValErr;}

  //Coulomb corrections
  Double_t Coulomb1D(Int_t qInvBin);
  Double_t Coulomb3D(Int_t qOutBin, Int_t qSideBin, Int_t qLongBin);

  //Theoretical correlation functions
  Double_t TheorCorrFctn1D(Double_t *par, Int_t qInvBin);
  Double_t TheorCorrFctn3D(Double_t *par, Int_t qOutBin, Int_t qSideBin, Int_t qLongBin);

  //Non-femtoscopic functions
  Double_t NonFemto1D(Double_t *par, Double_t qInv);
  Double_t NonFemto3D(Double_t *par, Double_t qOut, Double_t qSide, Double_t qLong);

  //Use Coulomb correction: Correct if true, if not Coulomb=1
  void UseCoulombCorrection(Bool_t IsUsed) {mUseCoulombCorrection = IsUsed;}

  //Static minimization functions for TMinuit
  Double_t CorrFctn1DChiSqr(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
  Double_t CorrFctn1DLogLike(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
  Double_t CorrFctn3DLogLike(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
  Double_t CorrFctn3DChiSqr(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);

 private:

  //General parameters
  Int_t    mPartType;      //3-pion, 4-kaon
  Int_t    mNonFemtoForm;  //0-unity, 1-pol1, 2-pol2, 3-sqrt(pol2), 4-gaussian, 5-a/(1+bQ^2)
  Int_t    mSourceForm;    //0-gaussian, 1-expoential

  //To use or not to use Coulomb correction. To use by default
  Bool_t   mUseCoulombCorrection;
  Int_t    mFitMethod;     //0-ChiSquare, 1-LogLikelihood

  //Correct on MC or not. Default is true
  Bool_t   mCorrectOnMc;

  //Histogram projection by bins or by vals
  Bool_t   mProjectionType;

  //Set parameters that have to be fixed
  vector<Int_t> mFixParameters1D;
  vector<Int_t> mFixParameters3D;
  
  //If exlude points from fit
  Bool_t   mExcludeRange;

  //Number of bins in histos
  Int_t    mQinvNbins;      //number of bins in 1D histogram
  Int_t    mQoutNbins;      //Out
  Int_t    mQsideNbins;     //Side
  Int_t    mQlongNbins;     //Long

  //Histogram ranges
  Double_t  mQinvVal[2];     //qInv Lo,Hi
  Double_t  mQoutVal[2];     //qOut Lo,Hi
  Double_t  mQsideVal[2];    //qSide Lo,Hi
  Double_t  mQlongVal[2];    //qLong Lo,Hi

  //Fit ranges
  Int_t     mQinvFitRangeBin[2];
  Double_t  mQinvFitRange[2];
  Int_t     mQoutFitRangeBin[2];
  Double_t  mQoutFitRange[2];
  Int_t     mQsideFitRangeBin[2];
  Double_t  mQsideFitRange[2];
  Int_t     mQlongFitRangeBin[2];
  Double_t  mQlongFitRange[2];

  //Projection ranges in bins (from bin[0] to bin[1])
  Int_t     mOutProjBins[2];
  Int_t     mSideProjBins[2];
  Int_t     mLongProjBins[2];
  //Projection ranges in values (from val[0] to val[1])
  Double_t  mOutProjVals[2];
  Double_t  mSideProjVals[2];
  Double_t  mLongProjVals[2];

  //Number of the non-femtosocpic parameters
  Int_t     mFemto1DParNum;
  Int_t     mFemto3DParNum;
  Int_t     mNonFemto1DParNum;
  Int_t     mNonFemto3DParNum;

  //Fit parameters (after fit)
  double    mChi2;
  double    mNDF;
  double    mChi2PerNDF;
  vector<double> mFemto1DVal;
  vector<double> mFemto1DValErr;
  vector<double> mNonFemto1DVal;
  vector<double> mNonFemto1DValErr;

  vector<double> mFemto3DVal;
  vector<double> mFemto3DValErr;
  vector<double> mNonFemto3DVal;
  vector<double> mNonFemto3DValErr;

  //Values of the 1D baseline non-femtoscopic parameters
  Double_t  mNonFemto1DParArr[3];
  Double_t  mNonFemto1DParErrArr[3];
  //Values of the 3D baseline non-femtoscopic parameters [out,side,long][mNonFemtoParNum]
  Double_t  mNonFemto3DParArr[3][3];
  Double_t  mNonFemto3DParErrArr[3][3];  
  
  //Region that is excluded from the fit: 1D case
  Double_t  mExcludedVal[2];
  //Region that is excluded from the fit: 3D case
  Double_t  mExcluded3DVal[3][2];

  //Histograms with Qinv weights. Use Qinv in order to get 1D Coulomb correction
  TH3F*    hBP3DCoulWeightQinv;

  //////////////////
  //  Histograms  //
  //////////////////

  //One-dimensional histograms
  TH1F*    h1dNumer;
  TH1F*    h1dDenom;
  TH1F*    h1dCorrFctn;
  TH1F*    h1dMcNumer;
  TH1F*    h1dMcDenom;
  TH1F*    h1dMcCorrFctn;

  TH1F*    h1dFitNumerator;

  //Three-dimensional histograms
  TH3F*    h3dNumer;
  TH3F*    h3dDenom;
  TH3F*    h3dCorrFctn;
  TH3F*    h3dCoulombWeight;
  TH3F*    h3dMcNumer;
  TH3F*    h3dMcDenom;
  TH3F*    h3dMcCorrFctn;

  //Fit numerator and fit projections
  TH3F*    h3dFitNumerator;
  TH1F*    h3dFitQoutProj;
  TH1F*    h3dFitQsideProj;
  TH1F*    h3dFitQlongProj;

  //Projected numerators and denominators
  TH1F*    h3dQoutProjNum;
  TH1F*    h3dQoutProjDen;
  TH1F*    h3dMcQoutProjNum;
  TH1F*    h3dMcQoutProjDen;

  TH1F*    h3dQsideProjNum;
  TH1F*    h3dQsideProjDen;
  TH1F*    h3dMcQsideProjNum;
  TH1F*    h3dMcQsideProjDen;
  
  TH1F*    h3dQlongProjNum;
  TH1F*    h3dQlongProjDen;
  TH1F*    h3dMcQlongProjNum;
  TH1F*    h3dMcQlongProjDen;

  //Correlation function projections
  TH1F*    h3dCorrFctnOutProj;
  TH1F*    h3dMcCorrFctnOutProj;
  TH1F*    h3dCorrFctnFitOutProj;

  TH1F*    h3dCorrFctnSideProj;
  TH1F*    h3dMcCorrFctnSideProj;
  TH1F*    h3dCorrFctnFitSideProj;

  TH1F*    h3dCorrFctnLongProj;
  TH1F*    h3dMcCorrFctnLongProj;
  TH1F*    h3dCorrFctnFitLongProj;

  void     Calculate3DChi2();
};

inline void HbtFitter::Set1DHistos(TH1* rat, TH1* num, TH1* den) {
  h1dNumer = (TH1F*)num; h1dDenom = (TH1F*)den; h1dCorrFctn = (TH1F*)rat;
}
inline void HbtFitter::Set1DMcHistos(TH1* rat, TH1* num, TH1* den) {
  h1dMcNumer = (TH1F*)num; h1dMcDenom = (TH1F*)den; h1dMcCorrFctn = (TH1F*)rat;
}
inline void HbtFitter::Set3DHistos(TH3* hCorr, TH3* hNum, TH3* hDen, TH3* hCoul) {
  h3dNumer = (TH3F*)hNum; h3dDenom = (TH3F*)hDen; 
  h3dCorrFctn = (TH3F*)hCorr; h3dCoulombWeight = (TH3F*)hCoul;
}
inline void HbtFitter::Set3DMcHistos(TH3* rat, TH3* num, TH3* den) {
  h3dMcNumer = (TH3F*)num; h3dMcDenom = (TH3F*)den; h3dMcCorrFctn = (TH3F*)rat;
}
inline void HbtFitter::SetProjectionBins(Int_t oLow, Int_t oHi, 
					 Int_t sLow, Int_t sHi, 
					 Int_t lLow, Int_t lHi) {
  mOutProjBins[0]=oLow; mOutProjBins[1]=oHi;
  mSideProjBins[0]=sLow; mSideProjBins[1]=sHi;
  mLongProjBins[0]=lLow; mLongProjBins[1]=lHi;
}
inline void HbtFitter::SetProjectionVals(Double_t oLo, Double_t oHi, 
					 Double_t sLo, Double_t sHi,
					 Double_t lLo, Double_t lHi) {
  mOutProjVals[0] = oLo; mOutProjVals[1] = oHi;
  mSideProjVals[0] = sLo; mSideProjVals[1] = sHi;
  mLongProjVals[0] = lLo; mLongProjVals[1] = lHi;
}
#endif //#define HbtFitter_h
