rarTwoGauss.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: rarTwoGauss.cc,v 1.7 2011/06/16 13:18:51 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 TwoGauss Pdf class for RooRarFit
00014 //
00015 // BEGIN_HTML
00016 // This class provides TwoGauss Pdf class for RooRarFit
00017 // END_HTML
00018 //
00019 
00020 #include "RooRarFit/rarVersion.hh"
00021 
00022 #include "Riostream.h"
00023 
00024 #include "RooFitCore/RooAddPdf.hh"
00025 #include "RooFitCore/RooArgList.hh"
00026 #include "RooFitCore/RooDataSet.hh"
00027 #include "RooFitCore/RooRealVar.hh"
00028 #include "RooFitCore/RooStringVar.hh"
00029 
00030 #include "RooFitModels/RooGaussian.hh"
00031 
00032 #include "RooRarFit/rarTwoGauss.hh"
00033 
00034 ClassImp(rarTwoGauss)
00035   ;
00036 
00040 rarTwoGauss::rarTwoGauss()
00041   : rarBasePdf(),
00042     _x(0), _meanC(0), _sigmaC(0), _meanT(0), _sigmaT(0), _fracC(0),
00043     _scale(0), _shift(0)
00044 {
00045   init();
00046 }
00047 
00060 rarTwoGauss::rarTwoGauss(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), _meanC(0), _sigmaC(0), _meanT(0), _sigmaT(0), _fracC(0),
00066     _scale(0), _shift(0)
00067 {
00068   init();
00069 }
00070 
00071 rarTwoGauss::~rarTwoGauss()
00072 {
00073 }
00074 
00082 void rarTwoGauss::init()
00083 {
00084   cout<<"init of rarTwoGauss for "<<GetName()<<":"<<endl;
00085   
00086   // first get its dependent/observable
00087   _x=createAbsReal("x", "observable"); assert(_x);
00088   RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00089   // Config pdf params
00090   _meanC=createAbsReal("meanC", "#mu_{C}",
00091                        (x->getMin()+x->getMax())/2,
00092                        x->getMin(), x->getMax(), _x->getUnit());
00093   _meanT=createAbsReal("meanT", "#mu_{T}",
00094                        (x->getMin()+x->getMax())/2,
00095                        x->getMin(), x->getMax(), _x->getUnit());
00096   if ("notSet"!=readConfStr("shift", "notSet", getVarSec())) { // use shift
00097     _shift=createAbsReal("shift", "d#mu", 0.);
00098     _meanC=(RooAbsReal*)
00099       createAbsVar(Form("%s %s", "meanCS RooFormulaVar","@0+@1 meanC shift"));
00100     _meanT=(RooAbsReal*)
00101       createAbsVar(Form("%s %s", "meanTS RooFormulaVar","@0+@1 meanT shift"));
00102   }
00103   _sigmaC=createAbsReal("sigmaC", "#sigma_{C}", .1, 0., 1., _x->getUnit());
00104   if ("notSet"!=readConfStr("scale", "notSet", getVarSec())) { // use scale
00105     _scale=createAbsReal("scale", "S#sigma_{C}", 1.);
00106     _sigmaC=(RooAbsReal*)
00107       createAbsVar(Form("%s %s","sigmaCS RooFormulaVar","@0*@1 sigmaC scale"));
00108   }
00109   _sigmaT=createAbsReal("sigmaT", "#sigma_{T}", .1, 0., 1., _x->getUnit());
00110   _fracC=createAbsReal("fracC", "f_{C}", .6, 0., 1.);
00111   _params.Print("v");
00112   
00113   // create pdf
00114   RooAbsPdf *corePdf=
00115     new RooGaussian(Form("core_%s",GetName()),
00116                     Form("Core Gaussian %s", GetTitle()),
00117                     *_x, *_meanC, *_sigmaC);
00118   _subPdfs.add(*corePdf);
00119   RooAbsPdf *tailPdf=
00120     new RooGaussian(Form("tail_%s",GetName()),
00121                     Form("Tail Gaussian %s", GetTitle()),
00122                     *_x, *_meanT, *_sigmaT);
00123   _subPdfs.add(*tailPdf);
00124   _thePdf=new RooAddPdf(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00125                         *corePdf, *tailPdf, *_fracC);
00126   // by default do comp plot
00127   setControlBit("CompsOnPlot", "compsOnPlot");
00128 }

Generated on 30 Oct 2013 for RooRarFit by  doxygen 1.4.7