// Author: Gero Flucke <mailto:gero.flucke@desy.de>
//____________________________________
//
//   last update: $Date: 2006/01/11 13:05:17 $
//   by:          $Author: flucke $
//
// fitting class for D*-Analysis:
//                  fits delta-mass-plots (m_{Kpipis} - m_{Kpi})
//
// This class is part of the DstarDmFitter package available in H1 CVS repository, 
//   https://www-h1.desy.de/icgi-cas/cvsweb/DstarDmFitter.
//
// The class DstarDmFitter is designed to fit 
// the peak and background in 1-D histograms
// of the well known Delta-m-plots for D*. 
//
//  The fitting function is:
//
//  nDstar*gaus(mean, sigma) 
//                  + U_n*N*((x-massPi)**U_exp)*(1-U_sqr*x**2)
//  i.e.:
//  (     signal    
//                  +      background        )
// 
//  nDstar:                number of D* in the peak
//  mean:                  mean  of gaus peak
//  sigma:                 sigma ------"-----
//  U_n:                   number of D* candidates in background
//  U_exp:                 exponent                ------"------
//  U_sqr:                 square corr.            ------"------
// 
// (N:                     normalisation factor of background )
//
//  Besides nDstar and U_n you can choose to fix some of them.
//  (If a WC-background-only histogram is given in addition to the 
//   right charge histogram, it is simultaneously fitted with one
//    additional parameter, the ratio of U_n and U_n of the WC background only.)
//
//  The range of the fit is restricted from mass(Pi) to 0.1675 GeV (fUpFitLimit), 
//  but the latter can be set manually.
//  (take care: L4-finder cuts on 0.170 for photoproduction, 0.180 for DIS)
//
//  If the flag SetDetectIsMC is called before a fit, DstarDmFitter should be able to 
//  distinguish between data and backgroundless MC.
//  In the latter case it fits only the peak
//  and sets the normalisation of the background to 0.
//  (This may not be accurate, as also MC has some combinatorical background!)
//  It is also possible to fit a (WC) background only, cf. DstarDmFitter::Fit(Int_t mode) 
//
//  The default fitting option foresees a likelihood fit, but this is ignored
//  if the histogram contains weighted entries (==> ch^2 fit). 
//  To enforce likelihood method in this case, add the option 'LL'.
//
//  fitting functions:
//  ---------------------------
//  FitAll():
//    All 6 parameters are fitted.
//  
//  FitFixMeanSigmaExpSqr():
//    Mean and sigma of signal 
//    and exponent and square of background are fixed,
//    only nDstar and U_n are fixed.
// 
//  FitFixXXXYYYZZZ():
//    all other combinations of fixed parameters are foreseen,
//    all beginning with FitFix and ending with an indication
//    which parameters are fixed.
//
//  Two fitting modes are foreseen:
//  A smart mode and an unsmart mode. 
//  In the first case only those fitting parameters,
//  that are not fixed, appear in the histogram's 
//  statistic box, if you draw the histogram afterwards.
//  In the latter case all parameters are shown, 
//  the fixed ones with an error of +-0.
//  (For recent ROOT versions >= 4.04.02 [?] smart modes are not needed anymore since
//   ROOT itself skips fixed parameters.)
//  Use SetSmartMode(kTRUE/kFALSE) to specify the mode.
//  The default has recently changed to unsmart since it is obsolete for recent 
//  ROOT versions and not all features are supported for smart mode.
//  (up to now for several modes or, if a WC-histogram is given in
//   addition, smartness has no effect and the smart 
//   modes can't deal with WC-background-only histograms!)
//  
//
//  For all fitting functions also a 'shortcut' is foreseen to 
//  get rid of one line, for example:
//
//  FitAll(hist); // or FitAll(hist, histWc); for setting a WC-hist, too
//     is possible instead of
//  SetHist(hist);
//  FitAll();
//
//  When fitting in unsmart mode, one can endorce a parameter range for the 
//  background parameters U_sqr and U_sqr:
//
//  SetLimitBackground(); // using default limits
//
//  Getters and Setters:                     
//  --------------------
//  You can get:                         by:
//  - S/U of the last fit                 GetSignalBack()
//  - actual value of sigma               GetSigma()
//  -              of mean                GetMean()
//  -              of nDstar              GetNDstar()
//  -              of U_exp               GetBackgrExp()
//  -              of U_sqr               GetBackgrSqr()
//  -              of U_n                 GetBackgrNorm()
//  -              of U_n/U_n,wc          GetWcScale() // if WC hist given! 
//  -              of nDstar's error      GetNDstarErr()
//  -              of U_n's error         GetBackgrNormErr()
//  -              of the upper fit limit GetUpFitLimit()
//  - the name     of the set histogram   GetHistName()
//  - the binsize  ---------"----------   GetHistBinSize()
//  - the fitted TF1 assoc. to the hist   GetFittedFunc()
//  - the background part of the prior    GetFittedBackgrFunc()
//
//  You can set                         by:
//  - sigma                            SetSigma(Double_t s)
//  - mean                             SetMean(Double_t m)
//  - exponent of background           SetBackgrExp(Double_t e)
//  - sqr-factor of background         SetBackgrSqr(Double_t s)
//  - a new histogram 'TH1* hist'      SetHist(hist)   *)
//  - the upper fit limit              SetUpFitLimit(double u)
//  - the mode to unsmart              SetSmartMode(kFALSE)
//  - root's fit option                SetFitOption(const char* option)
//
//   *) Here by default mean, sigma, U_exp and U_sqr 
//      stay at the values of the last fit.
//      If you want to reset the initial values use:
//      SetHist(TH1* hist, kTRUE).
//
//  Thanks to Roger Wolf there is now also the possibility to set ranges for 
//  the background parameters (I did not test it yet):
//     SetUpperBackgrSqrt(Double_t s);
//     SetLowerBackgrSqrt(Double_t s);
//     SetUpperBackgrExp (Double_t e);
//     SetLowerBackgrExp (Double_t e);
//
//
//  known limitations:
//  ------------------
//  The histogram has to have constant bin size!
//  (This will be checked:
//   If the deviation is bigger than 0.01%, an ERROR message
//   is printed and the fitting results will be senseless.)
//
//  If you fit a second histogram with another bin size than the
//  previous fit and draw the first histogram, the drawn fit function
//  is scaled by the ratio of the old and new bin size. But the fit
//  values shown in the statistic box are still correct.
// 
//  Smart modes ignore (!) a given WC-histogram (but put a warning).
//  They also ignore limits for the background parameters (without warning).
//
//  If someone else deletes the histogram, 
//  there will be a crash...
//         
//  TH1S and TH1C histograms are not yet tested.
//
//  You have to link ROOT's libEG.so. So in interactive ROOT do
//  gSystem.Load("libEG.so"); (Not needed for ROOT >= 4.00.08 or so.)
//
//  For use in ROOT 3.01_06 or higher only! 
//
//    example of usage:
//    -----------------
//    TH1F* hist1 = new TH1F("dmHist1","#Delta m",
//                            33, 0.137, 0.17);
//    TH1F* hist2 = new TH1F("dmHist2","#Delta m with cuts",
//                            33, 0.137, 0.17);
//    TH1F* hist3 = new TH1F("dmHist3","#Delta m with other cuts",
//                            33, 0.137, 0.17);
//    TH1F* hist3Wc = new TH1F("dmHist3Wc","#Delta m for WC with other cuts",
//                              33, 0.137, 0.17);
//    //       filling of hists not shown...
//    DstarDmFitter fitter(hist1);
//    fitter.FitAll();
//    Double_t nDstar = fitter.GetNDstar();
//    Double_t sigma = fitter.GetSigma();
//    Double_t sigBack = fitter.GetSignalBack();
//    fitter.SetHist(hist2); // sigma etc. are not reset! 
//    // fit the subsample with the same sigma, mean, ... 
//    fitter.FitFixAll();
//    double nDstarCuts = fitter.GetNDstar();      
//    fitter.SetSigma(1.1*sigma);
//    fitter.FitFixSigma(hist3, hist3Wc);

#include "DstarDmFitter.h"

#include "DstarDmFitterUnsmart.h"
// #include "DstarDmFitterMe.h"
// #include "DstarDmFitterMeSi.h"
// #include "DstarDmFitterMeSiEx.h"
#include "DstarDmFitterMeSiExSq.h"
#include "DstarDmFitterMeSiSq.h"

// #include "DstarDmFitterMeEx.h"
// #include "DstarDmFitterMeExSq.h"
// #include "DstarDmFitterMeSq.h"

// #include "DstarDmFitterSi.h"
// #include "DstarDmFitterSiEx.h"
// #include "DstarDmFitterSiExSq.h"
// #include "DstarDmFitterSiSq.h"

// #include "DstarDmFitterEx.h"
// #include "DstarDmFitterExSq.h"
// #include "DstarDmFitterSq.h"

#include <TH1.h>

ClassImp(DstarDmFitter)
 
//******************************************

 DstarDmFitter::DstarDmFitter(TH1* hist, TH1* hWc)
{
  // constructor with hist(s) (does not work for TH2!)

  fSmart = kFALSE;
  fFitter = new DstarDmFitterUnsmart(hist, hWc);
}

//******************************************

 DstarDmFitter::DstarDmFitter(const DstarDmFitter& source)
{
  fSmart = source.fSmart;
  fFitter = new DstarDmFitterUnsmart(*(source.fFitter));
}

//******************************************

 DstarDmFitter::~DstarDmFitter()
{
  delete fFitter;
  fFitter = 0;
}

//******************************************

DstarDmFitter& DstarDmFitter::operator=(const DstarDmFitter& rhs)
{
  if(&rhs!= this){
    fSmart = rhs.fSmart;
    *fFitter = *(rhs.fFitter);
  }
  return *this;
}

//******************************************
//******************************************

 void DstarDmFitter::SetHist(TH1* hist, TH1* hWc, Bool_t defSigmaMeanExpSqr)
{
  // sets the histogram 'hist' (and wrong charge hist 'hWc')for a new fit
  // if(defSigmaMeanExpSqr==kTRUE):
  //   sigma, mean, backgrExp and backgrSqr
  //   are reset to the defaults,
  // else (=default!) they stay as they are.
  fFitter->SetHist(hist, hWc, defSigmaMeanExpSqr);
}

//******************************************

 void DstarDmFitter::SetSigma(Double_t sigma)
{
  // sets sigma for next fit
  // if no argument given: set default
  fFitter->SetSigma(sigma);
}

//******************************************

 void DstarDmFitter::SetMean(Double_t mean)
{
  // sets mean for next fit
  // if no argument given: set default
  fFitter->SetMean(mean);
}

//******************************************

 void DstarDmFitter::SetBackgrExp(Double_t exp)
{
  // sets exponent of background for next fit
  // if no argument given: set default
  fFitter->SetBackgrExp(exp);
}

//******************************************

 void DstarDmFitter::SetBackgrSqr(Double_t sqr)
{
  // sets square factor of background for next fit
  // if no argument given: set default
  fFitter->SetBackgrSqr(sqr);
}

//******************************************

 void DstarDmFitter::SetUpperBackgrExp(Double_t exp)
{
  // sets limit for exponent of background for 
  // next fit if no argument given: set default
  fFitter->SetUpperBackgrExp(exp);
}

//******************************************

 void DstarDmFitter::SetLowerBackgrExp(Double_t exp)
{
  // sets limit for exponent of background for 
  // next fit if no argument given: set default
  fFitter->SetLowerBackgrExp(exp);
}

//******************************************

 void DstarDmFitter::SetUpperBackgrSqrt(Double_t sqr)
{
  // sets limit for square factor of background for 
  // next fit if no argument given: set default
  fFitter->SetUpperBackgrSqrt(sqr);
}

//******************************************

 void DstarDmFitter::SetLowerBackgrSqrt(Double_t sqr)
{
  // sets limit for square factor of background for 
  // next fit if no argument given: set default
  fFitter->SetLowerBackgrSqrt(sqr);
}

//******************************************

 void DstarDmFitter::SetUpFitLimit(Double_t upLimit)
{
  // sets the upper fit limit 
  // if no argument given: set default
  fFitter->SetUpFitLimit(upLimit);
}

//******************************************

 void DstarDmFitter::SetFitOption(const char* option)
{
  // sets root's fitoption (c.f. DstarDmFitterSpecial_I::DstarDmFitterSpecial_I)
  fFitter->SetFitOption(option);
}

//******************************************

 void DstarDmFitter::AddFitOption(const char* option)
{
  // adds 'option' to root's fitoption (c.f. DstarDmFitterSpecial_I::DstarDmFitterSpecial_I)
  fFitter->AddFitOption(option);
}

//******************************************

 void DstarDmFitter::AddFitOption(char option)
{
  // adds 'option' to root's fitoption (c.f. DstarDmFitterSpecial_I::DstarDmFitterSpecial_I)
  fFitter->AddFitOption(option);
}

//******************************************

 void DstarDmFitter::ResetFitParameters()
{
  // resets the fitting parameters sigma, mean, backgrExp and backgrSqr 
  // to their default values
  this->SetSigma();
  this->SetMean();
  this->SetBackgrExp();
  this->SetBackgrSqr();
  this->SetWcScale(1.);
}

//******************************************
//******************************************

 TF1* DstarDmFitter::GetFittedBackgrFunc() const
{
  // pointer to the background part of the fitted function associated with the histogram
  return fFitter->GetFittedBackgrFunc();
}

//******************************************
//******************************************

 Bool_t DstarDmFitter::Fit(Int_t mode)
{
  // fits current hist(s) according to mode 
  // (c.f. DstarDmFitterUnsmart::Fit(Int_t mode)) 
  // smart mode implemented only for 1111 and 1011
  Bool_t OK = kFALSE;
  if(mode == 1111 && !fFitter->GetHistWcPtr()){
    OK = this->FitFixMeanSigmaExpSqr();
  } else if(mode == 1011 && !fFitter->GetHistWcPtr()) {
    OK = this->FitFixMeanSigmaSqr();
  } else {
    OK = fFitter->Fit(mode);
    if(fSmart && (mode || fFitter->GetHistWcPtr())){
      this->Warning("Fit", "smart mode %d not yet implemented!", mode);
    }
  }
  return OK;
}

//******************************************

 Bool_t DstarDmFitter::Fit(Int_t mode, TH1* hist, TH1* hWc)
{
  // fits hist according to mode (c.f. DstarDmFitterUnsmart::Fit(Int_t mode)) 
  this->SetHist(hist, hWc);
  return this->Fit(mode);
}

//******************************************

 Bool_t DstarDmFitter::FitAll()
{
  // fits current hist(s) without fixing any parameter
  return fFitter->Fit(0);
}

//******************************************

 Bool_t DstarDmFitter::FitAll(TH1* hist, TH1* hWc)
{
  // fits hist(s) without fixing any parameter
  this->SetHist(hist, hWc);
  return this->FitAll();
}

//******************************************

 Bool_t DstarDmFitter::FitFixMean()
{
  // fits current hist(s) with mean value of signal fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterMe f(*fFitter);
    //      f.Fit(1); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixMean",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(1);
}

//******************************************

 Bool_t DstarDmFitter::FitFixMean(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value of signal fixed
  this->SetHist(hist, hWc);
  return this->FitFixMean();
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigma()
{
  // fits current hist(s) with mean value and sigma of signal fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterMeSi f(*fFitter);
    //      f.Fit(11); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixMeanSigma",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(11);
}


//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigma(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value and sigma of signal fixed
  this->SetHist(hist, hWc);
  return this->FitFixMeanSigma();
}


//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigmaExp()
{
  // fits current hist(s) with mean value and sigma of signal and 
  // U_exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterMeSiEx f(*fFitter);
    //      f.Fit(111); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixMeanSigmaExp",
	      "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(111);
}


//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigmaExp(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value and sigma of signal and 
  // U_exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixMeanSigmaExp();
}


//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigmaExpSqr()
{
  // fits current hist(s) with the following parameters fixed:
  // mean and sigma of signal,
  // exponent and square factor of background
  Bool_t OK = kFALSE;
  if(fSmart){
    DstarDmFitterMeSiExSq f(*fFitter);
    OK = f.Fit(1111); // mode doesn't matter!
    *fFitter = f;
  } else {
    OK = fFitter->Fit(1111);
  }
  return OK;
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigmaExpSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with the following parameters fixed:
  // mean and sigma of signal,
  // exponent and square factor of background
  this->SetHist(hist, hWc);
  return this->FitFixMeanSigmaExpSqr();
}


//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigmaSqr()
{
  // fits current hist(s) with mean value and sigma of signal and 
  // U_sqr of background fixed

  // smart mode not yet implemented!
  Bool_t OK = kFALSE;
  if(fSmart) {
    DstarDmFitterMeSiSq f(*fFitter);
    OK = f.Fit(1011); // mode doesn't matter!
    *fFitter = f;
    //this->Warning("FitFixMeanSigmaSqr",
    //	  "Smart mode not yet implemented, fitting unsmartly.n");
  } else {
    OK = fFitter->Fit(1011);
  }
  return OK;
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanSigmaSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value and sigma of signal and 
  // U_sqr of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixMeanSigmaSqr();
}


//******************************************

 Bool_t DstarDmFitter::FitFixMeanExp()
{
  // fits current hist(s) with mean value of signal and 
  // U_exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterMeEx f(*fFitter);
    //      f.Fit(101); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixMeanExp",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(101);
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanExp(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value of signal and 
  // U_exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixMeanExp();
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanExpSqr()
{
  // fits current hist(s) with mean value of signal and 
  // U_sqr, U_exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterMeExSq f(*fFitter);
    //      f.Fit(1101); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixMeanExpSqr",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(1101);
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanExpSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value of signal and 
  // U_sqr, U_exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixMeanExpSqr();
}

//******************************************

 Bool_t DstarDmFitter::FitFixMeanSqr()
{
  // fits current hist(s) with mean value of signal and U_sqr of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterMeSq f(*fFitter);
    //      f.Fit(1001); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixMeanSqr", 
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(1001);
}
//******************************************

 Bool_t DstarDmFitter::FitFixMeanSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with mean value of signal and U_sqr of background fixed
  this->SetHist(hist);
  return this->FitFixMeanSqr();
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigma()
{
  // fits current hist(s) with sigma of signal fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterSi f(*fFitter);
    //      f.Fit(10); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixSigma",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(10);
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigma(TH1* hist, TH1* hWc)
{
  // fits hist(s) with sigma of signal fixed
  this->SetHist(hist, hWc);
  return this->FitFixSigma();
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigmaExp()
{
  // fits current hist(s) with sigma of signal and 
  // U_exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterSiEx f(*fFitter);
    //      f.Fit(110); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixSigmaExp",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(110);
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigmaExp(TH1* hist, TH1* hWc)
{
  // fits hist(s) with sigma of signal and 
  // U_exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixSigmaExp();
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigmaExpSqr()
{
  // fits current hist(s) with sigma of signal and 
  // U_sqr, U_exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterSiExSq f(*fFitter);
    //      f.Fit(1110); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixSigmaExpSqr",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(1110);
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigmaExpSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with sigma of mean value of signal and 
  // U_sqr, U_exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixSigmaExpSqr();
}

//******************************************

 Bool_t DstarDmFitter::FitFixSigmaSqr()
{
  // fits current hist(s) with sigma of signal and U_sqr of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterSiSq f(*fFitter);
    //      f.Fit(1010); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixSigmaSqr", 
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(1010);
}
//******************************************

 Bool_t DstarDmFitter::FitFixSigmaSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with sigma of signal and U_sqr of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixSigmaSqr();
}

//******************************************

 Bool_t DstarDmFitter::FitFixExp()
{
  // fits current hist(s) with U_Exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterEx f(*fFitter);
    //      f.Fit(100); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixExp",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
   // else 
  return fFitter->Fit(100);
}

//******************************************

 Bool_t DstarDmFitter::FitFixExp(TH1* hist, TH1* hWc)
{
  // fits hist(s) with U_Exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixExp();
}

//******************************************

 Bool_t DstarDmFitter::FitFixExpSqr()
{
  // fits current hist(s) with U_sqr and U_Exp of background fixed
  // smart mode not yet implemented!
  if(fSmart) {
    //      DstarDmFitterExSq f(*fFitter);
    //      f.Fit(1100); // mode doesn't matter!
    //      *fFitter = f;
    this->Warning("FitFixExpSqr",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  // else 
  return fFitter->Fit(1100);
}

//******************************************

 Bool_t DstarDmFitter::FitFixExpSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with U_sqr and U_Exp of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixExpSqr();
}

//******************************************

 Bool_t DstarDmFitter::FitFixSqr()
{
  // fits current hist(s) with U_sqr of background fixed
  // smart mode not yet implemented!
  if(fSmart){
    //     DstarDmFitterSq f(*fFitter);
    //     f.Fit(1000); // mode doesn't matter!
    //     *fFitter = f;
    this->Warning("FitFixSqr",
		  "Smart mode not yet implemented, fitting unsmartly.n");
  }
  //  else 
  return fFitter->Fit(1000);
}

//******************************************

 Bool_t DstarDmFitter::FitFixSqr(TH1* hist, TH1* hWc)
{
  // fits hist(s) with U_sqr of background fixed
  this->SetHist(hist, hWc);
  return this->FitFixSqr();
}


ROOT page - Class index - 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.