rarPoly.cc

Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Project: BaBar detector at the SLAC PEP-II B-factory
00003 * Package: RooRarFit
00004  *    File: $Id: rarPoly.cc,v 1.6 2011/06/16 13:18:50 fwilson Exp $
00005  * Authors: Lei Zhang
00006  * History:
00007  * 
00008  * Copyright (C) 2005-2012, University of California, Riverside
00009  *****************************************************************************/
00010 
00011 // -- CLASS DESCRIPTION [RooRarFit] --
00012 // This class provides Polynomial/Chebychev Pdf class for RooRarFit
00014 //
00015 // BEGIN_HTML
00016 // This class provides Polynomial/Chebychev Pdf class for RooRarFit
00017 // END_HTML
00018 //
00019 
00020 #include "RooRarFit/rarVersion.hh"
00021 
00022 #include "Riostream.h"
00023 
00024 #include "RooFitCore/RooArgList.hh"
00025 #include "RooFitCore/RooDataSet.hh"
00026 #include "RooFitCore/RooFormulaVar.hh"
00027 #include "RooFitCore/RooRealVar.hh"
00028 #include "RooFitCore/RooStringVar.hh"
00029 
00030 #include "RooFitModels/RooChebychev.hh"
00031 #include "RooFitModels/RooPolynomial.hh"
00032 
00033 #include "RooRarFit/rarPoly.hh"
00034 
00035 ClassImp(rarPoly)
00036   ;
00037 
00041 rarPoly::rarPoly()
00042   : rarBasePdf(),
00043     _x(0), _nOrder(1)
00044 {
00045   init();
00046 }
00047 
00060 rarPoly::rarPoly(const char *configFile, const char *configSec,
00061                  const char *configStr, rarDatasets *theDatasets,
00062                  RooDataSet *theData, const char *name, const char *title)
00063   : rarBasePdf(configFile, configSec, configStr,
00064                theDatasets, theData, name, title),
00065     _x(0), _nOrder(1)
00066 {
00067   init();
00068 }
00069 
00070 rarPoly::~rarPoly()
00071 {
00072 }
00073 
00080 void rarPoly::init()
00081 {
00082   cout<<"init of rarPoly for "<<GetName()<<":"<<endl;
00083   
00084   // first get its obs
00085   _x=createAbsReal("x", "observable"); assert(_x);
00086   // read in pdf params
00087   _nOrder=atoi(readConfStr("nOrder", "1", getVarSec()));
00088   if (_nOrder<=0) _nOrder=1;
00089   _nOrder++;
00090   for (Int_t i=1; i<_nOrder; i++) {
00091     RooAbsReal *P=createAbsReal(Form("P%02d",i),Form("p_{%d}", i),
00092                                 0, -10000, +10000);
00093     _coeffs.add(*P);
00094   }
00095   _params.Print("v");
00096   
00097   // create pdf
00098   if ("Chebychev"==_pdfType) {
00099     _thePdf=new RooChebychev(Form("the_%s", GetName()),_pdfType+" "+GetTitle(),
00100                              *_x, _coeffs);
00101   } else { // default
00102     _thePdf=new RooPolynomial(Form("the_%s",GetName()),_pdfType+" "+GetTitle(),
00103                               *_x, _coeffs);
00104   }
00105 }

Generated on 30 Oct 2013 for RooRarFit by  doxygen 1.4.7