Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooGenContext.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooGenContext.h,v 1.19 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_GEN_CONTEXT
17#define ROO_GEN_CONTEXT
18
19#include "RooAbsGenContext.h"
20#include "RooArgSet.h"
21
22class RooAbsPdf;
23class RooDataSet;
24class RooAcceptReject;
25class TRandom;
26class RooRealVar ;
28
30public:
31 RooGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype= nullptr,
32 const RooArgSet* auxProto=nullptr, bool verbose=false, const RooArgSet* forceDirect=nullptr);
33 ~RooGenContext() override;
34
35 void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override ;
36
37 void attach(const RooArgSet& params) override ;
38
39protected:
40
41 void initGenerator(const RooArgSet &theEvent) override;
42 void generateEvent(RooArgSet &theEvent, Int_t remaining) override;
43
44 RooArgSet _cloneSet; ///< Clone of all nodes of input p.d.f
45 RooAbsPdf *_pdfClone = nullptr; ///< Clone of input p.d.f
46 RooArgSet _directVars,_uniformVars,_otherVars; ///< List of observables generated internally, randomly, and by accept/reject sampling
47 Int_t _code; ///< Internal generation code
48 double _maxProb{0.}, _area{0.}, _norm{0.}; ///< Maximum probability, p.d.f area and normalization
49 std::unique_ptr<RooAbsReal> _acceptRejectFunc; ///< Projection function to be passed to accept/reject sampler
50 std::unique_ptr<RooAbsNumGenerator> _generator; ///< MC sampling generation engine
51 std::unique_ptr<RooRealVar> _maxVar; ///< Variable holding maximum value of p.d.f
52 Int_t _updateFMaxPerEvent ; ///< If true, maximum p.d.f value needs to be recalculated for each event
53
54 ClassDefOverride(RooGenContext,0) // Universal context for generating toy MC data from any p.d.f
55};
56
57#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
static void indent(ostringstream &buf, int indent_level)
Abstract base class for generator contexts of RooAbsPdf objects.
Abstract base class for MC event generator implementations like RooAcceptReject and RooFoam.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Generic Monte Carlo toy generator implement the accept/reject sampling technique on any positively va...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Container class to hold unbinned data.
Definition RooDataSet.h:34
Implements a universal generator context for all RooAbsPdf classes that do not have or need a special...
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Printing interface.
void generateEvent(RooArgSet &theEvent, Int_t remaining) override
Generate one event.
RooArgSet _otherVars
List of observables generated internally, randomly, and by accept/reject sampling.
Int_t _code
Internal generation code.
RooArgSet _uniformVars
void initGenerator(const RooArgSet &theEvent) override
Perform one-time initialization of the generator context.
~RooGenContext() override
std::unique_ptr< RooAbsNumGenerator > _generator
MC sampling generation engine.
RooArgSet _directVars
RooAbsPdf * _pdfClone
Clone of input p.d.f.
RooArgSet _cloneSet
Clone of all nodes of input p.d.f.
Int_t _updateFMaxPerEvent
If true, maximum p.d.f value needs to be recalculated for each event.
double _norm
Maximum probability, p.d.f area and normalization.
std::unique_ptr< RooRealVar > _maxVar
Variable holding maximum value of p.d.f.
std::unique_ptr< RooAbsReal > _acceptRejectFunc
Projection function to be passed to accept/reject sampler.
void attach(const RooArgSet &params) override
Attach the cloned model to the event buffer we will be filling.
Variable that can be changed from the outside.
Definition RooRealVar.h:37
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
Basic string class.
Definition TString.h:139