#include <rarCompBase.hh>
Inheritance diagram for rarCompBase:
Public Member Functions | |
rarCompBase () | |
Trivial ctor. | |
rarCompBase (const char *configFile, const char *configSec, const char *configStr, rarDatasets *theDatasets, RooDataSet *theData, const char *name, const char *title, Bool_t useBasePdfFit=kTRUE) | |
Default ctor. | |
virtual | ~rarCompBase () |
virtual void | setSimPdf (RooSimultaneous *simPdf) |
Set SimPdf for composite PDF. | |
virtual RooArgSet | getParams () |
Return RooRealVar ArgSet associated with composite PDF. | |
virtual void | preAction () |
Actions right after every RooRarFit Pdf is created and before any other action is taken. | |
virtual RooArgSet | getArgSet (TString paramNames, Bool_t useRead=kFALSE, RooArgSet *fullSet=0) |
Constructs ArgSet of params with given names. | |
virtual void | doPdfFit (TString pdfList="") |
Do pdfFit for given PDFs. | |
virtual void | attachDataSet (const RooAbsData &data) |
Attach dataset to the pdf. | |
virtual Bool_t | isNegativeValue () |
Check if the current value of PDF is negative. | |
virtual RooPlot * | doPdfPlot (TList &plotList, TString pdfList="") |
Do pdfPlot for given PDFs. | |
virtual RooArgSet | getCorrCoeffs () |
RooRealVar ArgSet of correlation coefficient of params associated with composite PDF. | |
virtual TList * | getPdfList () |
Return the pdfList. | |
virtual RooArgList | getPdfsWOvar (RooArgList ignoredObs) |
Get ArgList of PDFs not depending on specified observables for sPlot. | |
virtual RooAbsPdf * | getProtGen () |
Return prototype var generator for toy study. | |
Protected Member Functions | |
void | init () |
Initial function called by ctor. | |
Protected Attributes | |
Int_t | _nComp |
Number of RooRarFit Pdf components. | |
TList | _pdfList |
RooRarFit Pdf list. | |
RooArgList | _subProtGenPdfs |
subProtGenPdf ArgList | |
Private Member Functions | |
rarCompBase (const rarCompBase &) | |
ClassDef (rarCompBase, 0) |
It is the base class for composite PDFs, like AddPdf and ProdPdf. It defines common data and functions for composite PDF upon rarBasePdf.
/// Comps = <name1> <name2> ... <nameN>
Comps
defines names of all its components. Each component has its own config section, namely, comp <name1>
is configured in config section named "<name1> Config"
.rarCompBase
serves as base class for all composite classes and it is not supposed to be referred directly in the config file.
Definition at line 35 of file rarCompBase.hh.
rarCompBase::rarCompBase | ( | ) |
Trivial ctor.
Usually the objects should be created using other ctors.
Definition at line 37 of file rarCompBase.cc.
References init(), and rarBasePdf::setControlBits().
00038 : rarBasePdf(), 00039 _nComp(0) 00040 { 00041 setControlBits("UseBasePdfFit"); 00042 init(); 00043 }
rarCompBase::rarCompBase | ( | const char * | configFile, | |
const char * | configSec, | |||
const char * | configStr, | |||
rarDatasets * | theDatasets, | |||
RooDataSet * | theData, | |||
const char * | name, | |||
const char * | title, | |||
Bool_t | useBasePdfFit = kTRUE | |||
) |
Default ctor.
configFile | The config file | |
configSec | The config section | |
configStr | The config string | |
theDatasets | Available datasets | |
theData | Default dataset for this PDF | |
name | The name | |
title | The title | |
useBasePdfFit | If set, use doPdfFit of base class, otherwise, use its own doPdfFit. |
Definition at line 61 of file rarCompBase.cc.
References init(), and rarBasePdf::setControlBits().
00066 : rarBasePdf(configFile, configSec, configStr, 00067 theDatasets, theData, name, title), 00068 _nComp(0) 00069 { 00070 if (useBasePdfFit) setControlBits("UseBasePdfFit"); 00071 else setControlBits("noUseBasePdfFit"); 00072 init(); 00073 }
rarCompBase::~rarCompBase | ( | ) | [virtual] |
rarCompBase::rarCompBase | ( | const rarCompBase & | ) | [private] |
void rarCompBase::attachDataSet | ( | const RooAbsData & | data | ) | [virtual] |
Attach dataset to the pdf.
data | The dataset to be attached to the Pdf |
Reimplemented from rarBasePdf.
Definition at line 303 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::attachDataSet().
Referenced by rarMLFitter::doToyStudy().
00304 { 00305 // first call base class' 00306 rarBasePdf::attachDataSet(data); 00307 // then call its sub pdfs 00308 for (Int_t i=0; i<_nComp; i++) { 00309 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00310 thePdf->attachDataSet(data); 00311 } 00312 }
rarCompBase::ClassDef | ( | rarCompBase | , | |
0 | ||||
) | [private] |
void rarCompBase::doPdfFit | ( | TString | pdfList = "" |
) | [virtual] |
Do pdfFit for given PDFs.
pdfList | Pdfs need to do pdfFit |
Reimplemented from rarBasePdf.
Definition at line 197 of file rarCompBase.cc.
References _nComp, _pdfList, rarBasePdf::doPdfFit(), rarBasePdf::doXPdfFit(), and rarBasePdf::getControlBit().
Referenced by rarMLFitter::run().
00198 { 00199 // first for xtraPfs 00200 doXPdfFit(pdfList); 00201 00202 cout<<endl<<" In rarCompBase doPdfFit for "<<GetName()<<endl; 00203 if (!getControlBit("PdfFit")) return; 00204 if (getControlBit("UseBasePdfFit")) return rarBasePdf::doPdfFit(pdfList); 00205 // go through all its components 00206 for (Int_t i=0; i<_nComp; i++) { 00207 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00208 thePdf->doPdfFit(pdfList); 00209 } 00210 if (getControlBit("UseAlsoBasePdfFit")) return rarBasePdf::doPdfFit(pdfList); 00211 }
RooPlot * rarCompBase::doPdfPlot | ( | TList & | plotList, | |
TString | pdfList = "" | |||
) | [virtual] |
Do pdfPlot for given PDFs.
plotList | List of plots | |
pdfList | List of PDFs to be plotted |
Reimplemented from rarBasePdf.
Reimplemented in rarAdd, rarMLPdf, and rarMultPdf.
Definition at line 222 of file rarCompBase.cc.
References rarBasePdf::_afterFitSaverStr, rarBasePdf::_fObsSet, _nComp, _pdfList, rarBasePdf::_theData, rarBasePdf::_thePdf, rarBasePdf::doXPdfPlot(), rarBasePdf::getControlBit(), rarConfig::readFromStr(), rarBasePdf::setControlBits(), and rarConfig::writeToStr().
Referenced by rarMLPdf::doPdfPlot(), and rarMLFitter::run().
00223 { 00224 RooPlot *frame(0); 00225 // first for xtraPdfs 00226 frame=doXPdfPlot(plotList, pdfList); 00227 00228 cout<<endl<<" In rarCompBase doPdfPlot for "<<GetName()<<endl; 00229 00230 //if (!getControlBit("PdfFit")) return frame; 00231 if (!getControlBit("PdfPlot")) return frame; 00232 if (getControlBit("PdfPlotDone")) return frame; 00233 00234 // save obs and param 00235 string obsSaveStr, coeffParamSSaver; 00236 RooArgSet *theParams(0); 00237 if (getControlBit("UseBasePdfFit")) { 00238 writeToStr(_fObsSet, obsSaveStr); 00239 // restore the fit value for plotting 00240 theParams=_thePdf->getParameters(_theData); 00241 writeToStr(*theParams, coeffParamSSaver); 00242 readFromStr(*theParams, _afterFitSaverStr); 00243 } 00244 00245 for (Int_t i=0; i<_nComp; i++) { 00246 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00247 frame=thePdf->doPdfPlot(plotList, pdfList); 00248 } 00249 00250 // restore params and obs 00251 if (getControlBit("UseBasePdfFit")) {// restore params and obs 00252 readFromStr(*theParams, coeffParamSSaver); 00253 readFromStr(_fObsSet, obsSaveStr); 00254 } 00255 setControlBits("PdfPlotDone"); 00256 00257 return frame; 00258 }
RooArgSet rarCompBase::getArgSet | ( | TString | paramNames, | |
Bool_t | useRead = kFALSE , |
|||
RooArgSet * | fullSet = 0 | |||
) | [virtual] |
Constructs ArgSet of params with given names.
paramNames | The param names or config item name | |
useRead | To use readConfStr or not | |
fullSet | Argset to get additional args |
Reimplemented from rarBasePdf.
Definition at line 157 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::getArgSet().
Referenced by rarMLFitter::doSPlot(), rarMLFitter::doToyStudy(), rarProd::init(), rarMLFitter::init(), and rarMLFitter::run().
00159 { 00160 // first for its own (base class) 00161 RooArgSet retVal(rarBasePdf::getArgSet(paramNames, useRead, fullSet)); 00162 // then run the function in each of the comps if #useRead is set 00163 if (useRead) { 00164 for (Int_t i=0; i<_nComp; i++) { 00165 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00166 retVal.add(thePdf->getArgSet(paramNames, useRead, fullSet)); 00167 } 00168 } 00169 return retVal; 00170 }
RooArgSet rarCompBase::getCorrCoeffs | ( | ) | [virtual] |
RooRealVar ArgSet of correlation coefficient of params associated with composite PDF.
Reimplemented from rarBasePdf.
Definition at line 178 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::getCorrCoeffs().
Referenced by rarMLFitter::paramFileIO().
00179 { 00180 RooArgSet theSet(rarBasePdf::getCorrCoeffs()); 00181 // then add correlation coeffs in each of the comps 00182 for (Int_t i=0; i<_nComp; i++) { 00183 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00184 theSet.add(thePdf->getCorrCoeffs()); 00185 } 00186 return theSet; 00187 }
RooArgSet rarCompBase::getParams | ( | ) | [virtual] |
Return RooRealVar ArgSet associated with composite PDF.
It adds _params from its components onto its own _params to form ArgSet to return.
Reimplemented from rarBasePdf.
Definition at line 119 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::getParams().
Referenced by rarMLFitter::run().
00120 { 00121 RooArgSet paramSet(rarBasePdf::getParams()); 00122 // then add params in each of the comps 00123 for (Int_t i=0; i<_nComp; i++) { 00124 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00125 paramSet.add(thePdf->getParams()); 00126 } 00127 return paramSet; 00128 }
virtual TList* rarCompBase::getPdfList | ( | ) | [inline, virtual] |
Return the pdfList.
Definition at line 57 of file rarCompBase.hh.
References _pdfList.
00057 {return &_pdfList;}
RooArgList rarCompBase::getPdfsWOvar | ( | RooArgList | ignoredObs | ) | [virtual] |
Get ArgList of PDFs not depending on specified observables for sPlot.
ignoredObs | The observables to check |
Definition at line 266 of file rarCompBase.cc.
References _nComp, and _pdfList.
Referenced by rarMLFitter::doSPlot(), rarProd::getPdfWOvar(), and rarAdd::getPdfWOvar().
00267 { 00268 RooArgList thePdfs; 00269 for (Int_t i=0; i<_nComp; i++) { 00270 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00271 thePdfs.add(*thePdf->getPdfWOvar(ignoredObs)); 00272 } 00273 //thePdfs.Print("v"); 00274 //thePdfs.Print(); 00275 return thePdfs; 00276 }
RooAbsPdf * rarCompBase::getProtGen | ( | ) | [virtual] |
Return prototype var generator for toy study.
Reimplemented from rarBasePdf.
Reimplemented in rarAdd, rarMLFitter, rarMLPdf, rarProd, and rarSimPdf.
Definition at line 282 of file rarCompBase.cc.
References _nComp, _pdfList, _subProtGenPdfs, rarBasePdf::_theProtGen, rarBasePdf::protGenIsDummy(), and rarBasePdf::setControlBits().
Referenced by rarProd::getProtGen(), rarMLPdf::getProtGen(), rarMLFitter::getProtGen(), and rarAdd::getProtGen().
00283 { 00284 if (_theProtGen) return _theProtGen; 00285 if (_subProtGenPdfs.getSize()<1) { 00286 for (Int_t i=0; i<_nComp; i++) { 00287 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00288 _subProtGenPdfs.add(*thePdf->getProtGen()); 00289 } 00290 } 00291 for (Int_t i=0; i<_nComp; i++) 00292 if (!((rarBasePdf*)_pdfList.At(i))->protGenIsDummy())return _theProtGen; 00293 // if we go this far, we should have dummyPdf for all subGenPdfs 00294 setControlBits("dummySubGenPdfs"); 00295 00296 return _theProtGen; 00297 }
void rarCompBase::init | ( | ) | [protected, virtual] |
Initial function called by ctor.
init
is called by the ctor. It calls createPdfs to create all its components.
Reimplemented from rarBasePdf.
Reimplemented in rarAdd, rarMLFitter, rarMLPdf, rarMultPdf, rarProd, and rarSimPdf.
Definition at line 83 of file rarCompBase.cc.
References rarConfig::_configSec, _nComp, _pdfList, rarBasePdf::_subPdfs, rarBasePdf::addProtVars(), and rarBasePdf::createPdfs().
Referenced by rarCompBase().
00084 { 00085 cout<<"init of rarCompBase for "<<GetName()<<":"<<endl; 00086 00087 createPdfs("Comps", &_pdfList, &_subPdfs); 00088 _nComp=_pdfList.GetSize(); 00089 if (_nComp<=0) { 00090 cout<<"no components defined in RooStringVar \"Comps\" in section \"" 00091 <<_configSec<<"\""<<endl; 00092 exit(-1); 00093 } 00094 00095 // add protDataVars 00096 addProtVars(); 00097 00098 }
Bool_t rarCompBase::isNegativeValue | ( | ) | [virtual] |
Check if the current value of PDF is negative.
Reimplemented from rarBasePdf.
Definition at line 316 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::isNegativeValue().
Referenced by rarMLFitter::doToyStudy().
00317 { 00318 00319 Bool_t isNegative(kFALSE); 00320 // first call its base class' 00321 isNegative=rarBasePdf::isNegativeValue(); 00322 if (isNegative) return isNegative; 00323 // then call its sub pdfs 00324 for (Int_t i=0; i<_nComp; i++) { 00325 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00326 isNegative=thePdf->isNegativeValue(); 00327 if (isNegative) return isNegative; 00328 } 00329 return isNegative; 00330 }
void rarCompBase::preAction | ( | ) | [virtual] |
Actions right after every RooRarFit Pdf is created and before any other action is taken.
It first calls preAction of its base class, then it calls preAction of every component.
Reimplemented from rarBasePdf.
Definition at line 135 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::preAction().
Referenced by rarMLFitter::run().
00136 { 00137 cout<<" In rarCompBase preAction for "<<GetName()<<endl; 00138 // first run the function in base class 00139 rarBasePdf::preAction(); 00140 // then run the function in each of the comps 00141 for (Int_t i=0; i<_nComp; i++) { 00142 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00143 thePdf->preAction(); 00144 } 00145 }
void rarCompBase::setSimPdf | ( | RooSimultaneous * | simPdf | ) | [virtual] |
Set SimPdf for composite PDF.
simPdf | The target SimPdf to set |
simPdf
for itself and also for each its component.
Reimplemented from rarBasePdf.
Definition at line 106 of file rarCompBase.cc.
References _nComp, _pdfList, and rarBasePdf::setSimPdf().
Referenced by rarMLFitter::init().
00107 { 00108 rarBasePdf::setSimPdf(simPdf); 00109 for (Int_t i=0; i<_nComp; i++) { 00110 rarBasePdf *thePdf=(rarBasePdf*)_pdfList.At(i); 00111 thePdf->setSimPdf(simPdf); 00112 } 00113 }
Int_t rarCompBase::_nComp [protected] |
Number of RooRarFit Pdf components.
Definition at line 64 of file rarCompBase.hh.
Referenced by attachDataSet(), rarMLFitter::compGen(), doPdfFit(), doPdfPlot(), rarMLFitter::doSPlot(), rarMLFitter::doToyStudy(), getArgSet(), getCorrCoeffs(), rarProd::getDPdfWvar(), getParams(), getPdfsWOvar(), rarMLPdf::getProtGen(), getProtGen(), rarMLFitter::getSnB(), rarMLFitter::getSpecialSet(), rarMLPdf::init(), init(), rarAdd::init(), isNegativeValue(), preAction(), setSimPdf(), and rarMLFitter::setSpecialStr().
TList rarCompBase::_pdfList [protected] |
RooRarFit Pdf list.
Definition at line 65 of file rarCompBase.hh.
Referenced by attachDataSet(), doPdfFit(), doPdfPlot(), rarMLFitter::doSPlot(), rarMLFitter::doToyStudy(), getArgSet(), getCorrCoeffs(), rarProd::getDPdfWvar(), getParams(), getPdfList(), getPdfsWOvar(), getProtGen(), rarMLFitter::getSnB(), rarMLFitter::getSpecialSet(), rarProd::init(), init(), isNegativeValue(), preAction(), setSimPdf(), and rarMLFitter::setSpecialStr().
RooArgList rarCompBase::_subProtGenPdfs [protected] |
subProtGenPdf ArgList
Definition at line 66 of file rarCompBase.hh.
Referenced by rarProd::getProtGen(), rarMLPdf::getProtGen(), rarMLFitter::getProtGen(), getProtGen(), and rarAdd::getProtGen().