66 <<
" generate all components of the index category" << endl ;
77 <<
"must be extended PDFs. Otherwise, it is impossible to calculate the number of events to be generated per component." << endl ;
92 for(
auto * proxy : static_range_cast<RooRealProxy*>(model.
_pdfProxyList)) {
93 auto pdf =
static_cast<RooAbsPdf*
>(proxy->absArg());
97 RooAbsGenContext* cx = pdf->autoGenContext(*compVars,
nullptr,
nullptr,verbose,autoBinned,binnedTag) ;
99 const auto state = idxCat.
lookupIndex(proxy->name());
116 oocoutE(
_pdf,
Generation) <<
"RooSimSplitGenContext::RooSimSplitGenContext(" <<
GetName() <<
") Couldn't deep-clone index category, abort," << endl ;
117 throw std::string(
"RooSimSplitGenContext::RooSimSplitGenContext() Couldn't deep-clone index category, abort") ;
130 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
147 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
148 (*iter)->attach(args) ;
167 for (vector<RooAbsGenContext*>::iterator iter =
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
168 (*iter)->initGenerator(theEvent) ;
190 << nEvents <<
" events" << endl;
224 double nGenSoFar(0) ;
225 while (nGenSoFar<nEvents) {
241 map<string,RooAbsData*> dataMap ;
247 dataMap[proxy->GetName()] =
_gcList[icomp]->generate(nGen[icomp],skipInit,extendedMode) ;
266 elem->setExpectedData(flag) ;
308 os <<
indent <<
"--- RooSimSplitGenContext ---" << endl ;
309 os <<
indent <<
"Using PDF ";
static void indent(ostringstream &buf, int indent_level)
bool recursiveRedirectServers(const RooAbsCollection &newServerList, bool mustReplaceAll=false, bool nameChange=false, bool recurseInNewSet=true)
Recursively replace all servers with the new servers in newSet.
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
virtual bool isDerived() const
Does value or shape of this arg depend on any other arg?
Abstract base class for objects that represent a discrete value that can be set from the outside,...
value_type lookupIndex(const std::string &stateName) const
Find the index number corresponding to the state name.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for generator contexts of RooAbsPdf objects.
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.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
UInt_t _expectedEvents
Number of expected events from extended p.d.f.
bool _verbose
Verbose messaging?
bool _isValid
Is context in valid state?
Abstract interface for all probability density functions.
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
RooDataSet is a container class to hold unbinned data.
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 uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
RooSimSplitGenContext is an efficient implementation of the generator context specific for RooSimulta...
void setExpectedData(bool) override
Forward to components.
void generateEvent(RooArgSet &theEvent, Int_t remaining) override
this method is empty because it is not used in this type of context
std::vector< RooAbsGenContext * > _gcList
List of component generator contexts.
RooArgSet _allVarsPdf
All pdf variables.
void attach(const RooArgSet ¶ms) override
Attach the index category clone to the given event buffer.
RooSimSplitGenContext(const RooSimultaneous &model, const RooArgSet &vars, bool _verbose=false, bool autoBinned=true, const char *binnedTag="")
Constructor of specialized generator context for RooSimultaneous p.d.f.s.
void initGenerator(const RooArgSet &theEvent) override
Perform one-time initialization of generator context.
double * _fracThresh
fraction thresholds
RooDataSet * createDataSet(const char *name, const char *title, const RooArgSet &obs) override
this method is empty because it is not used by this context
Int_t _numPdf
Number of generated PDFs.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Detailed printing interface.
RooArgSet _idxCatSet
Owner of index category components.
const RooSimultaneous * _pdf
Original PDF.
RooDataSet * generate(double nEvents=0, bool skipInit=false, bool extendedMode=false) override
Generate the specified number of events with nEvents>0 and and return a dataset containing the genera...
std::vector< int > _gcIndex
Index value corresponding to component.
void setProtoDataOrder(Int_t *lut) override
this method is empty because proto datasets are not supported by this context
~RooSimSplitGenContext() override
Destructor. Delete all owned subgenerator contexts.
RooAbsCategoryLValue * _idxCat
Clone of index category.
TString _idxCatName
Name of index category.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
TList _pdfProxyList
List of PDF proxies (named after applicable category state)
RooArgSet const & flattenedCatList() const
Internal utility function to get a list of all category components for this RooSimultaneous.
const RooAbsCategoryLValue & indexCat() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
const char * GetName() const override
Returns name of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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...