Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAcceptReject.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAcceptReject.h,v 1.16 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_ACCEPT_REJECT
17#define ROO_ACCEPT_REJECT
18
19#include "RooAbsNumGenerator.h"
20#include "RooPrintable.h"
21#include "RooArgSet.h"
22
23class RooAbsReal;
24class RooRealVar;
25class RooDataSet;
26class RooRealBinding;
27class RooNumGenFactory ;
28
30public:
32 // coverity[UNINIT_CTOR]
33 } ;
34 RooAcceptReject(const RooAbsReal &func, const RooArgSet &genVars, const RooNumGenConfig& config, bool verbose=false, const RooAbsReal* maxFuncVal=nullptr);
35 RooAbsNumGenerator* clone(const RooAbsReal& func, const RooArgSet& genVars, const RooArgSet& /*condVars*/,
36 const RooNumGenConfig& config, bool verbose=false, const RooAbsReal* maxFuncVal=nullptr) const override {
37 return new RooAcceptReject(func,genVars,config,verbose,maxFuncVal) ;
38 }
39
40 const RooArgSet *generateEvent(UInt_t remaining, double& resampleRatio) override;
41 double getFuncMax() override ;
42
43
44 // Advertisement of capabilities
45 bool canSampleConditional() const override { return true ; }
46 bool canSampleCategories() const override { return true ; }
47
48 std::string const& generatorName() const override;
49
50protected:
51
52 friend class RooNumGenFactory ;
53 static void registerSampler(RooNumGenFactory& fact) ;
54
55 void addEventToCache();
57
58 double _maxFuncVal, _funcSum; ///< Maximum function value found, and sum of all samples made
59 UInt_t _realSampleDim; ///< Number of real dimensions to be sampled
60 UInt_t _catSampleMult; ///< Number of discrete dimensions to be sampled
61 UInt_t _minTrials; ///< Minimum number of max.finding trials, total number of samples
62 UInt_t _totalEvents; ///< Total number of function samples
63 UInt_t _eventsUsed; ///< Accepted number of function samples
64
65 UInt_t _minTrialsArray[4]; ///< Minimum number of trials samples for 1,2,3 dimensional problems
66};
67
68#endif
Abstract base class for MC event generator implementations like RooAcceptReject and RooFoam.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
Generic Monte Carlo toy generator implement the accept/reject sampling technique on any positively va...
UInt_t _minTrialsArray[4]
Minimum number of trials samples for 1,2,3 dimensional problems.
UInt_t _minTrials
Minimum number of max.finding trials, total number of samples.
static void registerSampler(RooNumGenFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
double getFuncMax() override
const RooArgSet * nextAcceptedEvent()
Scan through events in the cache which have not been used yet, looking for the first accepted one whi...
void addEventToCache()
Add a trial event to our cache and update our estimates of the function maximum value and integral.
double _funcSum
Maximum function value found, and sum of all samples made.
bool canSampleConditional() const override
bool canSampleCategories() const override
UInt_t _realSampleDim
Number of real dimensions to be sampled.
std::string const & generatorName() const override
Return unique name of generator implementation.
RooAbsNumGenerator * clone(const RooAbsReal &func, const RooArgSet &genVars, const RooArgSet &, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) const override
UInt_t _totalEvents
Total number of function samples.
UInt_t _catSampleMult
Number of discrete dimensions to be sampled.
const RooArgSet * generateEvent(UInt_t remaining, double &resampleRatio) override
Return a pointer to a generated event.
UInt_t _eventsUsed
Accepted number of function samples.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Container class to hold unbinned data.
Definition RooDataSet.h:33
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
Factory to instantiate numeric integrators from a given function binding and a given configuration.
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