#ifndef ROO_FORMULA_VAR
#define ROO_FORMULA_VAR
#include "RooAbsReal.h"
#include "RooFormula.h"
#include "RooArgList.h"
#include "RooListProxy.h"
class RooArgSet ;
class RooFormulaVar : public RooAbsReal {
public:
inline RooFormulaVar() : _formula(0), _nset(0) { }
RooFormulaVar(const char *name, const char *title, const char* formula, const RooArgList& dependents);
RooFormulaVar(const char *name, const char *title, const RooArgList& dependents);
RooFormulaVar(const RooFormulaVar& other, const char* name=0);
virtual TObject* clone(const char* newname) const { return new RooFormulaVar(*this,newname); }
virtual ~RooFormulaVar();
inline Bool_t ok() const { return formula().ok() ; }
inline RooAbsArg* getParameter(const char* name) const {
return _actualVars.find(name) ;
}
inline RooAbsArg* getParameter(Int_t index) const {
return _actualVars.at(index) ;
}
virtual Bool_t readFromStream(istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
virtual void writeToStream(ostream& os, Bool_t compact) const ;
virtual void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent= "") const ;
void printMetaArgs(ostream& os) const ;
void dumpFormula() { formula().dump() ; }
virtual Double_t getVal(const RooArgSet* set=0) const ;
virtual Double_t defaultErrorLevel() const ;
protected:
virtual Double_t evaluate() const ;
RooFormula& formula() const ;
virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
virtual Bool_t isValidReal(Double_t value, Bool_t printError) const ;
RooListProxy _actualVars ;
mutable RooFormula* _formula ;
mutable RooArgSet* _nset ;
TString _formExpr ;
ClassDef(RooFormulaVar,1)
};
#endif