40 using namespace RooFit ;
57 RooAbsGenContext(model,vars,prototype,auxProto,verbose), _pdf(&model), _protoData(0)
64 if (prototype) allPdfVars.
add(*prototype->
get(),
kTRUE) ;
72 <<
" generate the index category" << endl ;
92 if (anyServer && !allServers) {
94 <<
" generate all components of a derived index category" << endl ;
108 <<
" or prototype data to calculate number of events per category" << endl ;
151 oocoutE(
_pdf,
Generation) <<
"RooSimGenContext::RooSimGenContext(" <<
GetName() <<
") Couldn't deep-clone index category, abort," << endl ;
152 throw std::string(
"RooSimGenContext::RooSimGenContext() Couldn't deep-clone index category, abort") ;
187 (*iter)->attach(args) ;
210 (*iter)->initGenerator(theEvent) ;
228 map<string,RooAbsData*> dmap ;
234 std::string sliceName =
Form(
"%s_slice_%s",name,state->
GetName()) ;
235 std::string sliceTitle =
Form(
"%s (index slice %s)",title,state->
GetName()) ;
237 dmap[state->
GetName()] = dset ;
269 if (
_gcIndex[i]==cidx) { gidx = i ; break ; }
275 oocoutW(
_pdf,
Generation) <<
"RooSimGenContext::generateEvent: WARNING, no PDF to generate event of type " << cidx << endl ;
338 (*iter)->setProtoDataOrder(lut) ;
349 os << indent <<
"--- RooSimGenContext ---" << endl ;
350 os << indent <<
"Using PDF ";
352 os << indent <<
"List of component generators" << endl ;
358 (*iter)->printMultiline(os,content,verbose,indent2);
RooCategoryProxy _indexCat
virtual Bool_t isDerived() const
TIterator * serverIterator() const
virtual ~RooSimGenContext()
Destructor. Delete all owned subgenerator contexts.
RooDataSet * createDataSet(const char *name, const char *title, const RooArgSet &obs)
Create an empty dataset to hold the events that will be generated.
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, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
virtual Int_t getIndex() const
Return index number of current state.
virtual void SetName(const char *name)
Change (i.e.
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
RooCmdArg Link(const char *state, RooAbsData &data)
Bool_t contains(const RooAbsArg &var) const
virtual const char * name() const
virtual void setIndexFast(Int_t index)
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
RooArgSet _allVarsPdf
Prototype dataset.
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
Iterator abstract base class.
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.
std::map< std::string, std::string >::const_iterator iter
TString & Append(const char *cs)
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.
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
virtual void attach(const RooArgSet ¶ms)
Attach the index category clone to the given event buffer.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
std::vector< int > _gcIndex
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooSimGenContext is an efficient implementation of the generator context specific for RooSimultaneous...
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
ClassImp(RooSimGenContext)
char * Form(const char *fmt,...)
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)=0
RooAbsArg * absArg() const
virtual const char * GetName() const
Returns name of object.
virtual void initGenerator(const RooArgSet &theEvent)
Perform one-time initialization of generator context.
static void indent(ostringstream &buf, int indent_level)
RooDataSet is a container class to hold unbinned data.
RooCategory represents a fundamental (non-derived) discrete value object.
RooCmdArg Index(RooCategory &icat)
virtual Int_t GetSize() const
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Detailed printing interface.
static Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Bool_t canBeExtended() const
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Interface for multi-line printing.
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
const RooSimultaneous * _pdf
std::vector< RooAbsGenContext * > _gcList
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
virtual TObject * Next()=0
RooAbsCategoryLValue * _idxCat
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
const RooAbsCategory & arg() const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of the prototype data to that in the given lookup table.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
virtual const Text_t * GetName() const
Returns name of object.
TIterator * typeIterator() const
Return iterator over all defined states.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
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.
TText gen(9, 20.7,"rootcint")
const RooCatType * lookupType(Int_t index, Bool_t printError=kFALSE) const
Find our type corresponding to the specified index, or return 0 for no match.