78 std::map<std::string, RooAbsPdf *> pdfMap;
79 auto indexCatIt = inIndexCat.
begin();
80 for (
unsigned int i = 0; i < inPdfList.
size(); ++i) {
81 auto pdf =
static_cast<RooAbsPdf *
>(&inPdfList[i]);
82 const auto &nameIdx = (*indexCatIt++);
83 pdfMap[nameIdx.first] = pdf;
134 if (inPdfList.
size() != inIndexCat.
size()) {
135 std::stringstream errMsg;
136 errMsg <<
"RooSimultaneous::ctor(" <<
GetName()
137 <<
" ERROR: Number PDF list entries must match number of index category states, no PDFs added";
138 coutE(InputArguments) << errMsg.str() << std::endl;
139 throw std::invalid_argument(errMsg.str());
154 _plotCoefNormSet(
"!plotCoefNormSet",
"plotCoefNormSet", this, false, false),
155 _partIntMgr(this, 10),
156 _indexCat(
"indexCat",
"Index category", this, *initInfo.indexCat)
158 for (std::size_t i = 0; i < initInfo.finalPdfs.size(); ++i) {
159 addPdf(*initInfo.finalPdfs[i], initInfo.finalCatLabels[i].c_str());
163 if (initInfo.superIndex) {
180std::unique_ptr<RooSimultaneous::InitializationOutput>
182 std::map<std::string, RooAbsPdf *>
const& pdfMap)
185 auto out = std::make_unique<RooSimultaneous::InitializationOutput>();
186 out->indexCat = &inIndexCat;
189 bool simComps(
false) ;
190 for (
auto const& item : pdfMap) {
199 for (
auto const& item : pdfMap) {
200 out->addPdf(*item.second,item.first);
205 std::string msgPrefix =
"RooSimultaneous::initialize(" +
name +
") ";
208 oocoutI(
nullptr, InputArguments) << msgPrefix <<
"INFO: one or more input component of simultaneous p.d.f.s are"
209 <<
" simultaneous p.d.f.s themselves, rewriting composite expressions as one-level simultaneous p.d.f. in terms of"
210 <<
" final constituents and extended index category" << std::endl;
214 std::map<string,RooSimultaneousAux::CompInfo> compMap ;
215 for (
auto const& item : pdfMap) {
217 ci.
pdf = item.second ;
223 ? std::make_unique<RooArgSet>(simComp->
indexCat())
230 compMap[item.first] = std::move(ci);
235 allCats.
add(allAuxCats) ;
236 std::string siname =
name +
"_index";
237 out->superIndex = std::make_unique<RooSuperCategory>(siname.c_str(),siname.c_str(),allCats) ;
238 auto *superIndex = out->superIndex.get();
239 out->indexCat = superIndex;
242 for (
auto const& citem : compMap) {
245 if (citem.second.subIndexComps) {
246 repliCats.
remove(*citem.second.subIndexComps) ;
248 inIndexCat.
setLabel(citem.first.c_str()) ;
250 if (!citem.second.simPdf) {
256 for (
const auto& nameIdx : repliSuperCat) {
258 repliSuperCat.
setLabel(nameIdx.first) ;
260 string superLabel = superIndex->getCurrentLabel() ;
261 out->addPdf(*citem.second.pdf,superLabel);
263 <<
"assigning pdf " << citem.second.pdf->GetName() <<
" to super label " << superLabel << endl ;
269 if (repliCats.
empty()) {
273 for (
const auto&
type : *citem.second.subIndex) {
276 RooAbsPdf* compPdf = citem.second.simPdf->getPdf(
type.first);
278 out->addPdf(*compPdf,superLabel);
280 <<
"assigning pdf " << compPdf->
GetName() <<
"(member of " << citem.second.pdf->GetName()
281 <<
") to super label " << superLabel << endl ;
283 oocoutW(
nullptr, InputArguments) << msgPrefix <<
"WARNING: No p.d.f. associated with label "
284 <<
type.second <<
" for component RooSimultaneous p.d.f " << citem.second.pdf->GetName()
285 <<
"which is associated with master index label " << citem.first << endl ;
296 for (
const auto& stype : *citem.second.subIndex) {
299 for (
const auto& nameIdx : repliSuperCat) {
300 repliSuperCat.
setLabel(nameIdx.first) ;
301 const string superLabel = superIndex->getCurrentLabel() ;
302 RooAbsPdf* compPdf = citem.second.simPdf->getPdf(stype.first);
304 out->addPdf(*compPdf,superLabel);
306 <<
"assigning pdf " << compPdf->
GetName() <<
"(member of " << citem.second.pdf->GetName()
307 <<
") to super label " << superLabel << endl ;
309 oocoutW(
nullptr, InputArguments) << msgPrefix <<
"WARNING: No p.d.f. associated with label "
310 << stype.second <<
" for component RooSimultaneous p.d.f " << citem.second.pdf->GetName()
311 <<
"which is associated with master index label " << citem.first << endl ;
328 _plotCoefNormSet(
"!plotCoefNormSet",this,other._plotCoefNormSet),
329 _plotCoefNormRange(other._plotCoefNormRange),
330 _partIntMgr(other._partIntMgr,this),
331 _indexCat(
"indexCat",this,other._indexCat),
332 _numPdf(other._numPdf)
335 for(
auto* proxy : static_range_cast<RooRealProxy*>(other.
_pdfProxyList)) {
358 return proxy ?
static_cast<RooAbsPdf*
>(proxy->absArg()) :
nullptr;
381 coutE(InputArguments) <<
"RooSimultaneous::addPdf(" <<
GetName() <<
"): PDF '" << pdf.
GetName()
388 coutE(InputArguments) <<
"RooSimultaneous::addPdf(" <<
GetName() <<
"): index state '"
389 << catLabel <<
"' has already an associated PDF." << endl ;
396 coutE(InputArguments) <<
"RooSimultaneous::addPdf(" <<
GetName()
397 <<
") ERROR: you cannot add a RooSimultaneous component to a RooSimultaneous using addPdf()."
398 <<
" Use the constructor with RooArgList if input p.d.f.s or the map<string,RooAbsPdf&> instead." << endl ;
423 bool anyCanExtend(
false) ;
424 bool anyMustExtend(
false) ;
438 anyMustExtend =
true;
467 if (proxy==0)
return 0 ;
475 for(
auto * proxy2 : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
478 catFrac=nEvtCat/nEvtTot ;
499 for(
auto * proxy : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
500 sum += ((
RooAbsPdf*)(proxy->absArg()))->expectedEvents(nset) ;
511 if (proxy==0)
return 0 ;
514 return ((
RooAbsPdf*)(proxy->absArg()))->expectedEvents(nset);
526 const RooArgSet* normSet,
const char* rangeName)
const
529 analVars.
add(allVars) ;
543 for(
auto * proxy : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
544 cache->
_partIntList.
addOwned(std::unique_ptr<RooAbsReal>{proxy->arg().createIntegral(analVars,normSet,0,rangeName)});
601 pc.
defineSet(
"projDataSet",
"ProjData",0) ;
615 std::unique_ptr<RooArgSet> sliceSet( sliceSetTmp ? ((
RooArgSet*) sliceSetTmp->
Clone()) : nullptr );
617 double scaleFactor = pc.
getDouble(
"scaleFactor") ;
622 const char* sliceCatState = pc.
getString(
"sliceCatState",0,
true) ;
628 sliceSet = std::make_unique<RooArgSet>();
635 unsigned int tokenIndex = 0;
636 for(
auto * scat : static_range_cast<RooCategory*>(sliceCatList)) {
637 const char* slabel = tokenIndex >= catTokens.size() ? nullptr : catTokens[tokenIndex++].c_str();
641 scat->setLabel(slabel) ;
643 sliceSet->add(*scat,
false) ;
650 coutE(InputArguments) <<
"RooSimultaneous::plotOn(" <<
GetName() <<
") ERROR: must have a projection dataset for index category" << endl ;
660 for (
const auto sliceArg : *sliceSet) {
663 projectedVars.
remove(*arg) ;
665 coutI(Plotting) <<
"RooAbsReal::plotOn(" <<
GetName() <<
") slice variable "
666 << sliceArg->GetName() <<
" was not projected anyway" << endl ;
669 }
else if (projSet) {
675 bool projIndex(
false) ;
683 coutE(Plotting) <<
"RooSimultaneous::plotOn(" <<
GetName() <<
") ERROR: Projection over index category "
684 <<
"requested, but projection data set doesn't contain index category" << endl ;
697 bool anyServers(
false) ;
699 if (projectedVars.
find(server->GetName())) {
701 projIdxServers.
add(*server) ;
709 bool allServers(
true) ;
711 for (
const auto server : projIdxServers) {
712 if (!projData->
get()->
find(server->GetName())) {
714 missing = server->GetName();
719 coutE(Plotting) <<
"RooSimultaneous::plotOn(" <<
GetName()
720 <<
") ERROR: Projection dataset doesn't contain complete set of index categories to do projection."
721 <<
"\n\tcategory " << missing <<
" is missing." << endl ;
740 std::unique_ptr<RooArgSet> idxCompSliceSet( idxCatClone->getObservables(frame->
getNormVars()) );
746 <<
" represents a slice in the index category (" <<
_indexCat.
arg().
GetName() <<
")" << endl ;
754 for (
const auto arg : *idxCompSliceSet) {
757 if (sliceSet && (slicedComponent = sliceSet->find(*idxComp)) !=
nullptr) {
758 auto theCat =
static_cast<const RooAbsCategory*
>(slicedComponent);
759 idxComp->setIndex(theCat->getCurrentIndex(),
false);
767 cutString.
Append(
Form(
"%s==%d",idxComp->GetName(),idxComp->getCurrentIndex())) ;
772 projDataVars.
remove(*idxCompSliceSet,
true,
true) ;
774 std::unique_ptr<RooAbsData> projDataTmp(
const_cast<RooAbsData*
>(projData)->reduce(projDataVars,cutString) );
782 if (!cmdList.
find(
"Asymmetry")) {
783 cmdList2.
Add(&tmp1) ;
785 cmdList2.
Add(&tmp2) ;
796 idxCompSliceSet->
remove(projectedVars,
true,
true) ;
802 double sumWeight(0) ;
803 for(
auto * proxy : static_range_cast<RooRealProxy*>(
_pdfProxyList)) {
805 idxCatClone->setLabel(proxy->name()) ;
809 for (
const auto idxSliceCompArg : *idxCompSliceSet) {
810 const auto idxSliceComp =
static_cast<RooAbsCategory*
>(idxSliceCompArg);
820 wgtCompList.
addOwned(std::make_unique<RooRealVar>(proxy->name(),
"coef",wTable->getFrac(proxy->name())));
821 sumWeight += wTable->getFrac(proxy->name()) ;
824 pdfCompList.
add(proxy->arg()) ;
828 RooAddPdf plotVar{plotVarName,
"weighted sum of RS components",pdfCompList,wgtCompList};
835 std::unique_ptr<RooAbsData> projDataTmp;
841 if (!idxCompSliceSet->empty()) {
843 for (
const auto idxSliceCompArg : *idxCompSliceSet) {
844 const auto idxSliceComp =
static_cast<RooAbsCategory*
>(idxSliceCompArg);
850 cutString.
Append(
Form(
"%s==%d",idxSliceComp->GetName(),idxSliceComp->getCurrentIndex())) ;
859 projDataVars.
remove(idxCatServers,
true,
true) ;
861 if (!idxCompSliceSet->empty()) {
862 projDataTmp.reset(
const_cast<RooAbsData*
>(projData)->reduce(projDataVars,cutString) );
864 projDataTmp.reset(
const_cast<RooAbsData*
>(projData)->reduce(projDataVars) );
870 projSetTmp.
add(*projSet) ;
871 projSetTmp.
remove(idxCatServers,
true,
true);
878 <<
" represents a slice in index category components " << *idxCompSliceSet << endl ;
882 idxCompProjSet.
remove(*idxCompSliceSet,
true,
true) ;
883 if (!idxCompProjSet.
empty()) {
885 <<
" averages with data index category components " << idxCompProjSet << endl ;
899 if (!cmdList.
find(
"Asymmetry")) {
900 cmdList2.
Add(&tmp1) ;
902 cmdList2.
Add(&tmp2) ;
905 if (!projSetTmp.
empty()) {
908 cmdList2.
Add(&tmp3) ;
909 frame2 = plotVar.plotOn(frame,cmdList2) ;
912 frame2 = plotVar.plotOn(frame,cmdList2) ;
947 const RooArgSet* auxProto,
bool verbose,
bool autoBinned,
const char* binnedTag)
const
951 if (vars.
find(idxCatName) && prototype==0
952 && (auxProto==0 || auxProto->
empty())
953 && (autoBinned || (binnedTag && strlen(binnedTag)))) {
961 return genContext(vars,prototype,auxProto,verbose) ;
971 const RooArgSet* auxProto,
bool verbose)
const
974 if(prototype) allVars.
add(*prototype->
get());
980 if(catsAmongAllVars.
empty()) {
983 coutE(InputArguments) <<
"RooSimultaneous::genContext(" <<
GetName()
984 <<
") ERROR: no PDF associated with current state ("
988 return static_cast<RooAbsPdf*
>(proxy->absArg())->
genContext(vars,prototype,auxProto,verbose) ;
997 coutE(Plotting) <<
"RooSimultaneous::genContext: ERROR: prototype must include either all "
998 <<
" components of the RooSimultaneous index category or none " << std::endl;
1014 bool correctForBinVolume,
1015 bool showProgress)
const
1018 correctForBinVolume, showProgress) == 0)
1042 auto data = std::make_unique<RooDataSet>(
"gensimglobal",
"gensimglobal",whatVars);
1044 for (
Int_t i=0 ; i<nEvents ; i++) {
1045 for (
const auto& nameIdx :
indexCat()) {
1051 std::unique_ptr<RooArgSet> globtmp{pdftmp->
getObservables(whatVars)};
1052 std::unique_ptr<RooDataSet> tmp{pdftmp->
generate(*globtmp,1)};
1055 globClone->
assign(*tmp->get(0)) ;
1057 data->add(*globClone) ;
1071 if (precision < 0.)
return;
1075 for (
auto const &item : this->
indexCat()) {
1077 auto const &catName = item.
first;
1078 auto &pdf = *this->
getPdf(catName);
1084 newSamplingPdf->setAttribute(
1085 (std::string(
"ORIGNAME:") + pdf.GetName()).c_str());
1086 newSamplingPdfs.
addOwned(std::move(newSamplingPdf));
1108 std::map<std::string, double>
const& precisions,
1109 bool useCategoryNames ) {
1111 constexpr double defaultPrecision = -1.;
1115 for (
auto const &item : this->
indexCat()) {
1117 auto const &catName = item.
first;
1118 auto &pdf = *this->
getPdf(catName);
1119 std::string pdfName = pdf.GetName();
1121 auto found = precisions.find(useCategoryNames ? catName : pdfName);
1122 const double precision =
1123 found != precisions.end() ? found->second : defaultPrecision;
1131 newSamplingPdf->setAttribute(
1132 (std::string(
"ORIGNAME:") + pdf.GetName()).c_str());
1133 newSamplingPdfs.
addOwned(std::move(newSamplingPdf));
1151 return superCat->inputCatList();
1168 for (
RooAbsArg *server : arg->servers()) {
1169 if (server->isFundamental() && normSet.
find(*server)) {
1170 prefixArgs(server, prefix, normSet);
1171 server->setAttribute(
"__obs__");
1172 }
else if (!server->isFundamental()) {
1173 prefixArgs(server, prefix, normSet);
1180std::unique_ptr<RooAbsArg>
1192 std::vector<std::string> catNames;
1194 for (
auto *proxy : static_range_cast<RooRealProxy *>(newSimPdf->_pdfProxyList)) {
1195 catNames.emplace_back(proxy->GetName());
1196 std::string
const &catName = catNames.back();
1197 const std::string prefix =
"_" + catName +
"_";
1199 const std::string origname = proxy->arg().
GetName();
1201 std::unique_ptr<RooAbsPdf> pdfClone{
static_cast<RooAbsPdf *
>(proxy->arg().cloneTree())};
1203 prefixArgs(pdfClone.get(), prefix, normSet);
1205 std::unique_ptr<RooArgSet> pdfNormSet(
1206 static_cast<RooArgSet *
>(std::unique_ptr<RooArgSet>(pdfClone->getVariables())->selectByAttrib(
"__obs__",
true)));
1214 auto *pdfFinal = pdfContext.compile(*pdfClone, *newSimPdf, *pdfNormSet);
1216 pdfFinal->fixAddCoefNormalization(*pdfNormSet,
false);
1218 pdfClone->SetName((std::string(
"_") + pdfClone->GetName()).c_str());
1219 pdfFinal->addOwnedComponents(std::move(pdfClone));
1221 pdfFinal->setAttribute((
"ORIGNAME:" + origname).c_str());
1222 newPdfs.
add(*pdfFinal);
1226 newSimPdf->removeServer(
const_cast<RooAbsReal&
>(proxy->arg()),
true);
1234 newSimPdf->_pdfProxyList.Delete();
1237 for (std::size_t i = 0; i < newPdfs.
size(); ++i) {
1238 const char *label = catNames[i].c_str();
1239 newSimPdf->_pdfProxyList.Add(
1245 newSimPdf->recursiveRedirectServers(params);
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
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 > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
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.
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
virtual bool isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual bool setLabel(const char *label, bool printError=true)=0
Change category state by specifying a state name.
A space to attach TBranches.
virtual value_type getCurrentIndex() const
Return index number of current state.
virtual const char * getCurrentLabel() const
Return label string of current state.
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.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
const char * GetName() const override
Returns name of object.
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.
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.
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.
RooAbsData is the common 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.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
bool mustBeExtended() const
If true PDF must provide extended likelihood term.
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none(), const RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
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...
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...
RooAddPdf is an 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.
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.
RooCategory is an object to represent discrete states.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
bool defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
double getDouble(const char *name, double defaultValue=0.0)
Return double property registered with name 'name'.
RooArgSet * getSet(const char *name, RooArgSet *set=nullptr)
Return RooArgSet property registered with name 'name'.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name 'name'.
bool defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
bool defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool ok(bool verbose) const
Return true of parsing was successful.
TObject * getObject(const char *name, TObject *obj=nullptr)
Return TObject property registered with name 'name'.
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false)
Return string property registered with name 'name'.
void allowUndefined(bool flag=true)
If flag is true the processing of unrecognized RooCmdArgs is not considered an error.
bool defineSet(const char *name, const char *argName, Int_t setNum, const RooArgSet *set=nullptr)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
bool defineDouble(const char *name, const char *argName, Int_t doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
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...
The RooDataHist is a 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.
RooDataSet is a 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)
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
TObject * find(const char *name) const
Return pointer to object with given name in collection.
virtual void Add(TObject *arg)
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void remove(const char *name=nullptr, bool deleteToo=true)
Remove object with given name, or last object added if no name is given.
const RooArgSet * getNormVars() const
RooAbsRealLValue * getPlotVar() const
RooSimultaneous 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)
RooObjCacheManager _partIntMgr
! Component normalization manager
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const override
~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.
ExtendMode extendMode() const override
Examine the pdf components and check if one of them can be extended or must be extended It is enough ...
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
static std::unique_ptr< RooSimultaneous::InitializationOutput > initialize(std::string const &name, RooAbsCategoryLValue &inIndexCat, std::map< std::string, RooAbsPdf * > const &pdfMap)
void wrapPdfsInBinSamplingPdfs(RooAbsData const &data, double precision)
Wraps the components of this RooSimultaneous in RooBinSamplingPdfs.
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-syle string that can also be constructed from a std::string...
The RooSuperCategory can join several RooAbsCategoryLValue objects into a single category.
bool setLabel(const char *label, bool printError=true) override
Set the value of the super category by specifying the state name.
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.
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
TString & Append(const char *cs)
RooCmdArg ProjWData(const RooAbsData &projData, bool binData=false)
RooCmdArg Project(const RooArgSet &projSet)
RooCmdArg Normalization(double scaleFactor)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
OwningPtr< T > owningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
std::string getRangeNameForSimComponent(std::string const &rangeName, bool splitRange, std::string const &catName)
std::unique_ptr< RooArgSet > subIndexComps
const RooAbsCategoryLValue * subIndex
Internal struct used for initialization.
std::vector< RooAbsPdf const * > finalPdfs
std::vector< std::string > finalCatLabels
void addPdf(const RooAbsPdf &pdf, std::string const &catLabel)
static uint64_t sum(uint64_t i)