Logo ROOT  
Reference Guide
RooAddGenContext.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAddGenContext.h,v 1.12 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_ADD_GEN_CONTEXT
17#define ROO_ADD_GEN_CONTEXT
18
19#include "RooAbsGenContext.h"
20#include "RooArgSet.h"
21#include <vector>
22#include "RooAddPdf.h"
23#include "RooAddModel.h"
24
25class RooAddPdf;
26class RooAddModel;
27class RooDataSet;
28class RooRealIntegral;
29class RooAcceptReject;
30class TRandom;
31
33public:
34 RooAddGenContext(const RooAddPdf &model, const RooArgSet &vars, const RooDataSet *prototype= 0,
35 const RooArgSet* auxProto=0, bool _verbose= false);
36 RooAddGenContext(const RooAddModel &model, const RooArgSet &vars, const RooDataSet *prototype= 0,
37 const RooArgSet* auxProto=0, bool _verbose= false);
38 ~RooAddGenContext() override;
39
40 void setProtoDataOrder(Int_t* lut) override ;
41
42 void attach(const RooArgSet& params) override ;
43
44 void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override ;
45
46protected:
47
48 void initGenerator(const RooArgSet &theEvent) override;
49 void generateEvent(RooArgSet &theEvent, Int_t remaining) override;
50 void updateThresholds() ;
51
53
55 RooArgSet* _pdfSet ; ///< Set owned all nodes of internal clone of p.d.f
56 RooAbsPdf *_pdf ; ///< Pointer to cloned p.d.f
57 std::vector<RooAbsGenContext*> _gcList ; ///< List of component generator contexts
58 Int_t _nComp ; ///< Number of PDF components
59 double* _coefThresh ; ///<[_nComp] Array of coefficient thresholds
60 bool _isModel ; ///< Are we generating from a RooAddPdf or a RooAddModel
61 RooAddModel::CacheElem* _mcache ; ///<! RooAddModel cache element
62 RooAddPdf::CacheElem* _pcache ; ///<! RooAddPdf cache element
63
64 ClassDefOverride(RooAddGenContext,0) // Specialized context for generating a dataset from a RooAddPdf
65};
66
67#endif
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
static void indent(ostringstream &buf, int indent_level)
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
bool _verbose
Verbose messaging?
Class RooAcceptReject is a generic toy monte carlo generator implement the accept/reject sampling tec...
RooAddGenContext is an efficient implementation of the generator context specific for RooAddPdf PDFs.
void setProtoDataOrder(Int_t *lut) override
Forward the setProtoDataOrder call to the component generator contexts.
bool _isModel
Are we generating from a RooAddPdf or a RooAddModel.
void initGenerator(const RooArgSet &theEvent) override
One-time initialization of generator contex.
void updateThresholds()
Update the cumulative threshold table from the current coefficient values.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print the details of the context.
double * _coefThresh
[_nComp] Array of coefficient thresholds
std::vector< RooAbsGenContext * > _gcList
List of component generator contexts.
RooArgSet * _pdfSet
Set owned all nodes of internal clone of p.d.f.
~RooAddGenContext() override
Destructor. Delete all owned subgenerator contexts.
RooAddGenContext(const RooAddPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, bool _verbose=false)
Constructor.
RooAddGenContext(const RooAddGenContext &other)
RooAddModel::CacheElem * _mcache
! RooAddModel cache element
void attach(const RooArgSet &params) override
Attach given set of variables to internal p.d.f. clone.
Int_t _nComp
Number of PDF components.
RooAddPdf::CacheElem * _pcache
! RooAddPdf cache element
RooAbsPdf * _pdf
Pointer to cloned p.d.f.
void generateEvent(RooArgSet &theEvent, Int_t remaining) override
Randomly choose one of the component contexts to generate this event, with a probability proportional...
const RooArgSet * _vars
RooAddModel is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddModel.h:26
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:32
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:55
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
Basic string class.
Definition: TString.h:136