RooFormula.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooFormula.h,v 1.34 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
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   // Constructors etc.
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   // Dependent management
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     // Return pointer to parameter with given name
00041     return (RooAbsArg*) _useList.FindObject(name) ; 
00042   }
00043   inline RooAbsArg* getParameter(Int_t index) const { 
00044     // Return pointer to parameter at given index
00045     return (RooAbsArg*) _origList.At(index) ; 
00046   }
00047 
00048   // Function value accessor
00049   inline Bool_t ok() { return _isOK ; }
00050   Double_t eval(const RooArgSet* nset=0) ;
00051 
00052   // Debugging
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     // Printing interface (human readable)
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   // Interface to TFormula engine
00075   Int_t DefinedVariable(TString &name, int& action) ; // ROOT 4
00076   Int_t DefinedVariable(TString &name) ; // ROOT 3
00077   Double_t DefinedValue(Int_t code) ;
00078 
00079   RooArgSet* _nset ;
00080   mutable Bool_t    _isOK ;     // Is internal state OK?
00081   RooLinkedList     _origList ; //! Original list of dependents
00082   RooLinkedList _useList ;      //! List of actual dependents 
00083   mutable RooArgSet _actual;    //! Set of actual dependents
00084   RooLinkedList _labelList ;    //  List of label names for category objects  
00085   mutable Bool_t    _compiled ; //  Flag set if formula is compiled
00086 
00087   ClassDef(RooFormula,1)     // TFormula derived class interfacing with RooAbsArg objects
00088 };
00089 
00090 #endif

Generated on Tue Jul 5 14:26:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1