63 RooAbsGenContext(model,vars,prototype,auxProto,verbose), _pdf(&model), _protoData(0)
70 if (prototype) allPdfVars.
add(*prototype->
get(),
kTRUE) ;
78 <<
" generate the index category" << endl ;
98 if (anyServer && !allServers) {
100 <<
" generate all components of a derived index category" << endl ;
114 <<
" or prototype data to calculate number of events per category" << endl ;
157 oocoutE(
_pdf,
Generation) <<
"RooSimGenContext::RooSimGenContext(" <<
GetName() <<
") Couldn't deep-clone index category, abort," << endl ;
158 throw std::string(
"RooSimGenContext::RooSimGenContext() Couldn't deep-clone index category, abort") ;
173 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
192 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
193 (*iter)->attach(args) ;
215 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
216 (*iter)->initGenerator(theEvent) ;
234 map<string,RooAbsData*> dmap ;
235 for (
const auto& nameIdx : *
_idxCat) {
238 std::string sliceName =
Form(
"%s_slice_%s",
name, nameIdx.first.c_str());
239 std::string sliceTitle =
Form(
"%s (index slice %s)", title, nameIdx.first.c_str());
241 dmap[nameIdx.first] = dset ;
268 if (
_gcIndex[i]==cidx) { gidx = i ; break ; }
274 oocoutW(
_pdf,
Generation) <<
"RooSimGenContext::generateEvent: WARNING, no PDF to generate event of type " << cidx << endl ;
337 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
338 (*iter)->setProtoDataOrder(lut) ;
349 os <<
indent <<
"--- RooSimGenContext ---" << endl ;
350 os <<
indent <<
"Using PDF ";
352 os <<
indent <<
"List of component generators" << endl ;
357 for (vector<RooAbsGenContext*>::const_iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
358 (*iter)->printMultiline(os,content,verbose,indent2);
static void indent(ostringstream &buf, int indent_level)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Given a set of possible observables, return the observables that this PDF depends on.
virtual Bool_t isDerived() const
Does value or shape of this arg depend on any other arg?
TIterator * serverIterator() const
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
Recursively replace all servers with the new servers in newSet.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual bool setIndex(value_type index, bool printError=true)=0
Change category state by specifying the index code of the desired state.
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
virtual value_type getCurrentIndex() const
Return index number of current state.
value_type lookupIndex(const std::string &stateName) const
Find the index number corresponding to the state name.
Bool_t contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Interface for multi-line printing.
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)=0
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
Interface function to create a generator context from a p.d.f.
Bool_t canBeExtended() const
If true, PDF can provide extended likelihood term.
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
RooAbsArg * absArg() const
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory is an object to represent discrete states.
RooDataSet is a container class to hold unbinned data.
virtual const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
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,...
static Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
RooSimGenContext is an efficient implementation of the generator context specific for RooSimultaneous...
RooAbsCategoryLValue * _idxCat
RooArgSet _allVarsPdf
Prototype dataset.
RooSimGenContext(const RooSimultaneous &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t _verbose=kFALSE)
Constructor of specialized generator context for RooSimultaneous p.d.f.s.
virtual void attach(const RooArgSet ¶ms)
Attach the index category clone to the given event buffer.
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of the prototype data to that in the given lookup table.
void updateFractions()
No action needed if we have a proto index.
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)
Generate event appropriate for current index state.
RooDataSet * createDataSet(const char *name, const char *title, const RooArgSet &obs)
Create an empty dataset to hold the events that will be generated.
const RooSimultaneous * _pdf
std::vector< RooAbsGenContext * > _gcList
virtual ~RooSimGenContext()
Destructor. Delete all owned subgenerator contexts.
std::vector< int > _gcIndex
virtual void initGenerator(const RooArgSet &theEvent)
Perform one-time initialization of generator context.
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Detailed printing interface.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooCategoryProxy _indexCat
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
const T & arg() const
Return reference to object held in proxy.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Iterator abstract base class.
virtual TObject * Next()=0
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
TString & Append(const char *cs)
RooCmdArg Index(RooCategory &icat)
RooCmdArg Link(const char *state, RooAbsData &data)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...