Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooGenericPdf.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooGenericPdf.h,v 1.20 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_GENERIC_PDF
0017 #define ROO_GENERIC_PDF
0018 
0019 #include "RooAbsPdf.h"
0020 #include "RooListProxy.h"
0021 
0022 class RooArgList ;
0023 class RooFormula ;
0024 
0025 class RooGenericPdf : public RooAbsPdf {
0026 public:
0027   // Constructors, assignment etc
0028   RooGenericPdf();
0029   ~RooGenericPdf() override;
0030   RooGenericPdf(const char *name, const char *title, const char* formula, const RooArgList& dependents);
0031   RooGenericPdf(const char *name, const char *title, const RooArgList& dependents);
0032   RooGenericPdf(const RooGenericPdf& other, const char* name=nullptr);
0033   TObject* clone(const char* newname) const override { return new RooGenericPdf(*this,newname); }
0034 
0035   // I/O streaming interface (machine readable)
0036   bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
0037   void writeToStream(std::ostream& os, bool compact) const override ;
0038 
0039   /// Return pointer to parameter with given name.
0040   inline RooAbsArg* getParameter(const char* name) const {
0041     return _actualVars.find(name) ;
0042   }
0043   /// Return pointer to parameter at given index.
0044   inline RooAbsArg* getParameter(Int_t index) const {
0045     return _actualVars.at(index) ;
0046   }
0047   /// Return the number of parameters.
0048   inline size_t nParameters() const {
0049     return _actualVars.size();
0050   }
0051 
0052   // Printing interface (human readable)
0053   void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent="") const override ;
0054   void printMetaArgs(std::ostream& os) const override ;
0055 
0056   // Debugging
0057   void dumpFormula();
0058 
0059   const char* expression() const { return _formExpr.Data(); }
0060   const RooArgList& dependents() const { return _actualVars; }
0061 
0062 protected:
0063 
0064   RooFormula& formula() const ;
0065 
0066   // Function evaluation
0067   RooListProxy _actualVars ;
0068   double evaluate() const override ;
0069   void doEval(RooFit::EvalContext &) const override;
0070   void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
0071 
0072   // Post-processing of server redirection
0073   bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ;
0074 
0075   bool isValidReal(double /*value*/, bool /*printError*/) const override { return true; }
0076 
0077   mutable RooFormula * _formula = nullptr; ///<! Formula engine
0078   TString _formExpr ;            ///< Formula expression string
0079 
0080   ClassDefOverride(RooGenericPdf,1) // Generic PDF defined by string expression and list of variables
0081 };
0082 
0083 #endif