Logo ROOT  
Reference Guide
Go to the documentation of this file.
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 *****************************************************************************/
19#include "RooAbsPdf.h"
20#include "RooFormula.h"
21#include "RooListProxy.h"
23class RooArgList ;
25class RooGenericPdf : public RooAbsPdf {
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=nullptr);
32 TObject* clone(const char* newname) const override { return new RooGenericPdf(*this,newname); }
34 // I/O streaming interface (machine readable)
35 bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
36 void writeToStream(std::ostream& os, bool compact) const override ;
38 // Printing interface (human readable)
39 void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent="") const override ;
40 void printMetaArgs(std::ostream& os) const override ;
42 // Debugging
43 void dumpFormula() { formula().dump() ; }
45 const char* expression() const { return _formExpr.Data(); }
46 const RooArgList& dependents() const { return _actualVars; }
50 RooFormula& formula() const ;
52 // Function evaluation
54 double evaluate() const override ;
55 RooSpan<double> evaluateSpan(RooBatchCompute::RunContext& inputData, const RooArgSet* normSet) const override;
56 void computeBatch(cudaStream_t*, double* output, size_t nEvents, RooFit::Detail::DataMap const&) const override;
58 bool setFormula(const char* formula) ;
60 // Post-processing of server redirection
61 bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ;
63 bool isValidReal(double value, bool printError) const override ;
65 std::unique_ptr<RooFormula> _formula{nullptr}; ///<! Formula engine
66 TString _formExpr ; ///< Formula expression string
68 ClassDefOverride(RooGenericPdf,1) // Generic PDF defined by string expression and list of variables
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
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 value
char name[80]
Definition: TGX11.cxx:110
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
RooFormula internally uses ROOT's TFormula to compute user-defined expressions of RooAbsArgs.
Definition: RooFormula.h:33
void dump() const
DEBUG: Dump state information.
Definition: RooFormula.cxx:384
RooGenericPdf is a concrete implementation of a probability density function, which takes a RooArgLis...
Definition: RooGenericPdf.h:25
double evaluate() const override
Calculate current value of this object.
RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &inputData, const RooArgSet *normSet) const override
Evaluate this formula for values found in inputData.
const char * expression() const
Definition: RooGenericPdf.h:45
bool setFormula(const char *formula)
Change formula expression to given expression.
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
const RooArgList & dependents() const
Definition: RooGenericPdf.h:46
bool isValidReal(double value, bool printError) const override
Check if given value is valid.
void printMetaArgs(std::ostream &os) const override
Add formula expression as meta argument in printing interface.
RooListProxy _actualVars
Definition: RooGenericPdf.h:53
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to given stream.
void computeBatch(cudaStream_t *, double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
std::unique_ptr< RooFormula > _formula
! Formula engine
Definition: RooGenericPdf.h:65
void dumpFormula()
Definition: RooGenericPdf.h:43
RooFormula & formula() const
TString _formExpr
Formula expression string.
Definition: RooGenericPdf.h:66
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
Definition: RooGenericPdf.h:32
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
Mother of all ROOT objects.
Definition: TObject.h:41
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:32
static void output()