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/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   
00084   _x=(RooRealVar*)createAbsReal("x", "observable"); assert(_x);
00085   RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00086   
00087   if (_x!=x) {
00088     cout <<"No derived dependent allowed in rarGaussModel"<<endl;
00089     exit(-1);
00090   }
00091   
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   
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) { 
00101     paramLevel=1;
00102     _msSF=createAbsReal("msSF", "SF_{#mu#sigma}", 1.);
00103   } else if (("notSet"!=meanSFStr) && ("notSet"!=sigmaSFStr)) { 
00104     paramLevel=2;
00105     _meanSF=createAbsReal("meanSF", "SF_{#mu}", 1.);
00106     _sigmaSF=createAbsReal("sigmaSF", "SF_{#sigma}", 1.);
00107   }
00108   _params.Print("v");
00109   
00110   
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 { 
00118     _thePdf=new RooGaussModel(Form("the_%s",GetName()),_pdfType+" "+GetTitle(),
00119                               *_x, *_mean, *_sigma);
00120   }
00121   
00122   Bool_t FSFIntegral(kTRUE);
00123   if ("no"==readConfStr("FlatScaleFactorIntegral", "yes", getVarSec()))
00124     FSFIntegral=kFALSE;
00125   ((RooGaussModel*)_thePdf)->advertiseFlatScaleFactorIntegral(FSFIntegral);
00126   
00127 }