Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooGenericPdf.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooGenericPdf.h,v 1.20 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_GENERIC_PDF
17 #define ROO_GENERIC_PDF
18 
19 #include "RooAbsPdf.h"
20 #include "RooFormula.h"
21 #include "RooListProxy.h"
22 
23 class RooArgList ;
24 
25 class RooGenericPdf : public RooAbsPdf {
26 public:
27  // Constructors, assignment etc
28  inline RooGenericPdf(){}
29  RooGenericPdf(const char *name, const char *title, const char* formula, const RooArgList& dependents);
30  RooGenericPdf(const char *name, const char *title, const RooArgList& dependents);
31  RooGenericPdf(const RooGenericPdf& other, const char* name=0);
32  virtual TObject* clone(const char* newname) const { return new RooGenericPdf(*this,newname); }
33 
34  // I/O streaming interface (machine readable)
35  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
36  virtual void writeToStream(std::ostream& os, Bool_t compact) const ;
37 
38  // Printing interface (human readable)
39  void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const ;
40  void printMetaArgs(std::ostream& os) const ;
41 
42  // Debugging
43  void dumpFormula() { formula().dump() ; }
44 
45 protected:
46 
47  RooFormula& formula() const ;
48 
49  // Function evaluation
50  RooListProxy _actualVars ;
51  virtual Double_t evaluate() const ;
52 
53  Bool_t setFormula(const char* formula) ;
54 
55  // Post-processing of server redirection
56  virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
57 
58  virtual Bool_t isValidReal(Double_t value, Bool_t printError) const ;
59 
60  std::unique_ptr<RooFormula> _formula{nullptr}; //! Formula engine
61  TString _formExpr ; // Formula expression string
62 
63  ClassDef(RooGenericPdf,1) // Generic PDF defined by string expression and list of variables
64 };
65 
66 #endif