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 #include "RooAbsBinning.h"
0022 
0023 #include <map>
0024 #include <memory>
0025 #include <string>
0026 
0027 class RooArgList ;
0028 class RooFormula ;
0029 class RooAbsRealLValue;
0030 
0031 class RooGenericPdf : public RooAbsPdf {
0032 public:
0033   // Constructors, assignment etc
0034   RooGenericPdf();
0035   ~RooGenericPdf() override;
0036   RooGenericPdf(const char *name, const char *title, const char* formula, const RooArgList& dependents);
0037   RooGenericPdf(const char *name, const char *title, const RooArgList& dependents);
0038   RooGenericPdf(const RooGenericPdf& other, const char* name=nullptr);
0039   TObject* clone(const char* newname=nullptr) const override { return new RooGenericPdf(*this,newname); }
0040 
0041   // I/O streaming interface (machine readable)
0042   bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
0043   void writeToStream(std::ostream& os, bool compact) const override ;
0044 
0045   /// Return pointer to parameter with given name.
0046   inline RooAbsArg* getParameter(const char* name) const {
0047     return _actualVars.find(name) ;
0048   }
0049   /// Return pointer to parameter at given index.
0050   inline RooAbsArg* getParameter(Int_t index) const {
0051     return _actualVars.at(index) ;
0052   }
0053   /// Return the number of parameters.
0054   inline size_t nParameters() const {
0055     return _actualVars.size();
0056   }
0057 
0058   // Printing interface (human readable)
0059   void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent="") const override ;
0060   void printMetaArgs(std::ostream& os) const override ;
0061 
0062   // Debugging
0063   void dumpFormula();
0064 
0065   const char* expression() const { return _formExpr.Data(); }
0066   const RooArgList& dependents() const { return _actualVars; }
0067 
0068   std::string getUniqueFuncName() const;
0069 
0070   void setBinning(const RooAbsRealLValue &obs, const RooAbsBinning &binning, bool checkFlatness = true);
0071   const RooAbsBinning *getBinning(const RooAbsRealLValue &obs) const;
0072   bool removeBinning(const RooAbsRealLValue &obs);
0073 
0074   bool isBinnedDistribution(const RooArgSet &obs) const override;
0075   std::list<double> *binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const override;
0076   std::list<double> *plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override;
0077 
0078 protected:
0079   RooFormula& formula() const ;
0080 
0081   // Function evaluation
0082   RooListProxy _actualVars ;
0083   double evaluate() const override ;
0084   void doEval(RooFit::EvalContext &) const override;
0085 
0086   // Post-processing of server redirection
0087   bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ;
0088 
0089   bool isValidReal(double /*value*/, bool /*printError*/) const override { return true; }
0090 
0091   mutable RooFormula * _formula = nullptr; ///<! Formula engine
0092   TString _formExpr ;            ///< Formula expression string
0093 
0094   std::map<int, std::unique_ptr<RooAbsBinning>> _binnings; ///< User-defined binnings, keyed by the observable's index
0095                                                            ///< in _actualVars, for a piecewise-flat distribution
0096 
0097   ClassDefOverride(RooGenericPdf, 2) // Generic PDF defined by string expression and list of variables
0098 };
0099 
0100 #endif