#include <rarDatasetDef.hh>
Inheritance diagram for rarDatasetDef:
Public Member Functions | |
rarDatasetDef () | |
Trivial ctor. | |
rarDatasetDef (const char *configFile, const char *configSec) | |
Default ctor. | |
virtual | ~rarDatasetDef () |
virtual RooArgSet * | getPrimaryObs () |
Return primary observables in dataset files. | |
virtual RooArgSet * | getAddOnCols () |
Return addon columns for datasets. | |
virtual RooArgList * | getFormulaArgs (rarStrParser fStrParser) |
Get RooFormulaVar ArgList. | |
virtual void | setVal (TString var, Double_t val) |
Set value for var. | |
virtual void | setVal (TString var, Int_t val) |
virtual void | setVal (TString var, TString val) |
Set value for var. | |
Protected Member Functions | |
void | init () |
Initial function called by ctor. | |
Protected Attributes | |
RooArgSet * | _primaryObs |
Primary obs in dataset file. | |
RooArgSet * | _addonCols |
Addon columns for dataset. | |
Private Member Functions | |
rarDatasetDef (const rarDatasetDef &) | |
ClassDef (rarDatasetDef, 0) |
This class defines the dataset structure for the fitter.
/// Fields = <field01> <field02> ... <fieldN> /// <field01> = <field01> <varType> ... /// <field02> = <field02> <varType> ... /// ... /// <fieldN> = <fieldN> <varType> ... /// /// AddOns = <addon01> ... <addonM> /// <addon01> = <addon01> <derivedVarType> ... /// ... /// <addonM> = <addonM> <derivedVarType> ...
Fields
is a string containing all the names of the variables in data files. The order of the variables should be the same as in the ascii data file. <varType>
can be RooRealVar
, RooCategory
, or RooStringVar
. Optional AddOns
specifies derived columns for a dataset after it is read in from data file. <addon01>
,
..., <addonM>
must be derived from other variables declared in Fields
. Because all these variables declared here are globally accessible, they should have unique and meaningful names, and it is advisable to have their full names explicitly specified in the config items.
Definition at line 47 of file rarDatasetDef.hh.
rarDatasetDef::rarDatasetDef | ( | ) |
Trivial ctor.
Usually the objects should be created using other ctors.
Definition at line 38 of file rarDatasetDef.cc.
References init().
00039 : rarConfig(), 00040 _primaryObs(0), _addonCols(0) 00041 { 00042 init(); 00043 }
rarDatasetDef::rarDatasetDef | ( | const char * | configFile, | |
const char * | configSec | |||
) |
Default ctor.
configFile | The config file | |
configSec | The config section |
Definition at line 54 of file rarDatasetDef.cc.
References init().
00055 : rarConfig(configFile, configSec, "null", "DatasetDef", "Dataset Def"), 00056 _primaryObs(0), _addonCols(0) 00057 { 00058 init(); 00059 }
rarDatasetDef::~rarDatasetDef | ( | ) | [virtual] |
rarDatasetDef::rarDatasetDef | ( | const rarDatasetDef & | ) | [private] |
rarDatasetDef::ClassDef | ( | rarDatasetDef | , | |
0 | ||||
) | [private] |
virtual RooArgSet* rarDatasetDef::getAddOnCols | ( | ) | [inline, virtual] |
Return addon columns for datasets.
Reimplemented from rarConfig.
Definition at line 60 of file rarDatasetDef.hh.
References _addonCols.
Referenced by rarDatasets::getAddOnCols().
00060 {return _addonCols;}
RooArgList * rarDatasetDef::getFormulaArgs | ( | rarStrParser | fStrParser | ) | [virtual] |
Get RooFormulaVar ArgList.
fStrParser | The parsed tokens of formula Args |
fStrParser
. It checks if the token in fStrParser
is in _fullObs, if not, it creats one by calling createAbsReal, and finally, it adds the var into the ArgList. It repeats until all the tokens are scanned.
Reimplemented from rarConfig.
Definition at line 111 of file rarDatasetDef.cc.
References rarConfig::createAbsReal(), rarConfig::isNumber(), and rarStrParser::nArgs().
00112 { 00113 RooArgList *depList=new RooArgList; 00114 Int_t nArgs=fStrParser.nArgs(); 00115 if (nArgs<=0) return depList; 00116 for (Int_t i=0; i<nArgs; i++) { 00117 if (isNumber(fStrParser[i])) break; 00118 RooAbsArg *theDep=createAbsReal(fStrParser[i], fStrParser[i]); // create it 00119 depList->add(*theDep); 00120 } 00121 00122 return depList; 00123 }
virtual RooArgSet* rarDatasetDef::getPrimaryObs | ( | ) | [inline, virtual] |
Return primary observables in dataset files.
Reimplemented from rarConfig.
Definition at line 56 of file rarDatasetDef.hh.
References _primaryObs.
Referenced by rarDatasets::getPrimaryObs().
00056 {return _primaryObs;}
void rarDatasetDef::init | ( | ) | [protected, virtual] |
Initial function called by ctor.
init
is called by the ctor. It first reads in the info of fields, and it prints out the fields configured int the config section, then it creates those field variables by calling createAbsVar and adds them to the field list, _fullObs, as final observables.
Reimplemented from rarConfig.
Definition at line 73 of file rarDatasetDef.cc.
References _addonCols, rarConfig::_configSec, rarConfig::_createFundamental, rarConfig::_fullNameSchema, rarConfig::_fullObs, _primaryObs, and rarConfig::createAbsVars().
Referenced by rarDatasetDef().
00074 { 00075 cout<<"init of rarDatasetDef:"<<endl; 00076 // first set #_createFundamental and #_fullNameSchema 00077 _createFundamental=kTRUE; 00078 _fullNameSchema="self"; 00079 00080 // create the full, primary, and addon obs sets. 00081 _fullObs=new RooArgSet("theFullObs"); 00082 _primaryObs=new RooArgSet("thePrimaryObs"); 00083 _addonCols=new RooArgSet("theAddOnCols"); 00084 00085 // read in field info 00086 createAbsVars("Fields", _fullObs, _primaryObs); 00087 // check number of fields 00088 Int_t nField=_primaryObs->getSize(); 00089 if (nField<=0) { 00090 cout<<"no fields defined in RooStringVar \"Fields\" in section \"" 00091 <<_configSec<<"\""<<endl; 00092 exit(-1); 00093 } 00094 // now for addon cols 00095 createAbsVars("AddOns", _fullObs, _addonCols); 00096 // print cout full obs 00097 _fullObs->Print("v"); 00098 cout<<endl; 00099 }
void rarDatasetDef::setVal | ( | TString | var, | |
TString | val | |||
) | [virtual] |
Set value for var.
var | Name of var | |
val | Value to set |
Definition at line 166 of file rarDatasetDef.cc.
References _primaryObs.
00167 { 00168 RooAbsArg *theArg=_primaryObs->find(var); 00169 { // RooStringVar 00170 RooStringVar *theVar=dynamic_cast<RooStringVar*>(theArg); 00171 if (theVar) { 00172 theVar->setVal(val); 00173 return; 00174 } 00175 } 00176 { // RooCategory 00177 RooCategory *theVar=dynamic_cast<RooCategory*>(theArg); 00178 if (theVar) { 00179 theVar->setLabel(val); 00180 return; 00181 } 00182 } 00183 00184 static Int_t counter(0); 00185 counter++; 00186 if (counter<100) 00187 cout<<"Can not find "<<var<<endl; 00188 }
virtual void rarDatasetDef::setVal | ( | TString | var, | |
Int_t | val | |||
) | [inline, virtual] |
Definition at line 65 of file rarDatasetDef.hh.
References setVal().
00065 { setVal(var, (Double_t)val);}
void rarDatasetDef::setVal | ( | TString | var, | |
Double_t | val | |||
) | [virtual] |
Set value for var.
var | Name of var | |
val | Value to set |
Definition at line 130 of file rarDatasetDef.cc.
References _primaryObs.
Referenced by setVal().
00131 { 00132 RooAbsArg *theArg=_primaryObs->find(var); 00133 { // RooRealVar 00134 RooRealVar *theVar=dynamic_cast<RooRealVar*>(theArg); 00135 if (theVar) { 00136 theVar->setVal(val); 00137 return; 00138 } 00139 } 00140 { // RooCategory 00141 RooCategory *theVar=dynamic_cast<RooCategory*>(theArg); 00142 if (theVar) { 00143 theVar->setIndex((Int_t)val); 00144 return; 00145 } 00146 } 00147 { // RooStringVar 00148 RooStringVar *theVar=dynamic_cast<RooStringVar*>(theArg); 00149 if (theVar) { 00150 theVar->setVal(Form("%8x", (UInt_t) val)); 00151 return; 00152 } 00153 } 00154 00155 static Int_t counter(0); 00156 counter++; 00157 if (counter<100) 00158 cout<<"Can not find "<<var<<endl; 00159 }
RooArgSet* rarDatasetDef::_addonCols [protected] |
Addon columns for dataset.
Definition at line 72 of file rarDatasetDef.hh.
Referenced by getAddOnCols(), and init().
RooArgSet* rarDatasetDef::_primaryObs [protected] |
Primary obs in dataset file.
Definition at line 71 of file rarDatasetDef.hh.
Referenced by getPrimaryObs(), init(), and setVal().