rarAdd Class Reference

AddPdf/AddModel builder. More...

#include <rarAdd.hh>

Inheritance diagram for rarAdd:

rarCompBase rarBasePdf rarConfig rarMLPdf List of all members.

Public Member Functions

 rarAdd ()
 Trivial ctor.
 rarAdd (const char *configFile, const char *configSec, const char *configStr, rarDatasets *theDatasets, RooDataSet *theData, const char *name, const char *title, Bool_t useBasePdfFit=kTRUE, Bool_t buildAddPdf=kTRUE)
 Default ctor.
virtual ~rarAdd ()
virtual RooArgList getCoeffList ()
 return coeff List
virtual RooPlot * doPdfPlot (TList &plotList, TString pdfList="")
 Do pdfPlot for AddPdf (Overlay component plots).
virtual RooAbsPdf * getPdfWOvar (RooArgList ignoredObs)
 Get a PDF 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 _nCoeff
 Number of coeffs.

Private Member Functions

 rarAdd (const rarAdd &)
 ClassDef (rarAdd, 0)

Private Attributes

Bool_t _buildAddPdf
 If build addpdf within this rarAdd.

Detailed Description

AddPdf/AddModel builder.

Build composite pdfs through RooAddPdf / RooAddModel.

Config Directives:
See doc for AddPdf/AddModel configs.

Definition at line 28 of file rarAdd.hh.


Constructor & Destructor Documentation

rarAdd::rarAdd (  ) 

Trivial ctor.

Usually the objects should be created using other ctors.

Definition at line 43 of file rarAdd.cc.

References init().

00044   : rarCompBase(),
00045     _nCoeff(0)
00046 {
00047   init();
00048 }

rarAdd::rarAdd ( const char *  configFile,
const char *  configSec,
const char *  configStr,
rarDatasets theDatasets,
RooDataSet *  theData,
const char *  name,
const char *  title,
Bool_t  useBasePdfFit = kTRUE,
Bool_t  buildAddPdf = kTRUE 
)

Default ctor.

Parameters:
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.
buildAddPdf If set, the RooFit pdf will be built by rarAdd, otherwise, the pdf is supposed to be created by sub-class.
The default ctor first initializes data members, and then calls init.

Definition at line 67 of file rarAdd.cc.

References init().

00072   : rarCompBase(configFile, configSec, configStr,
00073                 theDatasets, theData, name, title, useBasePdfFit),
00074     _nCoeff(0), _buildAddPdf(buildAddPdf)
00075 {
00076   init();
00077 }

rarAdd::~rarAdd (  )  [virtual]

Definition at line 79 of file rarAdd.cc.

00080 {
00081 }

rarAdd::rarAdd ( const rarAdd  )  [private]


Member Function Documentation

rarAdd::ClassDef ( rarAdd  ,
 
) [private]

RooPlot * rarAdd::doPdfPlot ( TList &  plotList,
TString  pdfList = "" 
) [virtual]

Do pdfPlot for AddPdf (Overlay component plots).

Parameters:
plotList List of plots
pdfList List of PDFs to be plotted
Returns:
The last RooPlot created
Use rarBasePdf::doPdfPlot

Reimplemented from rarCompBase.

Reimplemented in rarMLPdf.

Definition at line 140 of file rarAdd.cc.

References rarBasePdf::doPdfPlot().

00141 {
00142   return rarBasePdf::doPdfPlot(plotList, pdfList);
00143 }

virtual RooArgList rarAdd::getCoeffList (  )  [inline, virtual]

return coeff List

Definition at line 40 of file rarAdd.hh.

References rarBasePdf::_coeffs.

00040 {return _coeffs;}

RooAbsPdf * rarAdd::getPdfWOvar ( RooArgList  ignoredObs  )  [virtual]

Get a PDF not depending on specified observables for sPlot.

Parameters:
ignoredObs The observables to check
Returns:
The Pdf required
It checks of the pdf depends on the observables. if no, it returns the default pdf; if yes, it builds the non-dependent pdf.

Reimplemented from rarBasePdf.

Definition at line 152 of file rarAdd.cc.

References rarBasePdf::_coeffs, rarConfig::_fullObs, rarBasePdf::_pdfType, rarBasePdf::_thePdf, and rarCompBase::getPdfsWOvar().

00153 {
00154   RooAbsPdf *thePdf=_thePdf;
00155   // check if thePdf depends on theVar
00156   if (!(thePdf->dependsOn(ignoredObs))) return thePdf;
00157   // create individual Pdf
00158   TString theName=Form("the_%s_%s", ignoredObs[0].GetName(), GetName());
00159   TString theTitle=Form("%s w/o %s", GetTitle(), ignoredObs[0].GetName());
00160   RooArgList myPdfList=getPdfsWOvar(ignoredObs);
00161   if ("AddModel"==_pdfType) {
00162     thePdf=new RooAddModel(theName, theTitle, myPdfList, _coeffs);
00163   } else {
00164     thePdf=new RooAddPdf(theName, theTitle, myPdfList, _coeffs);
00165   }
00166   //thePdf->Print("v");
00167   //thePdf->Print();
00168   if (!(thePdf->dependsOn(ignoredObs))) return thePdf;
00169   delete thePdf;
00170   // create a dummy for it
00171   thePdf=new RooGenericPdf(theName, theTitle, "1",
00172                            *_thePdf->getParameters(_fullObs));
00173   //thePdf->Print("v");
00174   //thePdf->Print();
00175   return thePdf;
00176 }

RooAbsPdf * rarAdd::getProtGen (  )  [virtual]

Return prototype var generator for toy study.

Returns:
The generator
It constrcuts prototype var generator for toy study

Reimplemented from rarCompBase.

Reimplemented in rarMLPdf.

Definition at line 182 of file rarAdd.cc.

References rarBasePdf::_coeffs, rarBasePdf::_myDummyPdf, rarBasePdf::_pdfType, rarBasePdf::_protGenPdfs, rarCompBase::_subProtGenPdfs, rarBasePdf::_theProtGen, rarBasePdf::getControlBit(), and rarCompBase::getProtGen().

00183 {
00184   if (_theProtGen) return _theProtGen;
00185   // call super class' getProtGen
00186   rarCompBase::getProtGen();
00187   _theProtGen=_myDummyPdf;
00188   if (!getControlBit("dummySubGenPdfs")) {
00189     if ("AddModel"==_pdfType) {
00190       _theProtGen=new RooAddModel
00191         (Form("genAdd_%s", GetName()), Form("GenAdd for %s", GetName()),
00192          _subProtGenPdfs, _coeffs);
00193     } else {
00194       _theProtGen=new RooAddPdf
00195         (Form("genAdd_%s", GetName()), Form("GenAdd for %s", GetName()),
00196          _subProtGenPdfs, _coeffs);
00197     }
00198   }
00199   if (_protGenPdfs.getSize()>0) {
00200     RooArgList pdfList(_protGenPdfs);
00201     pdfList.add(*_theProtGen);
00202     _theProtGen = new RooProdPdf
00203       (Form("protGen_%s",GetName()),Form("Prot Gen for %s",GetName()),pdfList);
00204   }
00205   
00206   return _theProtGen;
00207 }

void rarAdd::init (  )  [protected, virtual]

Initial function called by ctor.

init is called by the ctor. It first reads in the info of coeffs, and it prints out the coeffs configured in the config section, then it creates those coeffs by calling createAbsVar and adds them into the coeff list, _coeffs, and finally it builds the RooAddPdf/RooAddModel if needed.

Reimplemented from rarCompBase.

Reimplemented in rarMLPdf.

Definition at line 91 of file rarAdd.cc.

References _buildAddPdf, rarBasePdf::_coeffs, _nCoeff, rarCompBase::_nComp, rarBasePdf::_params, rarBasePdf::_pdfType, rarBasePdf::_subPdfs, rarBasePdf::_thePdf, rarConfig::createAbsVars(), rarBasePdf::getVarSec(), and rarBasePdf::setControlBit().

Referenced by rarAdd().

00092 {
00093   // create coeffs
00094   createAbsVars("Coeffs", 0, &_coeffs);
00095   _nCoeff=_coeffs.getSize();
00096   if (_nCoeff>_nComp) {
00097     cout<<"You should define at most "<<_nComp
00098         <<" coeffs in config \"Coeffs\" in section \""
00099         <<getVarSec()<<"\""<<endl;
00100     exit(-1);
00101   }
00102   if (_nCoeff<_nComp-1) {
00103     cout<<"You should define at least "<<_nComp-1
00104         <<" coeffs in config \"Coeffs\" in section \""
00105         <<getVarSec()<<"\""<<endl;
00106     exit(-1);
00107   }
00108   // make sure AddModel is non-extended
00109   if (("AddModel"==_pdfType) && (_nCoeff==_nComp)) {
00110     cout<<"You should define "<<_nComp-1
00111         <<" coeffs in config \"Coeffs\" in section \""
00112         <<getVarSec()<<"\""<<endl;
00113     exit(-1);
00114   }
00115   _params.Print("v");
00116   
00117   if (_buildAddPdf) {
00118     // build pdf function
00119     if ("AddModel"==_pdfType) {
00120       _thePdf=new RooAddModel(Form("the_%s", GetName()),
00121                               _pdfType+" "+GetTitle(), _subPdfs, _coeffs);
00122     } else {
00123       _thePdf=new RooAddPdf(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00124                             _subPdfs, _coeffs);
00125     }
00126   }
00127   // by default do comp plot
00128   setControlBit("CompsOnPlot", "compsOnPlot");
00129   
00130   cout<<"done init of rarAdd for "<<GetName()<<endl<<endl;
00131 }


Member Data Documentation

Bool_t rarAdd::_buildAddPdf [private]

If build addpdf within this rarAdd.

Definition at line 51 of file rarAdd.hh.

Referenced by init().

Int_t rarAdd::_nCoeff [protected]

Number of coeffs.

Definition at line 48 of file rarAdd.hh.

Referenced by rarMLPdf::init(), and init().


The documentation for this class was generated from the following files:
Generated on 30 Oct 2013 for RooRarFit by  doxygen 1.4.7