46constexpr const char *RooNLLVarNew::weightVarName;
 
   47constexpr const char *RooNLLVarNew::weightVarNameSumW2;
 
   76     _pdf{
"pdf", 
"pdf", this, pdf},
 
   77     _weightVar{
"weightVar", 
"weightVar", this, *dummyVar(weightVarName), true, false, true},
 
   78     _weightSquaredVar{weightVarNameSumW2, weightVarNameSumW2, this, *dummyVar(
"weightSquardVar"), true, false, true},
 
   79     _binVolumeVar{
"binVolumeVar", 
"binVolumeVar", this, *dummyVar(
"_bin_volume"), true, false, true},
 
   80     _binnedL{pdf.getAttribute(
"BinnedLikelihoodActive")}
 
   95            std::make_unique<RooTemplateProxy<RooAbsReal>>(
"expectedEvents", 
"expectedEvents", 
this, *expectedEvents);
 
  107     _pdf{
"pdf", this, other._pdf},
 
  108     _weightVar{
"weightVar", this, other._weightVar},
 
  109     _weightSquaredVar{
"weightSquaredVar", this, other._weightSquaredVar},
 
  110     _weightSquared{other._weightSquared},
 
  111     _binnedL{other._binnedL},
 
  112     _doOffset{other._doOffset},
 
  113     _simCount{other._simCount},
 
  114     _prefix{other._prefix},
 
  125   if (!
_binw.empty()) {
 
  129   if (observables.
size() != 1) {
 
  130      throw std::runtime_error(
"BinnedPdf optimization only works with a 1D pdf.");
 
  133      std::list<double> *boundaries = pdf.
binBoundaries(*var, var->getMin(), var->getMax());
 
  134      std::list<double>::iterator biter = boundaries->begin();
 
  135      _binw.resize(boundaries->size() - 1);
 
  136      double lastBound = (*biter);
 
  139      while (biter != boundaries->end()) {
 
  140         _binw[ibin] = (*biter) - lastBound;
 
  141         lastBound = (*biter);
 
  153   const bool predsAreYields = 
_binw.empty();
 
  155   for (std::size_t i = 0; i < preds.
size(); ++i) {
 
  157      double eventWeight = weights[i];
 
  160      double N = eventWeight;
 
  161      double mu = preds[i];
 
  162      if (!predsAreYields) {
 
  166      if (mu <= 0 && N > 0) {
 
  169         logEvalError(
Form(
"Observed %f events in bin %lu with zero event yield", 
N, (
unsigned long)i));
 
  171      } 
else if (std::abs(mu) < 1
e-10 && std::abs(
N) < 1
e-10) {
 
  179         sumWeightKahanSum += eventWeight;
 
  206   auto probas = dataMap.
at(
_pdf);
 
  209      weights.
size() == 1 ? weights[0] * probas.size() : dispatch->reduceSum(stream, weights.
data(), weights.
size());
 
  212                                        : dispatch->reduceSum(stream, weightsSumW2.
data(), weightsSumW2.
size());
 
  218   if (nllOut.nLargeValues > 0) {
 
  220                            << 
") WARNING: top-level pdf has unexpectedly large values" << std::endl;
 
  222   for (std::size_t i = 0; i < nllOut.nNonPositiveValues; ++i) {
 
  225   for (std::size_t i = 0; i < nllOut.nNaNValues; ++i) {
 
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 result
 
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
 
RooTemplateProxy< RooAbsReal > _binVolumeVar
 
RooTemplateProxy< RooAbsReal > _weightVar
 
void enableOffsetting(bool) override
 
void computeBatch(cudaStream_t *, double *output, size_t nOut, RooFit::Detail::DataMap const &) const override
Compute multiple negative logs of propabilities.
 
void applyWeightSquared(bool flag) override
Toggles the weight square correction.
 
void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override
 
ROOT::Math::KahanSum< double > _offset
! Offset as KahanSum to avoid loss of precision
 
void setPrefix(std::string const &prefix)
Sets the prefix for the special variables of this NLL, like weights or bin volumes.
 
void fillBinWidthsFromPdfBoundaries(RooAbsReal const &pdf, RooArgSet const &observables)
 
RooTemplateProxy< RooAbsPdf > _pdf
 
void resetWeightVarNames()
 
void enableBinOffsetting(bool on=true)
 
RooTemplateProxy< RooAbsReal > _weightSquaredVar
 
std::unique_ptr< RooTemplateProxy< RooAbsReal > > _expectedEvents
 
double computeBatchBinnedL(RooSpan< const double > preds, RooSpan< const double > weights) const
 
std::vector< double > _binw
 
static constexpr const char * weightVarName
 
double finalizeResult(ROOT::Math::KahanSum< double > result, double weightSum) const
 
static constexpr const char * weightVarNameSumW2
 
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
 
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
 
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'.
 
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
 
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
 
Storage_t::size_type size() const
 
RooAbsArg * first() const
 
virtual std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const
Returns an object that represents the expected number of events for a given normalization set,...
 
double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0, bool doOffset=false) const
 
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
 
virtual std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
 
void logEvalError(const char *message, const char *serverValueString=nullptr) const
Log evaluation error message.
 
RooArgList is a container object that can hold multiple RooAbsArg objects.
 
RooArgSet is a container object that can hold multiple RooAbsArg objects.
 
RooConstVar represent a constant real-valued object.
 
RooSpan< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
 
RooRealVar represents a variable that can be changed from the outside.
 
A simple container to hold a batch of data values.
 
constexpr std::size_t size() const noexcept
 
constexpr std::span< T >::pointer data() const
 
const char * GetName() const override
Returns name of object.
 
R__EXTERN RooBatchComputeInterface * dispatchCUDA
 
R__EXTERN RooBatchComputeInterface * dispatchCPU
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
 
OffsetMode
For setting the offset mode with the Offset() command argument to RooAbsPdf::fitTo()
 
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.