00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROO_FORMULA
00017 #define ROO_FORMULA
00018
00019 #include "Rtypes.h"
00020 #include "TFormula.h"
00021 #include "RooAbsReal.h"
00022 #include "RooArgSet.h"
00023 #include "RooPrintable.h"
00024 #include "RooLinkedList.h"
00025
00026 class RooFormula : public TFormula, public RooPrintable {
00027 public:
00028
00029 RooFormula() ;
00030 RooFormula(const char* name, const char* formula, const RooArgList& varList);
00031 RooFormula(const RooFormula& other, const char* name=0) ;
00032 virtual TObject* Clone(const char* newName=0) const { return new RooFormula(*this,newName) ; }
00033 virtual ~RooFormula();
00034
00035
00036 RooArgSet& actualDependents() const ;
00037 Bool_t changeDependents(const RooAbsCollection& newDeps, Bool_t mustReplaceAll, Bool_t nameChange) ;
00038
00039 inline RooAbsArg* getParameter(const char* name) const {
00040
00041 return (RooAbsArg*) _useList.FindObject(name) ;
00042 }
00043 inline RooAbsArg* getParameter(Int_t index) const {
00044
00045 return (RooAbsArg*) _origList.At(index) ;
00046 }
00047
00048
00049 inline Bool_t ok() { return _isOK ; }
00050 Double_t eval(const RooArgSet* nset=0) ;
00051
00052
00053 void dump() ;
00054 Bool_t reCompile(const char* newFormula) ;
00055
00056
00057 virtual void printValue(ostream& os) const ;
00058 virtual void printName(ostream& os) const ;
00059 virtual void printTitle(ostream& os) const ;
00060 virtual void printClassName(ostream& os) const ;
00061 virtual void printArgs(ostream& os) const ;
00062 void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
00063
00064 inline virtual void Print(Option_t *options= 0) const {
00065
00066 printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00067 }
00068
00069 protected:
00070
00071 RooFormula& operator=(const RooFormula& other) ;
00072 void initCopy(const RooFormula& other) ;
00073
00074
00075 Int_t DefinedVariable(TString &name, int& action) ;
00076 Int_t DefinedVariable(TString &name) ;
00077 Double_t DefinedValue(Int_t code) ;
00078
00079 RooArgSet* _nset ;
00080 mutable Bool_t _isOK ;
00081 RooLinkedList _origList ;
00082 RooLinkedList _useList ;
00083 mutable RooArgSet _actual;
00084 RooLinkedList _labelList ;
00085 mutable Bool_t _compiled ;
00086
00087 ClassDef(RooFormula,1)
00088 };
00089
00090 #endif