rarKeys Class Reference

1/2D Keys PDF builder More...

#include <rarKeys.hh>

Inheritance diagram for rarKeys:

rarBasePdf rarConfig List of all members.

Public Member Functions

 rarKeys ()
 Trivial ctor.
 rarKeys (const char *configFile, const char *configSec, const char *configStr, rarDatasets *theDatasets, RooDataSet *theData, const char *name, const char *title)
 Default ctor.
virtual ~rarKeys ()
void setFitData (RooDataSet *theData=0)
 Load Keys dataset.

Protected Member Functions

void init ()
 Initial function called by ctor.

Protected Attributes

RooAbsReal * _x
 Default obs.
RooAbsReal * _y
 Default obs.
Double_t _rho
 Width scale factor.
TString _keysOption
 Options.

Private Member Functions

 rarKeys (const rarKeys &)
 ClassDef (rarKeys, 0)

Detailed Description

1/2D Keys PDF builder

Build RooKeysPdf / Roo2DKeysPdf Pdf.

Config Directives:
/// configStr = Keys ["<Optional Title>"]
/// configStr = 2DKeys ["<Optional Title>"]
/// x = AbsReal Def
/// y = AbsReal Def
/// rho = Double_t
/// keysOption = Options
x and y are the default observables (y for 2D only). rho is width scale factor. keysOption is 1/2D Keys opitons. For 1D, the options can be any enum value of RooKeysPdf::Mirror, for 2D, the options can be any valid characters of Roo2DKeysPdf::setOptions. All the AbsReal parameters can be RooRealVar or RooFormulaVar.

Definition at line 45 of file rarKeys.hh.


Constructor & Destructor Documentation

rarKeys::rarKeys (  ) 

Trivial ctor.

Usually the objects should be created using other ctors.

Definition at line 41 of file rarKeys.cc.

References init().

00042   : rarBasePdf(),
00043     _x(0), _y(0), _rho(1.), _keysOption("")
00044 {
00045   init();
00046 }

rarKeys::rarKeys ( const char *  configFile,
const char *  configSec,
const char *  configStr,
rarDatasets theDatasets,
RooDataSet *  theData,
const char *  name,
const char *  title 
)

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
The default ctor first initializes data members, and then calls init.

Definition at line 60 of file rarKeys.cc.

References init().

00064   : rarBasePdf(configFile, configSec, configStr,
00065                theDatasets, theData, name, title),
00066     _x(0), _y(0), _rho(1.), _keysOption("")
00067 {
00068   init();
00069 }

rarKeys::~rarKeys (  )  [virtual]

Definition at line 71 of file rarKeys.cc.

00072 {
00073 }

rarKeys::rarKeys ( const rarKeys  )  [private]


Member Function Documentation

rarKeys::ClassDef ( rarKeys  ,
 
) [private]

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

Initial function called by ctor.

init is called by the ctor.

There is no need to do pdfFit, so the first step is to set _pdfFit to false. It reads in _rho and _keysOption, and finally it builds RooKeysPdf/Roo2DKeysPdf PDF with _pdfType being Keys/2DKeys, respectively.

Reimplemented from rarBasePdf.

Definition at line 84 of file rarKeys.cc.

References _keysOption, rarBasePdf::_pdfType, _rho, rarBasePdf::_theData, rarBasePdf::_thePdf, _x, _y, rarConfig::createAbsReal(), rarBasePdf::getVarSec(), rarConfig::readConfStr(), and rarBasePdf::setControlBits().

Referenced by rarKeys().

00085 {
00086   cout<<"init of rarKeys for "<<GetName()<<":"<<endl;
00087   
00088   // no need for pdf fit
00089   setControlBits("noPdfFit");
00090   
00091   // get its obs
00092   _x=createAbsReal("x", "observable"); assert(_x);
00093   if ("2DKeys"==_pdfType) {
00094     _y=createAbsReal("y", "observable"); assert(_y);
00095   }
00096   // it should always have fitData
00097   if (!_theData) {
00098     cout<<" No dataset for Keys Pdf"<<endl;
00099     exit(-1);
00100   }
00101   // read in options
00102   _rho=atof(readConfStr("rho", "1.", getVarSec()));
00103   _keysOption=readConfStr("keysOption", "", getVarSec());
00104   
00105   // create pdf
00106   if ("2DKeys"==_pdfType) {
00107     _thePdf=new Roo2DKeysPdf(Form("the_%s", GetName()),_pdfType+" "+GetTitle(),
00108                              *_x, *_y, *_theData, _keysOption, _rho);
00109   } else { // default
00110     // parse the option
00111     RooKeysPdf::Mirror mirror=RooKeysPdf::NoMirror;
00112     if ("NoMirror"==_keysOption) mirror=RooKeysPdf::NoMirror;
00113     else if ("MirrorLeft"==_keysOption) mirror=RooKeysPdf::MirrorLeft;
00114     else if ("MirrorRight"==_keysOption) mirror=RooKeysPdf::MirrorRight;
00115     else if ("MirrorBoth"==_keysOption) mirror=RooKeysPdf::MirrorBoth;
00116     else if ("MirrorAsymLeft"==_keysOption) mirror=RooKeysPdf::MirrorAsymLeft;
00117     else if ("MirrorAsymLeftRight"==_keysOption)
00118       mirror=RooKeysPdf::MirrorAsymLeftRight;
00119     else if ("MirrorAsymRight"==_keysOption)mirror=RooKeysPdf::MirrorAsymRight;
00120     else if ("MirrorLeftAsymRight"==_keysOption)
00121       mirror=RooKeysPdf::MirrorLeftAsymRight;
00122     else if ("MirrorAsymBoth"==_keysOption) mirror=RooKeysPdf::MirrorAsymBoth;
00123     else mirror=RooKeysPdf::NoMirror;
00124     _thePdf=new RooKeysPdf(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00125                            *_x, *_theData, mirror, _rho);
00126   }
00127 }

void rarKeys::setFitData ( RooDataSet *  theData = 0  )  [virtual]

Load Keys dataset.

Parameters:
theData The dataset to be loaded
Load theData as Keys dataset for pdf modeling. There is no need to do pdfFit, instead, 1/2D Keys PDFs call their LoadDataSet/loadDataSet functions to load initial values (datasets).

Reimplemented from rarBasePdf.

Definition at line 137 of file rarKeys.cc.

References _keysOption, rarBasePdf::_pdfType, rarBasePdf::_theData, rarBasePdf::_thePdf, and rarBasePdf::setFitData().

00138 {
00139   RooDataSet *oldData=_theData;
00140   // set dataset
00141   rarBasePdf::setFitData(theData);
00142   if (_theData==oldData) return;
00143   // recalculate keys pdf
00144   if ("Keys"==_pdfType) ((RooKeysPdf*)_thePdf)->LoadDataSet(*_theData);
00145   if ("2DKeys"==_pdfType)
00146     ((Roo2DKeysPdf*)_thePdf)->loadDataSet(*_theData, _keysOption);
00147 }


Member Data Documentation

TString rarKeys::_keysOption [protected]

Options.

Definition at line 62 of file rarKeys.hh.

Referenced by init(), and setFitData().

Double_t rarKeys::_rho [protected]

Width scale factor.

Definition at line 61 of file rarKeys.hh.

Referenced by init().

RooAbsReal* rarKeys::_x [protected]

Default obs.

Definition at line 59 of file rarKeys.hh.

Referenced by init().

RooAbsReal* rarKeys::_y [protected]

Default obs.

Definition at line 60 of file rarKeys.hh.

Referenced by init().


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