rarGaussModel.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: rarGaussModel.cc,v 1.6 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 Resolution Model class for RooRarFit
00014 //
00015 // BEGIN_HTML
00016 // This class provides Gaussian Resolution Model 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/RooGaussModel.hh"
00031 
00032 #include "RooRarFit/rarGaussModel.hh"
00033 
00034 ClassImp(rarGaussModel)
00035   ;
00036 
00040 rarGaussModel::rarGaussModel()
00041   : rarBasePdf(),
00042     _x(0), _mean(0), _sigma(0), _msSF(0), _meanSF(0), _sigmaSF(0)
00043 {
00044   init();
00045 }
00046 
00059 rarGaussModel::rarGaussModel(const char *configFile, const char *configSec,
00060                              const char *configStr,
00061                              rarDatasets *theDatasets, RooDataSet *theData,
00062                              const char *name, const char *title)
00063   : rarBasePdf(configFile, configSec, configStr,
00064                theDatasets, theData, name, title),
00065     _x(0), _mean(0), _sigma(0), _msSF(0), _meanSF(0), _sigmaSF(0)
00066 {
00067   init();
00068 }
00069 
00070 rarGaussModel::~rarGaussModel()
00071 {
00072 }
00073 
00079 void rarGaussModel::init()
00080 {
00081   cout<<"init of rarGaussModel for "<<GetName()<<":"<<endl;
00082   
00083   // first get its dependent/observable
00084   _x=(RooRealVar*)createAbsReal("x", "observable"); assert(_x);
00085   RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00086   // make sure theDep is not derived
00087   if (_x!=x) {
00088     cout <<"No derived dependent allowed in rarGaussModel"<<endl;
00089     exit(-1);
00090   }
00091   // Config pdf params
00092   _mean=createAbsReal("mean", "#mu", (x->getMin()+x->getMax())/2,
00093                       x->getMin(), x->getMax(), _x->getUnit());
00094   _sigma=createAbsReal("sigma", "#sigma", .1, 0., 1., _x->getUnit());
00095   // param Level
00096   Int_t paramLevel(0);
00097   TString msSFStr=readConfStr("msSF", "notSet", getVarSec());
00098   TString meanSFStr=readConfStr("meanSF", "notSet", getVarSec());
00099   TString sigmaSFStr=readConfStr("sigmaSF", "notSet", getVarSec());
00100   if("notSet"!=msSFStr) { // level 1
00101     paramLevel=1;
00102     _msSF=createAbsReal("msSF", "SF_{#mu#sigma}", 1.);
00103   } else if (("notSet"!=meanSFStr) && ("notSet"!=sigmaSFStr)) { // level 2
00104     paramLevel=2;
00105     _meanSF=createAbsReal("meanSF", "SF_{#mu}", 1.);
00106     _sigmaSF=createAbsReal("sigmaSF", "SF_{#sigma}", 1.);
00107   }
00108   _params.Print("v");
00109   
00110   // create pdf
00111   if (1==paramLevel) {
00112     _thePdf=new RooGaussModel(Form("the_%s",GetName()),_pdfType+" "+GetTitle(),
00113                               *_x, *_mean, *_sigma, *_msSF);
00114   } else if (2==paramLevel) {
00115     _thePdf=new RooGaussModel(Form("the_%s",GetName()),_pdfType+" "+GetTitle(),
00116                               *_x, *_mean, *_sigma, *_meanSF, *_sigmaSF);
00117   } else { //default level 0
00118     _thePdf=new RooGaussModel(Form("the_%s",GetName()),_pdfType+" "+GetTitle(),
00119                               *_x, *_mean, *_sigma);
00120   }
00121   // FlatScaleFactorIntegral?
00122   Bool_t FSFIntegral(kTRUE);
00123   if ("no"==readConfStr("FlatScaleFactorIntegral", "yes", getVarSec()))
00124     FSFIntegral=kFALSE;
00125   ((RooGaussModel*)_thePdf)->advertiseFlatScaleFactorIntegral(FSFIntegral);
00126   
00127 }

Generated on 30 Oct 2013 for RooRarFit by  doxygen 1.4.7