61 oocoutE(
_pdf,Generation) <<
"RooSimSplitGenContext::ctor(" <<
GetName() <<
") ERROR: This context must"
62 <<
" generate all components of the index category" << std::endl ;
72 oocoutE(
_pdf,Generation) <<
"RooSimSplitGenContext::RooSimSplitGenContext(" <<
GetName() <<
"): All components of the simultaneous PDF "
73 <<
"must be extended PDFs. Otherwise, it is impossible to calculate the number of events to be generated per component." << std::endl ;
88 for(
auto * proxy : static_range_cast<RooRealProxy*>(model.
_pdfProxyList)) {
89 auto pdf =
static_cast<RooAbsPdf*
>(proxy->absArg());
93 RooAbsGenContext* cx = pdf->autoGenContext(*compVars,
nullptr,
nullptr,verbose,autoBinned,binnedTag) ;
95 const auto state = idxCat.
lookupIndex(proxy->name());
112 oocoutE(
_pdf,Generation) <<
"RooSimSplitGenContext::RooSimSplitGenContext(" <<
GetName() <<
") Couldn't deep-clone index category, abort," << std::endl ;
113 throw std::string(
"RooSimSplitGenContext::RooSimSplitGenContext() Couldn't deep-clone index category, abort") ;
164 item->initGenerator(theEvent) ;
186 << nEvents <<
" events" << std::endl;
197 std::vector<double> nGen(
_numPdf) ;
220 double nGenSoFar(0) ;
221 while (nGenSoFar<nEvents) {
237 std::map<std::string,RooAbsData*> dataMap ;
243 dataMap[proxy->GetName()] =
_gcList[icomp]->generate(nGen[icomp],skipInit,extendedMode) ;
262 elem->setExpectedData(flag) ;
304 os <<
indent <<
"--- RooSimSplitGenContext ---" << std::endl ;
305 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
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.
RooArgSet * selectCommon(const RooAbsCollection &refColl) const
Use RooAbsCollection::selecCommon(), but return as RooArgSet.
Object to represent discrete states.
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)
Efficient implementation of the generator context specific for RooSimultaneous PDFs when generating m...
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)