rarStep Class Reference

RooParametricStepFunction PDF builder. More...

#include <rarStep.hh>

Inheritance diagram for rarStep:

rarBasePdf rarConfig List of all members.

Public Member Functions

 rarStep ()
 Trivial ctor.
 rarStep (const char *configFile, const char *configSec, const char *configStr, rarDatasets *theDatasets, RooDataSet *theData, const char *name, const char *title)
 Default ctor.
virtual ~rarStep ()

Protected Member Functions

void init ()
 Initial function called by ctor.

Protected Attributes

RooAbsReal * _x
 Default obs.
Int_t _nBins
 Number of bins.
TArrayD * _limits
 Limits of those bins.

Private Member Functions

 rarStep (const rarStep &)
 ClassDef (rarStep, 0)

Detailed Description

RooParametricStepFunction PDF builder.

Build RooParametricStepFunction Pdf.

Config Directives:
/// configStr = Step ["<Optional Title>"]
/// x = AbsReal Def
/// nBins = <binVal>
/// limits = <<binVal>+1 points>
/// H00 = AbsReal Def
/// ...
/// H<binVal-1> = AbsReal Def
x is the default observable. nBins is the number of bins of the step function. limits is a set of <binVal>+1 Double_t's setting the bounds of those bins. H00 ... H<binVal-1> are <binVal>-1 free parameters of the step function. All the AbsReal variables can be RooRealVar or RooFormulaVar.

Definition at line 41 of file rarStep.hh.


Constructor & Destructor Documentation

rarStep::rarStep (  ) 

Trivial ctor.

Usually the objects should be created using other ctors.

Definition at line 40 of file rarStep.cc.

References init().

00041   : rarBasePdf(),
00042     _x(0), _nBins(0), _limits(0)
00043 {
00044   init();
00045 }

rarStep::rarStep ( 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 59 of file rarStep.cc.

References init().

00062   : rarBasePdf(configFile, configSec, configStr,
00063                theDatasets, theData, name, title),
00064     _x(0), _nBins(0), _limits(0)
00065 {
00066   init();
00067 }

rarStep::~rarStep (  )  [virtual]

Definition at line 69 of file rarStep.cc.

00070 {
00071 }

rarStep::rarStep ( const rarStep  )  [private]


Member Function Documentation

rarStep::ClassDef ( rarStep  ,
 
) [private]

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

Initial function called by ctor.

init is called by the ctor. It first reads in _nBins and _limits info from its param config section, and creates H00 ... H<nBins-1> parameters by calling createAbsReal, and finally it builds RooParametricStepFunction PDF.

Reimplemented from rarBasePdf.

Definition at line 80 of file rarStep.cc.

References rarBasePdf::_coeffs, _limits, _nBins, rarBasePdf::_obsSet, rarBasePdf::_params, rarBasePdf::_pdfType, rarBasePdf::_thePdf, _x, rarConfig::createAbsReal(), rarBasePdf::getVarSec(), rarStrParser::nArgs(), and rarConfig::readConfStr().

Referenced by rarStep().

00081 {
00082   cout<<"init of rarStep for "<<GetName()<<":"<<endl;
00083   
00084   // first get its dependent/observable
00085   _x=createAbsReal("x", "observable"); assert(_x);
00086   RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00087   // Config pdf params
00088   _nBins=atoi(readConfStr("nBins", "0", getVarSec()));
00089   if (_nBins<=0) _nBins= // from plotBins
00090     atoi(readConfStr(Form("plotBins_%s", x->GetName()),"0", getVarSec()));
00091   if (_nBins<=0) _nBins=x->getBins(); // get bins from its obs
00092   _limits= new TArrayD(_nBins+1);
00093   // read in limit info
00094   TString limitStr=readConfStr("limits", "", getVarSec());
00095   rarStrParser limitStrParser=limitStr;
00096   Int_t nLimits=limitStrParser.nArgs();
00097   if (_nBins+1==nLimits) {
00098     for (Int_t i=0; i<_nBins+1; i++) {
00099       (*_limits)[i]=atof(limitStrParser[i]);
00100     }
00101   } else { // set equal interval
00102     Double_t step=(x->getMax() - x->getMin())/_nBins;
00103     for (Int_t i=0; i<_nBins+1; i++) {
00104       (*_limits)[i]=x->getMin()+i*step;
00105     }
00106   }
00107   // set lo and hi limits
00108   //(*_limits)[0]=x->getMin();
00109   //(*_limits)[_nBins]=x->getMax();
00110   // read in coeffs
00111   for (Int_t i=0; i<_nBins-1; i++) {
00112     RooAbsReal *H=createAbsReal(Form("H%02d",i),Form("h_{%d}", i),.1,0,1000);
00113     _coeffs.add(*H);
00114   }
00115   _params.Print("v");
00116   
00117   // create pdf
00118   _thePdf=
00119     new RooParametricStepFunction(Form("the_%s", GetName()),
00120                                   _pdfType+" "+GetTitle(),
00121                                   *_x, _coeffs, *_limits, _nBins);
00122 }


Member Data Documentation

TArrayD* rarStep::_limits [protected]

Limits of those bins.

Definition at line 55 of file rarStep.hh.

Referenced by init().

Int_t rarStep::_nBins [protected]

Number of bins.

Definition at line 54 of file rarStep.hh.

Referenced by init().

RooAbsReal* rarStep::_x [protected]

Default obs.

Definition at line 53 of file rarStep.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