Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "RooListProxy.h"
21
22class RooArgList ;
23class RooFormula ;
24
25class RooGenericPdf : public RooAbsPdf {
26public:
27 // Constructors, assignment etc
29 ~RooGenericPdf() override;
30 RooGenericPdf(const char *name, const char *title, const char* formula, const RooArgList& dependents);
31 RooGenericPdf(const char *name, const char *title, const RooArgList& dependents);
32 RooGenericPdf(const RooGenericPdf& other, const char* name=nullptr);
33 TObject* clone(const char* newname) const override { return new RooGenericPdf(*this,newname); }
34
35 // I/O streaming interface (machine readable)
36 bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
37 void writeToStream(std::ostream& os, bool compact) const override ;
38
39 /// Return pointer to parameter with given name.
40 inline RooAbsArg* getParameter(const char* name) const {
41 return _actualVars.find(name) ;
42 }
43 /// Return pointer to parameter at given index.
45 return _actualVars.at(index) ;
46 }
47 /// Return the number of parameters.
48 inline size_t nParameters() const {
49 return _actualVars.size();
50 }
51
52 // Printing interface (human readable)
53 void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent="") const override ;
54 void printMetaArgs(std::ostream& os) const override ;
55
56 // Debugging
57 void dumpFormula();
58
59 const char* expression() const { return _formExpr.Data(); }
60 const RooArgList& dependents() const { return _actualVars; }
61
62protected:
63
64 RooFormula& formula() const ;
65
66 // Function evaluation
68 double evaluate() const override ;
69 void doEval(RooFit::EvalContext &) const override;
70 void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
71
72 // Post-processing of server redirection
73 bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ;
74
75 bool isValidReal(double /*value*/, bool /*printError*/) const override { return true; }
76
77 mutable RooFormula * _formula = nullptr; ///<! Formula engine
78 TString _formExpr ; ///< Formula expression string
79
80 ClassDefOverride(RooGenericPdf,1) // Generic PDF defined by string expression and list of variables
81};
82
83#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
Abstract container object that can hold multiple RooAbsArg objects.
Storage_t::size_type size() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition RooArgList.h:110
A class to maintain the context for squashing of RooFit models into code.
Internally uses ROOT's TFormula to compute user-defined expressions of RooAbsArgs.
Definition RooFormula.h:27
Implementation of a probability density function that takes a RooArgList of servers and a C++ express...
double evaluate() const override
Calculate current value of this object.
~RooGenericPdf() override
const char * expression() const
RooAbsArg * getParameter(Int_t index) const
Return pointer to parameter at given index.
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
const RooArgList & dependents() const
void printMetaArgs(std::ostream &os) const override
Add formula expression as meta argument in printing interface.
RooListProxy _actualVars
bool isValidReal(double, bool) const override
Interface function to check if given value is a valid value for this object. Returns true unless over...
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to given stream.
RooAbsArg * getParameter(const char *name) const
Return pointer to parameter with given name.
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
RooFormula * _formula
! Formula engine
size_t nParameters() const
Return the number of parameters.
RooFormula & formula() const
TString _formExpr
Formula expression string.
void doEval(RooFit::EvalContext &) const override
Base function for computing multiple values of a RooAbsReal.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print info about this object to the specified stream.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override
Propagate server changes to embedded formula object.
TObject * clone(const char *newname) const override
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376