54namespace TestStatistics {
 
   60                            std::string 
const &global_observables_tag)
 
   64   bool doStripDisconnected = 
false;
 
   69   bool did_default_constraint_algo = 
false;
 
   70   std::size_t N_default_constraints = 0;
 
   72   if (constrained_parameters.
empty()) {
 
   74      constrained_parameters.
add(*default_constraints);
 
   75      doStripDisconnected = 
true;
 
   77      did_default_constraint_algo = 
true;
 
   78      N_default_constraints = default_constraints->getSize();
 
   82   if (did_default_constraint_algo) {
 
   83      assert(N_default_constraints == 
static_cast<std::size_t
>(constrained_parameters.
getSize()));
 
   90   if (!global_observables_tag.empty()) {
 
   91      if (!global_observables.
empty()) {
 
   95      global_observables.
add(*
dynamic_cast<RooArgSet *
>(allVars->selectByAttrib(global_observables_tag.c_str(), 
true)));
 
   96      oocoutI(
nullptr, 
Minimization) << 
"User-defined specification of global observables definition with tag named '" 
   97                                     << global_observables_tag << 
"'" << std::endl;
 
   98   } 
else if (global_observables.
empty()) {
 
  104            << 
"p.d.f. provides built-in specification of global observables definition with tag named '" 
  105            << defGlobObsTag << 
"'" << std::endl;
 
  106         std::unique_ptr<RooArgSet> allVars{pdf->
getVariables()};
 
  107         global_observables.
add(*
dynamic_cast<RooArgSet *
>(allVars->selectByAttrib(defGlobObsTag, 
true)));
 
  113   if (!constrained_parameters.
empty()) {
 
  114      std::unique_ptr<RooArgSet> constraints{
 
  116      allConstraints.
add(*constraints);
 
  118   if (!external_constraints.
empty()) {
 
  119      allConstraints.
add(external_constraints);
 
  122   return allConstraints;
 
  146                                                 std::string 
const &global_observables_tag)
 
  148   auto allConstraints = getConstraintsSet(pdf, 
data, constrained_parameters, external_constraints, global_observables,
 
  149                                           global_observables_tag);
 
  151   std::unique_ptr<RooSubsidiaryL> subsidiary_likelihood;
 
  153   if (!allConstraints.
empty()) {
 
  155      oocoutI(
nullptr, 
Minimization) << 
" Including the following contraint terms in minimization: " << allConstraints
 
  157      if (!global_observables.
empty()) {
 
  158         oocoutI(
nullptr, 
Minimization) << 
"The following global observables have been defined: " << global_observables
 
  161      std::string 
name(
"likelihood for pdf ");
 
  163      subsidiary_likelihood = std::make_unique<RooSubsidiaryL>(
 
  164         name, allConstraints, (!global_observables.
empty()) ? global_observables : constrained_parameters);
 
  167   return subsidiary_likelihood;
 
  186      for (
const auto component : ((
RooProdPdf *)pdf)->pdfList()) {
 
  187         if (component->getAttribute(
"BinnedLikelihood") && component->IsA()->InheritsFrom(
RooRealSumPdf::Class())) {
 
  217   TString simCatName(simCat.GetName());
 
  220   std::unique_ptr<TList> dsetList{
_data.
split(*sim_pdf, process_empty_data_sets)};
 
  222      throw std::logic_error(
 
  223         "getSimultaneousComponents ERROR, index category of simultaneous pdf is missing in dataset, aborting");
 
  227   std::size_t N_components = 0;
 
  229   for (
const auto &catState : simCat) {
 
  231      RooAbsPdf *component_pdf = sim_pdf->getPdf(catState.first.c_str());
 
  232      auto *dset = 
static_cast<RooAbsData *
>(dsetList->FindObject(catState.first.c_str()));
 
  234      if (component_pdf && dset && (0. != dset->sumEntries() || process_empty_data_sets)) {
 
  240   std::vector<std::unique_ptr<RooAbsL>> components;
 
  241   components.reserve(N_components);
 
  246   for (
const auto &catState : simCat) {
 
  247      const std::string &catName = catState.first;
 
  249      RooAbsPdf *component_pdf = sim_pdf->getPdf(catName.c_str());
 
  250      auto *dset = 
static_cast<RooAbsData *
>(dsetList->FindObject(catName.c_str()));
 
  252      if (component_pdf && dset && (0. != dset->sumEntries() || process_empty_data_sets)) {
 
  253         ooccoutI(
nullptr, 
Fitting) << 
"getSimultaneousComponents: creating slave calculator #" << 
n << 
" for state " 
  254                                    << catName << 
" (" << dset->numEntries() << 
" dataset entries)" << std::endl;
 
  256         RooAbsPdf *binnedPdf = getBinnedPdf(component_pdf);
 
  257         bool binnedL = (binnedPdf != 
nullptr);
 
  260            for (
const auto component : ((
RooProdPdf *)component_pdf)->pdfList()) {
 
  261               if (component->getAttribute(
"MAIN_MEASUREMENT")) {
 
  272            components.push_back(std::make_unique<RooBinnedL>((binnedPdf ? binnedPdf : component_pdf), dset));
 
  274            components.push_back(
 
  275               std::make_unique<RooUnbinnedL>((binnedPdf ? binnedPdf : component_pdf), dset, 
_extended, 
_batchMode));
 
  278         components.back()->setSimCount(N_components);
 
  282         std::unique_ptr<RooArgSet> actualParams{binnedPdf ? binnedPdf->
getParameters(dset)
 
  289         assert(selTargetParams.
equals(*components.back()->getParameters()));
 
  293         if ((!dset || (0. != dset->sumEntries() && !process_empty_data_sets)) && component_pdf) {
 
  294            ooccoutD(
nullptr, 
Fitting) << 
"getSimultaneousComponents: state " << catName
 
  295                                       << 
" has no data entries, no slave calculator created" << std::endl;
 
  299   oocoutI(
nullptr, 
Fitting) << 
"getSimultaneousComponents: created " << 
n << 
" slave calculators." << std::endl;
 
  326   std::unique_ptr<RooAbsL> likelihood;
 
  327   std::vector<std::unique_ptr<RooAbsL>> components;
 
  331   } 
else if (
auto binnedPdf = getBinnedPdf(&
_pdf)) {
 
  332      likelihood = std::make_unique<RooBinnedL>(binnedPdf, &
_data);
 
  341         components.push_back(std::move(likelihood));
 
  345   if (!components.empty()) {
 
  346      likelihood = std::make_unique<RooSumL>(&
_pdf, &
_data, std::move(components), 
_extended);
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
 
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...
 
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
 
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)
 
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
 
bool equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically-named contents.
 
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
 
Int_t getSize() const
Return the number of elements in the collection.
 
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
 
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...
 
RooAbsData is the common abstract base class for binned and unbinned datasets.
 
virtual const RooArgSet * get() const
 
virtual TList * split(const RooAbsCategory &splitCat, bool createEmptyDataSets=false) const
Split dataset into subsets based on states of given splitCat in this dataset.
 
TClass * IsA() const override
 
RooArgSet * getAllConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected=true, bool removeConstraintsFromPdf=false) const
This helper function finds and collects all constraints terms of all component p.d....
 
RooArgSet is a container object that can hold multiple RooAbsArg objects.
 
RooArgSet _globalObservables
 
std::unique_ptr< RooAbsL > build()
 
std::vector< std::unique_ptr< RooAbsL > > getSimultaneousComponents()
 
RooArgSet _externalConstraints
 
RooFit::BatchModeOption _batchMode
 
NLLFactory(RooAbsPdf &pdf, RooAbsData &data)
Create a likelihood builder for a given pdf and dataset.
 
std::string _globalObservablesTag
 
RooAbsL::Extended _extended
 
NLLFactory & BatchMode(RooFit::BatchModeOption batchMode)
 
NLLFactory & ExternalConstraints(const RooArgSet &externalconstraints)
 
NLLFactory & Extended(RooAbsL::Extended extended)
 
NLLFactory & GlobalObservables(const RooArgSet &globalObservables)
 
NLLFactory & ConstrainedParameters(const RooArgSet &constrainedParameters)
 
RooArgSet _constrainedParameters
 
NLLFactory & GlobalObservablesTag(const char *globalObservablesTag)
 
static bool isExtendedHelper(RooAbsPdf *pdf, Extended extended)
 
RooProdPdf is an efficient implementation of a product of PDFs of the form.
 
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
 
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
 
const char * GetName() const override
Returns name of object.
 
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
 
BatchModeOption
For setting the batch mode flag with the BatchMode() command argument to RooAbsPdf::fitTo()