101 std::map<std::string, RooAbsPdf *> pdfMap;
102 auto indexCatIt = inIndexCat.
begin();
103 for (
unsigned int i = 0; i < inPdfList.
size(); ++i) {
104 auto pdf =
static_cast<RooAbsPdf *
>(&inPdfList[i]);
105 const auto &nameIdx = (*indexCatIt++);
106 pdfMap[nameIdx.first] = pdf;
157 if (inPdfList.
size() != inIndexCat.
size()) {
158 std::stringstream errMsg;
159 errMsg <<
"RooSimultaneous::ctor(" <<
GetName()
160 <<
" ERROR: Number PDF list entries must match number of index category states, no PDFs added";
161 coutE(InputArguments) << errMsg.str() << std::endl;
162 throw std::invalid_argument(errMsg.str());
172 _plotCoefNormSet(
"!plotCoefNormSet",
"plotCoefNormSet", this, false, false),
173 _partIntMgr(this, 10),
174 _indexCat(
"indexCat",
"Index category", this, inIndexCat)
176 for (
auto const &item : pdfMap) {
177 addPdf(*item.second, item.first.c_str());
194 _plotCoefNormSet(
"!plotCoefNormSet",this,other._plotCoefNormSet),
195 _plotCoefNormRange(other._plotCoefNormRange),
196 _partIntMgr(other._partIntMgr,this),
197 _indexCat(
"indexCat",this,other._indexCat),
198 _numPdf(other._numPdf)
201 for(
auto* proxy : static_range_cast<RooRealProxy*>(other.
_pdfProxyList)) {
224 return proxy ?
static_cast<RooAbsPdf*
>(proxy->absArg()) :
nullptr;
247 coutE(InputArguments) <<
"RooSimultaneous::addPdf(" <<
GetName() <<
"): PDF '" << pdf.
GetName()
254 coutE(InputArguments) <<
"RooSimultaneous::addPdf(" <<
GetName() <<
"): index state '"
255 << catLabel <<
"' has already an associated PDF." << std::endl ;
274 bool anyCanExtend =
false;
276 for (
auto *proxy : static_range_cast<RooRealProxy *>(
_pdfProxyList)) {
277 auto &pdf =
static_cast<RooAbsPdf const&
>(proxy->arg());
278 if (pdf.mustBeExtended())
280 anyCanExtend |= pdf.canBeExtended();
297 double nEvtTot = 1.0;
298 double nEvtCat = 1.0;
307 for (
auto *proxy2 : static_range_cast<RooRealProxy *>(
_pdfProxyList)) {
308 auto &pdf2 =
static_cast<RooAbsPdf const &
>(proxy2->arg());
309 if(!pdf2.canBeExtended()) {
316 const double nEvt = pdf2.expectedEvents(
_normSet);
318 if (proxy == proxy2) {
325 double catFrac = nEvtCat / nEvtTot;
329 return *proxy * catFrac;
344 for(
auto * proxy : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
345 sum += (
static_cast<RooAbsPdf*
>(proxy->absArg()))->expectedEvents(nset) ;
356 if (proxy==
nullptr)
return 0 ;
359 return (
static_cast<RooAbsPdf*
>(proxy->absArg()))->expectedEvents(nset);
371 const std::string
name = std::string(
GetName()) +
"_expectedEvents";
378 std::map<RooAbsPdf const *, std::string> funcRefs;
380 auto ref = [&](
RooAbsPdf const &pdf) -> std::string {
381 if (!pdf.canBeExtended()) {
384 auto found = funcRefs.find(&pdf);
385 if (found != funcRefs.end()) {
386 return found->second;
388 std::unique_ptr<RooAbsReal> func = pdf.createExpectedEventsFunc(nset);
394 func->SetName((std::string(func->GetName()) +
"_" + std::to_string(funcRefs.size())).c_str());
395 std::string
const funcRef =
"x[" + std::to_string(formulaArgs.
size()) +
"]";
396 formulaArgs.
add(*func);
397 ownedFuncs.
addOwned(std::move(func));
398 return funcRefs[&pdf] = funcRef;
403 for (
auto *proxy : static_range_cast<RooRealProxy *>(
_pdfProxyList)) {
404 formula += (formula.empty() ?
"" :
" + ") + ref(
static_cast<RooAbsPdf const &
>(proxy->arg()));
406 if (formula.empty()) {
413 std::size_t numStates = 0;
419 formula +=
"x[0] == " + std::to_string(nameIdx.second) +
" ? " +
420 ref(
static_cast<RooAbsPdf const &
>(proxy->arg())) +
" : (";
423 formula +=
"0.0" + std::string(numStates,
')');
432 auto out = std::make_unique<RooFormulaVar>(
name.c_str(),
name.c_str(), formula.c_str(), formulaArgs);
433 out->addOwnedComponents(std::move(ownedFuncs));
443 const RooArgSet* normSet,
const char* rangeName)
const
446 analVars.
add(allVars) ;
460 for(
auto * proxy : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
461 cache->
_partIntList.
addOwned(std::unique_ptr<RooAbsReal>{proxy->arg().createIntegral(analVars,normSet,
nullptr,rangeName)});
514 auto *asymCat =
dynamic_cast<RooAbsCategory const *
>(asymCmd->getObject(0));
525 std::unique_ptr<RooAbsData> flatProjData;
528 auto *projData =
dynamic_cast<RooDataSet const *
>(projWData->getObject(1));
530 flatProjData = std::make_unique<RooDataSet>(projData->GetName(), projData->GetTitle(), *projData->get(),
532 const RooArgSet *projDataSet = projWData->getSet(0);
535 replaceOrAdd(cmdList2, newProjWData);
547 auto *projData =
static_cast<RooAbsData const *
>(projWData->getObject(1));
551 return pdf->plotOn(frame, cmdList);
561 pc.
defineObject(
"sliceCatList",
"SliceCat",0,
nullptr,
true) ;
568 pc.
defineSet(
"projDataSet",
"ProjData",0) ;
582 std::unique_ptr<RooArgSet> sliceSet( sliceSetTmp ? (
static_cast<RooArgSet*
>(sliceSetTmp->
Clone())) : nullptr );
584 double scaleFactor = pc.
getDouble(
"scaleFactor") ;
589 const char* sliceCatState = pc.
getString(
"sliceCatState",
nullptr,
true) ;
595 sliceSet = std::make_unique<RooArgSet>();
602 unsigned int tokenIndex = 0;
603 for(
auto * scat : static_range_cast<RooCategory*>(sliceCatList)) {
604 const char* slabel = tokenIndex >= catTokens.size() ? nullptr : catTokens[tokenIndex++].c_str();
608 scat->setLabel(slabel) ;
610 sliceSet->add(*scat,
false) ;
617 coutE(InputArguments) <<
"RooSimultaneous::plotOn(" <<
GetName() <<
") ERROR: must have a projection dataset for index category" << std::endl ;
627 for (
const auto sliceArg : *sliceSet) {
630 projectedVars.
remove(*arg) ;
632 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") slice variable "
633 << sliceArg->GetName() <<
" was not projected anyway" << std::endl ;
636 }
else if (projSet) {
642 bool projIndex(
false) ;
650 coutE(Plotting) <<
"RooSimultaneous::plotOn(" <<
GetName() <<
") ERROR: Projection over index category "
651 <<
"requested, but projection data set doesn't contain index category" << std::endl ;
664 bool anyServers(
false) ;
666 if (projectedVars.
find(server->GetName())) {
668 projIdxServers.
add(*server) ;
676 bool allServers(
true) ;
678 for (
const auto server : projIdxServers) {
679 if (!projData->
get()->
find(server->GetName())) {
681 missing = server->GetName();
686 coutE(Plotting) <<
"RooSimultaneous::plotOn(" <<
GetName()
687 <<
") ERROR: Projection dataset doesn't contain complete set of index categories to do projection."
688 <<
"\n\tcategory " << missing <<
" is missing." << std::endl ;
708 std::unique_ptr<RooArgSet> idxCompSliceSet( idxCatClone->getObservables(frame->
getNormVars()) );
714 <<
" represents a slice in the index category (" <<
_indexCat.
arg().
GetName() <<
")" << std::endl ;
721 for (
auto *idxComp : static_range_cast<RooCategory *>(*idxCompSliceSet)) {
722 if (
auto* slicedComponent =
static_cast<const RooAbsCategory*
>(sliceSet->find(*idxComp))) {
723 idxComp->setIndex(slicedComponent->getCurrentIndex(),
false);
731 projDataVars.
remove(*idxCompSliceSet,
true,
true) ;
733 std::unique_ptr<RooAbsData>
743 if (!cmdList.
find(
"Asymmetry")) {
744 replaceOrAdd(cmdList2, tmp1);
746 replaceOrAdd(cmdList2, tmp2);
757 idxCompSliceSet->remove(projectedVars,
true,
true) ;
763 double sumWeight(0) ;
764 for(
auto * proxy : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
766 idxCatClone->setLabel(proxy->name()) ;
770 for (
const auto idxSliceCompArg : *idxCompSliceSet) {
771 const auto idxSliceComp =
static_cast<RooAbsCategory*
>(idxSliceCompArg);
781 wgtCompList.
addOwned(std::make_unique<RooRealVar>(proxy->name(),
"coef",wTable->get(proxy->name())));
782 sumWeight += wTable->getFrac(proxy->name()) ;
785 pdfCompList.
add(proxy->arg()) ;
789 RooAddPdf plotVar{plotVarName,
"weighted sum of RS components",pdfCompList,wgtCompList};
796 std::unique_ptr<RooAbsData> projDataTmp;
808 projDataVars.
remove(idxCatServers,
true,
true) ;
815 projSetTmp.
add(*projSet) ;
816 projSetTmp.
remove(idxCatServers,
true,
true);
823 <<
" represents a slice in index category components " << *idxCompSliceSet << std::endl ;
827 idxCompProjSet.
remove(*idxCompSliceSet,
true,
true) ;
828 if (!idxCompProjSet.
empty()) {
830 <<
" averages with data index category components " << idxCompProjSet << std::endl ;
834 <<
" averages with data index category (" <<
_indexCat.
arg().
GetName() <<
")" << std::endl ;
844 if (!cmdList.
find(
"Asymmetry")) {
845 replaceOrAdd(cmdList2, tmp1);
847 replaceOrAdd(cmdList2, tmp2);
850 if (!projSetTmp.
empty()) {
853 replaceOrAdd(cmdList2, tmp3);
854 frame2 = plotVar.plotOn(frame,cmdList2) ;
857 frame2 = plotVar.plotOn(frame,cmdList2) ;
877std::unique_ptr<RooAbsReal>
929 const RooArgSet* auxProto,
bool verbose,
bool autoBinned,
const char* binnedTag)
const
933 if (vars.
find(idxCatName) && prototype==
nullptr
934 && (auxProto==
nullptr || auxProto->
empty())
935 && (autoBinned || (binnedTag && strlen(binnedTag)))) {
943 return genContext(vars,prototype,auxProto,verbose) ;
953 const RooArgSet* auxProto,
bool verbose)
const
956 if(prototype) allVars.
add(*prototype->
get());
966 if(catsAmongAllVars.
empty()) {
967 coutE(InputArguments) <<
"RooSimultaneous::generateSimGlobal(" <<
GetName()
968 <<
") asking to generate without the index category!\n"
969 <<
"It's not clear what to do. you probably want to either:\n"
971 <<
" 1. Generate according to the currently-selected pdf.\n"
972 <<
" Please do this explicitly with:\n"
973 <<
" simpdf->getPdf(simpdf->indexCat().getCurrentLabel())->generate(vars, ...)\n"
975 <<
" 1. Generate global observable values according to the union of all component pdfs.\n"
976 <<
" For this, please use simpdf->generateSimGlobal(vars, ...)\n"
987 coutE(Plotting) <<
"RooSimultaneous::genContext: ERROR: prototype must include either all "
988 <<
" components of the RooSimultaneous index category or none " << std::endl;
1004 bool correctForBinVolume,
1005 bool showProgress)
const
1008 correctForBinVolume, showProgress) ==
nullptr)
1041 if(!catsAmongAllVars.
empty()) {
1042 coutE(InputArguments) <<
"RooSimultaneous::generateSimGlobal(" <<
GetName()
1043 <<
") asking to generate global obserables at the same time as the index category!\n"
1044 <<
"This doesn't make any sense: global observables are generally not related to a specific channel.\n"
1053 auto data = std::make_unique<RooDataSet>(
"gensimglobal",
"gensimglobal",whatVars);
1055 for (
Int_t i=0 ; i<nEvents ; i++) {
1056 for (
const auto& nameIdx :
indexCat()) {
1066 if (!globtmp.
empty()) {
1067 globClone.
assign(*std::unique_ptr<RooDataSet>{pdftmp->
generate(globtmp,1)}->get(0)) ;
1070 data->add(globClone) ;
1083 if (precision < 0.)
return;
1087 for (
auto const &item : this->
indexCat()) {
1089 auto const &catName = item.
first;
1090 auto &pdf = *this->
getPdf(catName);
1096 newSamplingPdf->setAttribute(
1097 (std::string(
"ORIGNAME:") + pdf.GetName()).c_str());
1098 newSamplingPdfs.
addOwned(std::move(newSamplingPdf));
1120 std::map<std::string, double>
const& precisions,
1121 bool useCategoryNames ) {
1123 constexpr double defaultPrecision = -1.;
1127 for (
auto const &item : this->
indexCat()) {
1129 auto const &catName = item.
first;
1130 auto &pdf = *this->
getPdf(catName);
1131 std::string pdfName = pdf.GetName();
1133 auto found = precisions.find(useCategoryNames ? catName : pdfName);
1134 const double precision =
1135 found != precisions.end() ? found->second : defaultPrecision;
1143 newSamplingPdf->setAttribute(
1144 (std::string(
"ORIGNAME:") + pdf.GetName()).c_str());
1145 newSamplingPdfs.
addOwned(std::move(newSamplingPdf));
1163 return superCat->inputCatList();
1180 if (sim->indexCatIsObservable(vars)) {
1183 pdf = sim->getPdf(sim->indexCat().getCurrentLabel());
1201 return std::all_of(cats.
begin(), cats.
end(), [&](
RooAbsArg const *cat) { return nset->contains(*cat); });
1217 return !catsAmongVars.
empty();
1224 for (
RooAbsArg *server : arg->servers()) {
1225 if (server->isFundamental() && normSet.
find(*server)) {
1226 markObs(server, prefix, normSet);
1227 server->setAttribute(
"__obs__");
1228 }
else if (!server->isFundamental()) {
1229 markObs(server, prefix, normSet);
1240 for (
RooAbsArg *server : arg->servers()) {
1241 if (server->isFundamental() && normSet.
find(*server)) {
1242 prefixArgs(server, prefix, normSet);
1243 }
else if (!server->isFundamental()) {
1244 prefixArgs(server, prefix, normSet);
1251std::unique_ptr<RooAbsArg>
1271 std::vector<std::string> catNames;
1273 for (
auto *proxy : static_range_cast<RooRealProxy *>(newSimPdf->_pdfProxyList)) {
1274 catNames.emplace_back(proxy->GetName());
1275 std::string
const &catName = catNames.back();
1276 const std::string prefix =
"_" + catName +
"_";
1278 const std::string origname = proxy->arg().GetName();
1282 markObs(pdfClone.get(), prefix, normSet);
1284 std::unique_ptr<RooArgSet> pdfNormSet{
1285 std::unique_ptr<RooArgSet>(pdfClone->getVariables())->selectByAttrib(
"__obs__",
true)};
1286 std::unique_ptr<RooArgSet> condVarSet{
1287 std::unique_ptr<RooArgSet>(pdfClone->getVariables())->selectByAttrib(
"__conditional__",
true)};
1289 pdfNormSet->remove(*condVarSet,
true,
true);
1297 auto *pdfFinal = pdfContext.compile(*pdfClone, *newSimPdf, *pdfNormSet);
1303 RooArgSet compiledPdfNormSet = pdfContext.mapToCompiled(*pdfNormSet);
1312 prefixArgs(pdfFinal, prefix, normSet);
1319 pdfFinal->fixAddCoefNormalization(compiledPdfNormSet,
false);
1321 pdfClone->SetName((std::string(
"_") + pdfClone->GetName()).c_str());
1322 pdfFinal->addOwnedComponents(std::move(pdfClone));
1324 pdfFinal->setAttribute((
"ORIGNAME:" + origname).c_str());
1325 newPdfs.
add(*pdfFinal);
1329 newSimPdf->removeServer(
const_cast<RooAbsReal &
>(proxy->arg()),
true);
1337 newSimPdf->_pdfProxyList.Delete();
1340 for (std::size_t i = 0; i < newPdfs.
size(); ++i) {
1341 const char *label = catNames[i].c_str();
1342 newSimPdf->_pdfProxyList.Add(
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
RooTemplateProxy< RooAbsReal > RooRealProxy
Compatibility typedef replacing the old RooRealProxy class.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Common abstract base class for objects that represent a value and a "shape" in RooFit.
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
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.
void SetName(const char *name) override
Set the name of the TNamed.
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
bool redirectServers(const RooAbsCollection &newServerList, bool mustReplaceAll=false, bool nameChange=false, bool isRecursionStep=false)
Replace all direct servers of this object with the new servers in newServerList.
virtual bool isDerived() const
Does value or shape of this arg depend on any other arg?
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
virtual value_type getCurrentIndex() const
Return index number of current state.
const std::string & lookupName(value_type index) const
Get the name corresponding to the given index.
std::map< std::string, value_type >::const_iterator begin() const
Iterator for category state names. Points to pairs of index and name.
std::size_t size() const
Number of states defined.
bool contains(const char *name) const
Check if collection contains an argument with a specific name.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
const_iterator end() const
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
Storage_t::size_type size() const
RooAbsArg * first() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
const_iterator begin() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual Roo1DTable * table(const RooArgSet &catSet, const char *cuts="", const char *opts="") const
Construct table for product of categories in catSet.
RooFit::OwningPtr< RooAbsData > reduce(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a reduced copy of this dataset.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract base class for generator contexts of RooAbsPdf objects.
Abstract interface for all probability density functions.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooArgSet const * _normSet
! Normalization set with for above integral
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={})
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
Abstract base class for objects that represent a real value and implements functionality common to al...
RooDataHist * fillDataHist(RooDataHist *hist, const RooArgSet *nset, double scaleFactor, bool correctForBinVolume=false, bool showProgress=false) const
Fill a RooDataHist with values sampled from this function at the bin centers.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
bool plotSanityChecks(RooPlot *frame) const
Utility function for plotOn(), perform general sanity check on frame to ensure safe plotting operatio...
virtual std::unique_ptr< RooAbsReal > createAsymmetryComponent(const RooAbsCategoryLValue &asymCat, const RooAbsCategoryLValue &asymCatState) const
Build the component function of an asymmetry plot (see plotAsymOn()) that corresponds to a fixed stat...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const
Plot (project) PDF on specified frame.
void makeProjectionSet(const RooAbsArg *plotVar, const RooArgSet *allVars, RooArgSet &projectedVars, bool silent) const
Utility function for plotOn() that constructs the set of observables to project when plotting ourselv...
Efficient implementation of a sum of PDFs of the form.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
RooArgSet * selectCommon(const RooAbsCollection &refColl) const
Use RooAbsCollection::selecCommon(), but return as RooArgSet.
static std::unique_ptr< RooAbsPdf > create(RooAbsPdf &pdf, RooAbsData const &data, double precision)
Creates a wrapping RooBinSamplingPdf if appropriate.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
Int_t lastIndex() const
Return index of slot used in last get or set operation.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
Named container for two doubles, two integers two object points and three string pointers that can be...
Configurable parser for RooCmdArg named arguments.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
double getDouble(const char *name, double defaultValue=0.0) const
Return double property registered with name 'name'.
bool defineDouble(const char *name, const char *argName, int doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
RooArgSet * getSet(const char *name, RooArgSet *set=nullptr) const
Return RooArgSet property registered with name 'name'.
bool defineSet(const char *name, const char *argName, int setNum, const RooArgSet *set=nullptr)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
bool ok(bool verbose) const
Return true of parsing was successful.
bool defineObject(const char *name, const char *argName, int setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false) const
Return string property registered with name 'name'.
bool defineString(const char *name, const char *argName, int stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
const RooLinkedList & getObjectList(const char *name) const
Return list of objects registered with name 'name'.
bool defineInt(const char *name, const char *argName, int intNum, int defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
void allowUndefined(bool flag=true)
If flag is true the processing of unrecognized RooCmdArgs is not considered an error.
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
TObject * getObject(const char *name, TObject *obj=nullptr) const
Return TObject property registered with name 'name'.
void removeAll() override
Remove all argument inset using remove(const RooAbsArg&).
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
Combines several disjunct datasets into one.
Container class to hold N-dimensional binned data.
double weight(std::size_t i) const
Return weight of i-th bin.
void set(std::size_t binNumber, double weight, double wgtErr)
Set bin content of bin that was last loaded with get(std::size_t).
double sumEntries() const override
Sum the weights of all bins.
Container class to hold unbinned data.
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
void compileServers(RooAbsArg &arg, RooArgSet const &normSet)
bool likelihoodMode() const
void setLikelihoodMode(bool flag)
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
bool Replace(const TObject *oldArg, const TObject *newArg)
Replace object 'oldArg' in collection with new object 'newArg'.
TObject * find(const char *name) const
Return pointer to object with given name in collection.
virtual void Add(TObject *arg)
TObject * FindObject(const char *name) const override
Return pointer to object with given name.
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Plot frame and a container for graphics objects within that frame.
const RooArgSet * getNormVars() const
RooAbsRealLValue * getPlotVar() const
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
void selectNormalization(const RooArgSet *depSet=nullptr, bool force=false) override
Interface function used by test statistics to freeze choice of observables for interpretation of frac...
double evaluate() const override
Return the current value: the value of the PDF associated with the current index category state.
Int_t _numPdf
Number of registered PDFs.
void selectNormalizationRange(const char *rangeName=nullptr, bool force=false) override
Interface function used by test statistics to freeze choice of range for interpretation of fraction c...
TList _pdfProxyList
List of PDF proxies (named after applicable category state)
std::unique_ptr< RooAbsReal > createAsymmetryComponent(const RooAbsCategoryLValue &asymCat, const RooAbsCategoryLValue &asymCatState) const override
Build the component function of an asymmetry plot (see RooAbsReal::plotAsymOn()) for a fixed state of...
bool indexCatIsInNormSet(RooArgSet const *nset) const
Check if the index category is in the normalization set nset, matching by name.
std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const override
Expected events function for the new evaluation backends: the sum over all components,...
RooObjCacheManager _partIntMgr
! Component normalization manager
~RooSimultaneous() override
Destructor.
RooFit::OwningPtr< RooDataSet > generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents) override
Special generator interface for generation of 'global observables' – for RooStats tools.
RooArgSet const & flattenedCatList() const
Internal utility function to get a list of all category components for this RooSimultaneous.
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
ExtendMode extendMode() const override
Examine the pdf components and check if one of them can be extended or must be extended.
RooCategoryProxy _indexCat
Index category.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Return analytical integration defined by given code.
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Forward determination of analytical integration capabilities to component p.d.f.s A unique code is as...
double expectedEvents(const RooArgSet *nset) const override
Return the number of expected events: If the index is in nset, then return the sum of the expected ev...
friend class RooSimGenContext
RooAbsGenContext * autoGenContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false, bool autoBinned=true, const char *binnedTag="") const override
RooAbsPdf * getPdf(RooStringView catName) const
Return the p.d.f associated with the given index category name.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
void wrapPdfsInBinSamplingPdfs(RooAbsData const &data, double precision)
Wraps the components of this RooSimultaneous in RooBinSamplingPdfs.
static RooAbsPdf * resolveSwitchMode(RooAbsPdf *pdf, RooArgSet const &vars)
For the generator contexts: a component that is a RooSimultaneous whose index category is not among t...
bool indexCatIsObservable(RooArgSet const &vars) const
Check if the index category is among the variables vars, matching by name.
const TNamed * _plotCoefNormRange
RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false) const override
Return specialized generator context for simultaneous p.d.f.s.
std::unique_ptr< RooArgSet > _indexCatSet
! Index category wrapped in a RooArgSet if needed internally
bool addPdf(const RooAbsPdf &pdf, const char *catLabel)
Associate given PDF with index category state label 'catLabel'.
RooSetProxy _plotCoefNormSet
const RooAbsCategoryLValue & indexCat() const
friend class RooSimSplitGenContext
virtual RooDataHist * fillDataHist(RooDataHist *hist, const RooArgSet *nset, double scaleFactor, bool correctForBinVolume=false, bool showProgress=false) const
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
const char * c_str() const
Joins several RooAbsCategoryLValue objects into a single category.
const char * label() const
Get the label of the current category state. This function only makes sense for category proxies.
const T & arg() const
Return reference to object held in proxy.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
RooCmdArg SelectVars(const RooArgSet &vars)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg ProjWData(const RooAbsData &projData, bool binData=false)
RooCmdArg Project(const RooArgSet &projSet)
RooCmdArg Normalization(double scaleFactor)
RooCmdArg Cut(const char *cutSpec)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
std::string makeSliceCutString(RooArgSet const &sliceDataSet)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
OwningPtr< T > makeOwningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
std::unique_ptr< T > cloneTreeWithSameParameters(T const &arg, RooArgSet const *observables=nullptr)
Clone RooAbsArg object and reattach to original parameters.
std::string getRangeNameForSimComponent(std::string const &rangeName, bool splitRange, std::string const &catName)
static uint64_t sum(uint64_t i)