00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015
00016
00017
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
00089 _x=createAbsReal("x", "observable"); assert(_x);
00090 RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00091
00092 _mean=createAbsReal("mean", "#mu", (x->getMin()+x->getMax())/2,
00093 x->getMin(), x->getMax(), _x->getUnit());
00094 if ("notSet"!=readConfStr("shift", "notSet", getVarSec())) {
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())) {
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
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 {
00115 _thePdf=new RooGaussian(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00116 *_x, *_mean, *_sigma);
00117 }
00118 }