Logo ROOT  
Reference Guide
RooAbsNumGenerator.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id$
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_ABS_NUM_GENERATOR
17#define ROO_ABS_NUM_GENERATOR
18
19#include "TNamed.h"
20#include "RooPrintable.h"
21#include "RooArgSet.h"
22#include "RooArgList.h"
23
24class RooAbsReal;
25class RooRealVar;
26class RooDataSet;
27class RooRealBinding;
28class RooNumGenConfig ;
29
30class RooAbsNumGenerator : public TNamed, public RooPrintable {
31public:
32 RooAbsNumGenerator() : _cloneSet(nullptr), _funcClone(nullptr), _funcMaxVal(nullptr), _verbose(false), _isValid(false), _funcValStore(nullptr), _funcValPtr(nullptr), _cache(nullptr) {}
33 RooAbsNumGenerator(const RooAbsReal &func, const RooArgSet &genVars, bool verbose=false, const RooAbsReal* maxFuncVal=nullptr);
34 virtual RooAbsNumGenerator* clone(const RooAbsReal&, const RooArgSet& genVars, const RooArgSet& condVars,
35 const RooNumGenConfig& config, bool verbose=false, const RooAbsReal* maxFuncVal=nullptr) const = 0 ;
36
37 bool isValid() const {
38 // If true, generator is in a valid state
39 return _isValid;
40 }
41 ~RooAbsNumGenerator() override;
42
43 inline void setVerbose(bool verbose= true) {
44 // If flag is true, verbose messaging will be active during generation
46 }
47 inline bool isVerbose() const {
48 // Return status of verbose messaging flag
49 return _verbose;
50 }
51
52 virtual const RooArgSet *generateEvent(UInt_t remaining, double& resampleRatio) = 0;
53 virtual double getFuncMax() { return 0 ; }
54
55 inline void Print(Option_t *options= nullptr) const override {
56 // ascii printing interface
58 }
59
60 void printName(std::ostream& os) const override ;
61 void printTitle(std::ostream& os) const override ;
62 void printClassName(std::ostream& os) const override ;
63 void printArgs(std::ostream& os) const override ;
64
65 void attachParameters(const RooArgSet& vars) ;
66
67 // Advertisement of capabilities
68 virtual bool canSampleCategories() const { return false ; }
69 virtual bool canSampleConditional() const { return false ; } // Must implement getFuncMax()
70
71protected:
72
73 RooArgSet *_cloneSet; ///< Set owning clone of input function
74 RooAbsReal *_funcClone; ///< Pointer to top level node of cloned function
75 const RooAbsReal *_funcMaxVal ; ///< Container for maximum function value
76 RooArgSet _catVars,_realVars ; ///< Sets of discrete and real valued observabeles
77 bool _verbose, _isValid; ///< Verbose and valid flag
78 RooRealVar *_funcValStore,*_funcValPtr; ///< RRVs storing function value in context and in output dataset
79
80 RooDataSet *_cache; ///< Dataset holding generared values of observables
81
82 ClassDefOverride(RooAbsNumGenerator,0) // Abstract base class for numeric event generator algorithms
83};
84
85#endif
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Class RooAbsNumGenerator is the abstract base class for MC event generator implementations like RooAc...
void printName(std::ostream &os) const override
Print name of the generator.
RooArgSet _realVars
Sets of discrete and real valued observabeles.
RooDataSet * _cache
Dataset holding generared values of observables.
bool _isValid
Verbose and valid flag.
const RooAbsReal * _funcMaxVal
Container for maximum function value.
void Print(Option_t *options=nullptr) const override
Print TNamed name and title.
RooRealVar * _funcValPtr
RRVs storing function value in context and in output dataset.
virtual double getFuncMax()
virtual bool canSampleCategories() const
~RooAbsNumGenerator() override
Destructor.
RooAbsReal * _funcClone
Pointer to top level node of cloned function.
void setVerbose(bool verbose=true)
RooArgSet * _cloneSet
Set owning clone of input function.
virtual bool canSampleConditional() const
void attachParameters(const RooArgSet &vars)
Reattach original parameters to function clone.
void printTitle(std::ostream &os) const override
Print the title of the generator.
void printArgs(std::ostream &os) const override
Print the arguments of the generator.
virtual RooAbsNumGenerator * clone(const RooAbsReal &, const RooArgSet &genVars, const RooArgSet &condVars, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) const =0
virtual const RooArgSet * generateEvent(UInt_t remaining, double &resampleRatio)=0
void printClassName(std::ostream &os) const override
Print the class name of the generator.
RooRealVar * _funcValStore
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:55
RooNumGenConfig holds the configuration parameters of the various numeric integrators used by RooReal...
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
virtual StyleOption defaultPrintStyle(Option_t *opt) const
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
static std::ostream & defaultPrintStream(std::ostream *os=nullptr)
Return a reference to the current default stream to use in Print().
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29