Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "RooArgSet.h"
20#include "RooArgList.h"
21
22class RooAbsReal;
23class RooRealVar;
24class RooDataSet;
25class RooRealBinding;
26class RooNumGenConfig ;
27
29public:
31 RooAbsNumGenerator(const RooAbsReal &func, const RooArgSet &genVars, bool verbose=false, const RooAbsReal* maxFuncVal=nullptr);
32 virtual RooAbsNumGenerator* clone(const RooAbsReal&, const RooArgSet& genVars, const RooArgSet& condVars,
33 const RooNumGenConfig& config, bool verbose=false, const RooAbsReal* maxFuncVal=nullptr) const = 0 ;
34
35 bool isValid() const {
36 // If true, generator is in a valid state
37 return _isValid;
38 }
40
41 inline void setVerbose(bool verbose= true) {
42 // If flag is true, verbose messaging will be active during generation
43 _verbose= verbose;
44 }
45 inline bool isVerbose() const {
46 // Return status of verbose messaging flag
47 return _verbose;
48 }
49
50 virtual const RooArgSet *generateEvent(UInt_t remaining, double& resampleRatio) = 0;
51 virtual double getFuncMax() { return 0 ; }
52
53 void attachParameters(const RooArgSet& vars) ;
54
55 // Advertisement of capabilities
56 virtual bool canSampleCategories() const { return false ; }
57 virtual bool canSampleConditional() const { return false ; } // Must implement getFuncMax()
58
59 /// Return unique name of generator implementation
60 virtual std::string const& generatorName() const = 0;
61
62protected:
63
64 RooArgSet _cloneSet; ///< Set owning clone of input function
65 RooAbsReal *_funcClone = nullptr; ///< Pointer to top level node of cloned function
66 const RooAbsReal *_funcMaxVal = nullptr; ///< Container for maximum function value
67 RooArgSet _catVars; ///< Set of discrete observabeles
68 RooArgSet _realVars; ///< Set of real valued observabeles
69 bool _verbose = false; ///< Verbose flag
70 bool _isValid = false; ///< Valid flag
71 std::unique_ptr<RooAbsArg> _funcValStore; ///< RRV storing function value in context
72 RooRealVar *_funcValPtr = nullptr; ///< RRV storing function value in output dataset
73 std::unique_ptr<RooDataSet> _cache; ///< Dataset holding generared values of observables
74};
75
76#endif
Abstract base class for MC event generator implementations like RooAcceptReject and RooFoam.
RooArgSet _catVars
Set of discrete observabeles.
RooArgSet _realVars
Set of real valued observabeles.
std::unique_ptr< RooAbsArg > _funcValStore
RRV storing function value in context.
bool _isValid
Valid flag.
virtual std::string const & generatorName() const =0
Return unique name of generator implementation.
const RooAbsReal * _funcMaxVal
Container for maximum function value.
RooArgSet _cloneSet
Set owning clone of input function.
virtual double getFuncMax()
virtual bool canSampleCategories() const
RooAbsReal * _funcClone
Pointer to top level node of cloned function.
void setVerbose(bool verbose=true)
bool _verbose
Verbose flag.
virtual ~RooAbsNumGenerator()
virtual bool canSampleConditional() const
RooRealVar * _funcValPtr
RRV storing function value in output dataset.
void attachParameters(const RooArgSet &vars)
Reattach original parameters to function clone.
std::unique_ptr< RooDataSet > _cache
Dataset holding generared values of observables.
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
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Container class to hold unbinned data.
Definition RooDataSet.h:57
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
Variable that can be changed from the outside.
Definition RooRealVar.h:37