Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAbsGenContext.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsGenContext.h,v 1.15 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_ABS_GEN_CONTEXT
17#define ROO_ABS_GEN_CONTEXT
18
19#include "TNamed.h"
20#include "RooPrintable.h"
21#include "RooArgSet.h"
22#include "RooAbsPdf.h"
23
24class RooDataSet;
25
26class RooAbsGenContext : public TNamed, public RooPrintable {
27public:
28 RooAbsGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype= nullptr, const RooArgSet* auxProto=nullptr,
29 bool _verbose= false) ;
30
31 virtual RooDataSet *generate(double nEvents= 0, bool skipInit=false, bool extendedMode=false);
32
33 bool isValid() const {
34 // If true generator context is in a valid state
35 return _isValid;
36 }
37
38 inline void setVerbose(bool verbose= true) {
39 // Set/clear verbose messaging
40 _verbose= verbose;
41 }
42 inline bool isVerbose() const {
43 // If true verbose messaging is active
44 return _verbose;
45 }
46
47 virtual void setProtoDataOrder(Int_t* lut) ;
48
49 inline void Print(Option_t *options= nullptr) const override {
50 // Print context information on stdout
52 }
53
54 virtual void attach(const RooArgSet& params) ;
55
56 void printName(std::ostream& os) const override ;
57 void printTitle(std::ostream& os) const override ;
58 void printClassName(std::ostream& os) const override ;
59 void printArgs(std::ostream& os) const override ;
60 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override;
61
62 Int_t defaultPrintContents(Option_t* opt) const override ;
63 StyleOption defaultPrintStyle(Option_t* opt) const override ;
64
65 virtual void setExpectedData(bool) {} ;
66
67 virtual void generateEvent(RooArgSet &theEvent, Int_t remaining) = 0;
68 virtual void initGenerator(const RooArgSet &theEvent);
69
70protected:
71
72 virtual RooDataSet* createDataSet(const char* name, const char* title, const RooArgSet& obs) ;
73
74 void resampleData(double& ratio) ;
75
76 const RooDataSet *_prototype; ///< Pointer to prototype dataset
77 RooArgSet _theEvent; ///< Pointer to observable event being generated
78 bool _isValid; ///< Is context in valid state?
79 bool _verbose; ///< Verbose messaging?
80 UInt_t _expectedEvents; ///< Number of expected events from extended p.d.f
81 RooArgSet _protoVars; ///< Prototype observables
82 Int_t _nextProtoIndex; ///< Next prototype event to load according to LUT
83 RooAbsPdf::ExtendMode _extendMode ; ///< Extended mode capabilities of p.d.f.
84 std::vector<Int_t> _protoOrder ; ///< LUT with traversal order of prototype data
85 TString _normRange ; ///< Normalization range of pdf
86
87 RooDataSet* _genData ; ///<! Data being generated
88
89 ClassDefOverride(RooAbsGenContext,0) // Abstract context for generating a dataset from a PDF
90};
91
92#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition TGX11.cxx:110
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
virtual RooDataSet * createDataSet(const char *name, const char *title, const RooArgSet &obs)
Create an empty dataset to hold the events that will be generated.
std::vector< Int_t > _protoOrder
LUT with traversal order of prototype data.
RooAbsPdf::ExtendMode _extendMode
Extended mode capabilities of p.d.f.
virtual void setExpectedData(bool)
StyleOption defaultPrintStyle(Option_t *opt) const override
Define default print style.
Int_t defaultPrintContents(Option_t *opt) const override
Define default contents when printing.
void setVerbose(bool verbose=true)
virtual void attach(const RooArgSet &params)
Interface to attach given parameters to object in this context.
RooDataSet * _genData
! Data being generated
virtual RooDataSet * generate(double nEvents=0, bool skipInit=false, bool extendedMode=false)
Generate the specified number of events with nEvents>0 and and return a dataset containing the genera...
void printClassName(std::ostream &os) const override
Print class name of context.
void printName(std::ostream &os) const override
Print name of context.
virtual void initGenerator(const RooArgSet &theEvent)
Interface function to initialize context for generation for given set of observables.
RooArgSet _theEvent
Pointer to observable event being generated.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Interface for multi-line printing.
const RooDataSet * _prototype
Pointer to prototype dataset.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
TString _normRange
Normalization range of pdf.
void printArgs(std::ostream &os) const override
Print arguments of context, i.e. the observables being generated in this context.
UInt_t _expectedEvents
Number of expected events from extended p.d.f.
Int_t _nextProtoIndex
Next prototype event to load according to LUT.
RooArgSet _protoVars
Prototype observables.
void printTitle(std::ostream &os) const override
Print title of context.
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)=0
bool _verbose
Verbose messaging?
bool _isValid
Is context in valid state?
bool isValid() const
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
bool isVerbose() const
void resampleData(double &ratio)
Rescale existing output buffer with given ratio.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:57
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
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,...
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Basic string class.
Definition TString.h:139