Logo ROOT  
Reference Guide
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 
24 class RooDataSet;
25 
26 class RooAbsGenContext : public TNamed, public RooPrintable {
27 public:
28  RooAbsGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype= 0, const RooArgSet* auxProto=0,
30  virtual ~RooAbsGenContext();
31 
32  virtual RooDataSet *generate(Double_t nEvents= 0, Bool_t skipInit=kFALSE, Bool_t extendedMode=kFALSE);
33 
34  Bool_t isValid() const {
35  // If true generator context is in a valid state
36  return _isValid;
37  }
38 
39  inline void setVerbose(Bool_t verbose= kTRUE) {
40  // Set/clear verbose messaging
41  _verbose= verbose;
42  }
43  inline Bool_t isVerbose() const {
44  // If true verbose messaging is active
45  return _verbose;
46  }
47 
48  virtual void setProtoDataOrder(Int_t* lut) ;
49 
50  inline virtual void Print(Option_t *options= 0) const {
51  // Print context information on stdout
53  }
54 
55  virtual void attach(const RooArgSet& params) ;
56 
57  virtual void printName(std::ostream& os) const ;
58  virtual void printTitle(std::ostream& os) const ;
59  virtual void printClassName(std::ostream& os) const ;
60  virtual void printArgs(std::ostream& os) const ;
61  virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
62 
63  virtual Int_t defaultPrintContents(Option_t* opt) const ;
64  virtual StyleOption defaultPrintStyle(Option_t* opt) const ;
65 
66  virtual void setExpectedData(Bool_t) {} ;
67 
68  virtual void generateEvent(RooArgSet &theEvent, Int_t remaining) = 0;
69  virtual void initGenerator(const RooArgSet &theEvent);
70 
71 protected:
72 
73  virtual RooDataSet* createDataSet(const char* name, const char* title, const RooArgSet& obs) ;
74 
75  void resampleData(Double_t& ratio) ;
76 
77  const RooDataSet *_prototype; // Pointer to prototype dataset
78  RooArgSet *_theEvent; // Pointer to observable event being generated
79  Bool_t _isValid; // Is context in valid state?
80  Bool_t _verbose; // Verbose messaging?
81  UInt_t _expectedEvents; // Number of expected events from extended p.d.f
82  RooArgSet _protoVars; // Prototype observables
83  Int_t _nextProtoIndex; // Next prototype event to load according to LUT
84  RooAbsPdf::ExtendMode _extendMode ; // Extended mode capabilities of p.d.f.
85  Int_t* _protoOrder ; // LUT with traversal order of prototype data
86  TString _normRange ; // Normalization range of pdf
87 
88  RooDataSet* _genData ; //! Data being generated
89 
90  ClassDef(RooAbsGenContext,0) // Abstract context for generating a dataset from a PDF
91 };
92 
93 #endif
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsGenContext::printName
virtual void printName(std::ostream &os) const
Print name of context.
Definition: RooAbsGenContext.cxx:282
RooArgSet.h
RooAbsGenContext::_theEvent
RooArgSet * _theEvent
Definition: RooAbsGenContext.h:78
RooAbsGenContext::setVerbose
void setVerbose(Bool_t verbose=kTRUE)
Definition: RooAbsGenContext.h:39
RooAbsGenContext::_normRange
TString _normRange
Definition: RooAbsGenContext.h:86
TNamed.h
RooPrintable::StyleOption
StyleOption
Definition: RooPrintable.h:34
RooAbsGenContext::_isValid
Bool_t _isValid
Definition: RooAbsGenContext.h:79
RooAbsGenContext::Print
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsGenContext.h:50
RooAbsGenContext::generate
virtual RooDataSet * generate(Double_t nEvents=0, Bool_t skipInit=kFALSE, Bool_t extendedMode=kFALSE)
Generate the specified number of events with nEvents>0 and and return a dataset containing the genera...
Definition: RooAbsGenContext.cxx:152
RooPrintable.h
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsGenContext::resampleData
void resampleData(Double_t &ratio)
Rescale existing output buffer with given ratio.
Definition: RooAbsGenContext.cxx:373
RooAbsGenContext::RooAbsGenContext
RooAbsGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t _verbose=kFALSE)
Constructor.
Definition: RooAbsGenContext.cxx:53
RooAbsGenContext::_expectedEvents
UInt_t _expectedEvents
Definition: RooAbsGenContext.h:81
TString
Definition: TString.h:136
RooAbsGenContext::~RooAbsGenContext
virtual ~RooAbsGenContext()
Destructor.
Definition: RooAbsGenContext.cxx:113
RooPrintable
Definition: RooPrintable.h:25
bool
RooAbsGenContext::setProtoDataOrder
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
Definition: RooAbsGenContext.cxx:348
RooAbsGenContext::initGenerator
virtual void initGenerator(const RooArgSet &theEvent)
Interface function to initialize context for generation for given set of observables.
Definition: RooAbsGenContext.cxx:273
RooAbsGenContext::printMultiline
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Interface for multi-line printing.
Definition: RooAbsGenContext.cxx:335
RooAbsPdf::ExtendMode
ExtendMode
Definition: RooAbsPdf.h:229
RooAbsGenContext::_extendMode
RooAbsPdf::ExtendMode _extendMode
Definition: RooAbsGenContext.h:84
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
RooAbsGenContext::_verbose
Bool_t _verbose
Definition: RooAbsGenContext.h:80
RooAbsPdf.h
RooAbsGenContext::_nextProtoIndex
Int_t _nextProtoIndex
Definition: RooAbsGenContext.h:83
RooAbsGenContext::isValid
Bool_t isValid() const
Definition: RooAbsGenContext.h:34
RooPrintable::defaultPrintStream
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
Definition: RooPrintable.cxx:272
RooAbsGenContext::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default contents when printing.
Definition: RooAbsGenContext.cxx:402
TNamed
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooAbsGenContext::defaultPrintStyle
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Define default print style.
Definition: RooAbsGenContext.cxx:412
RooAbsGenContext::_protoOrder
Int_t * _protoOrder
Definition: RooAbsGenContext.h:85
RooAbsGenContext::isVerbose
Bool_t isVerbose() const
Definition: RooAbsGenContext.h:43
RooAbsGenContext
Definition: RooAbsGenContext.h:26
RooAbsGenContext::createDataSet
virtual RooDataSet * createDataSet(const char *name, const char *title, const RooArgSet &obs)
Create an empty dataset to hold the events that will be generated.
Definition: RooAbsGenContext.cxx:133
RooAbsGenContext::_protoVars
RooArgSet _protoVars
Definition: RooAbsGenContext.h:82
unsigned int
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsGenContext::printArgs
virtual void printArgs(std::ostream &os) const
Print arguments of context, i.e. the observables being generated in this context.
Definition: RooAbsGenContext.cxx:312
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooPrintable::printStream
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,...
Definition: RooPrintable.cxx:75
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooDataSet
Definition: RooDataSet.h:33
RooAbsGenContext::_genData
RooDataSet * _genData
Definition: RooAbsGenContext.h:88
make_cnn_model.model
model
Definition: make_cnn_model.py:6
RooAbsGenContext::setExpectedData
virtual void setExpectedData(Bool_t)
Definition: RooAbsGenContext.h:66
RooAbsPdf
Definition: RooAbsPdf.h:40
RooAbsGenContext::_prototype
const RooDataSet * _prototype
Definition: RooAbsGenContext.h:77
RooAbsGenContext::attach
virtual void attach(const RooArgSet &params)
Interface to attach given parameters to object in this context.
Definition: RooAbsGenContext.cxx:124
RooAbsGenContext::generateEvent
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)=0
RooAbsGenContext::printClassName
virtual void printClassName(std::ostream &os) const
Print class name of context.
Definition: RooAbsGenContext.cxx:302
RooAbsGenContext::printTitle
virtual void printTitle(std::ostream &os) const
Print title of context.
Definition: RooAbsGenContext.cxx:292
RooArgSet
Definition: RooArgSet.h:28
int