rarGaussian.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: rarGaussian.cc,v 1.7 2011/06/16 13:18:49 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 Gaussian/BreitWigner Pdf class for RooRarFit
00014 //
00015 // BEGIN_HTML
00016 // This class provides Gaussian/BreitWigner 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/RooProdPdf.hh"
00027 #include "RooFitCore/RooRealVar.hh"
00028 #include "RooFitCore/RooStringVar.hh"
00029 
00030 #include "RooFitModels/RooBreitWigner.hh"
00031 #include "RooFitModels/RooGaussian.hh"
00032 #include "RooFitModels/RooLandau.hh"
00033 
00034 #include "RooRarFit/rarGaussian.hh"
00035 
00036 ClassImp(rarGaussian)
00037   ;
00038 
00042 rarGaussian::rarGaussian()
00043   : rarBasePdf(),
00044     _x(0), _mean(0), _sigma(0),
00045     _scale(0), _shift(0)
00046 {
00047   init();
00048 }
00049 
00062 rarGaussian::rarGaussian(const char *configFile, const char *configSec,
00063                          const char *configStr,
00064                          rarDatasets *theDatasets, RooDataSet *theData,
00065                          const char *name, const char *title)
00066   : rarBasePdf(configFile, configSec, configStr,
00067                theDatasets, theData, name, title),
00068     _x(0), _mean(0), _sigma(0),
00069     _scale(0), _shift(0)
00070 {
00071   init();
00072 }
00073 
00074 rarGaussian::~rarGaussian()
00075 {
00076 }
00077 
00084 void rarGaussian::init()
00085 {
00086   cout<<"init of rarGaussian for "<<GetName()<<":"<<endl;
00087   
00088   // first get its dependent/observable
00089   _x=createAbsReal("x", "observable"); assert(_x);
00090   RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00091   // Config pdf params
00092   _mean=createAbsReal("mean", "#mu", (x->getMin()+x->getMax())/2,
00093                       x->getMin(), x->getMax(), _x->getUnit());
00094   if ("notSet"!=readConfStr("shift", "notSet", getVarSec())) { // use shift
00095     _shift=createAbsReal("shift", "d#mu", 0.);
00096     _mean=(RooAbsReal*)
00097       createAbsVar(Form("%s %s", "meanS RooFormulaVar","@0+@1 mean shift"));
00098   }
00099   _sigma=createAbsReal("sigma", "#sigma", .1, 0., 1., _x->getUnit());
00100   if ("notSet"!=readConfStr("scale", "notSet", getVarSec())) { // use scale
00101     _scale=createAbsReal("scale", "S#sigma_{C}", 1.);
00102     _sigma=(RooAbsReal*)
00103       createAbsVar(Form("%s %s","sigmaS RooFormulaVar","@0*@1 sigma scale"));
00104   }
00105   _params.Print("v");
00106   
00107   // create pdf
00108   if("BreitWigner"==_pdfType) {
00109     _thePdf=new RooBreitWigner(Form("the_%s", GetName()),
00110                                _pdfType+" "+GetTitle(), *_x, *_mean, *_sigma);
00111   } else if ("Landau"==_pdfType) {
00112     _thePdf=new RooLandau(Form("the_%s", GetName()),
00113                           _pdfType+" "+GetTitle(), *_x, *_mean, *_sigma);
00114   } else { // default
00115     _thePdf=new RooGaussian(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00116                             *_x, *_mean, *_sigma);
00117   }
00118 }

Generated on 30 Oct 2013 for RooRarFit by  doxygen 1.4.7