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
00025 #include "RooFitCore/RooAbsPdf.hh"
00026 #include "RooFitCore/RooArgList.hh"
00027 #include "RooFitCore/RooDataSet.hh"
00028 #include "RooFitCore/RooFitResult.hh"
00029 #include "RooFitCore/RooProdPdf.hh"
00030 #include "RooFitCore/RooRealVar.hh"
00031 #include "RooFitCore/RooSimPdfBuilder.hh"
00032 #include "RooFitCore/RooStringVar.hh"
00033
00034 #include "RooRarFit/rarMLFitter.hh"
00035 #include "RooRarFit/rarSimPdf.hh"
00036
00037 ClassImp(rarSimPdf)
00038 ;
00039
00043 rarSimPdf::rarSimPdf()
00044 : rarCompBase(),
00045 _simBuilder(0), _simConfig(0)
00046 {
00047 init();
00048 }
00049
00063 rarSimPdf::rarSimPdf(const char *configFile, const char *configSec,
00064 const char *configStr,
00065 rarDatasets *theDatasets, RooDataSet *theData,
00066 const char *name, const char *title)
00067 : rarCompBase(configFile, configSec, configStr,
00068 theDatasets, theData, name, title, kFALSE),
00069 _simBuilder(0), _simConfig(0)
00070 {
00071 init();
00072 }
00073
00074 rarSimPdf::~rarSimPdf()
00075 {
00076 }
00077
00087 void rarSimPdf::init()
00088 {
00089
00090 if (!_theData) {
00091 cout<<" No dataset for Sim Pdf"<<endl;
00092 exit(-1);
00093 }
00094
00095 _simBuilder=new RooSimPdfBuilder(_subPdfs);
00096 _simConfig=_simBuilder->createProtoBuildConfig();
00097 _simConfig->readFromFile(_configFile, 0, getVarSec());
00098 cout<<"simPdfBuilder configs in the config file:"<<endl;
00099 _simConfig->Print("v");
00100
00101
00102 if (getFitter()->getSimBuilder()) {
00103 RooSimPdfBuilder *theFitterBuilder=getFitter()->getSimBuilder();
00104 _simBuilder->addSpecializations(theFitterBuilder->splitLeafList());
00105 }
00106
00107 _thePdf=(RooAbsPdf*)_simBuilder->buildPdf(*_simConfig, _theData, 0, kTRUE);
00108 _thePdf->SetName(Form("the_%s", GetName()));
00109
00110 setControlBits("UseAlsoBasePdfFit");
00111
00112
00113
00114
00115 cout<<"done init of rarSimPdf for "<<GetName()<<endl<<endl;
00116 }
00117
00125 RooAbsPdf *rarSimPdf::getPdfWOvar(RooArgList ignoredObs)
00126 {
00127 RooAbsPdf *thePdf=_thePdf;
00128 cout<<"This pdf can not be used in model"<<endl;
00129 exit(-1);
00130 ignoredObs.getHashTableSize() ;
00131 return thePdf;
00132 }
00133
00138 RooAbsPdf *rarSimPdf::getProtGen()
00139 {
00140 cout<<"This pdf can not be used in model"<<endl;
00141 exit(-1);
00142 return _theProtGen;
00143 }