Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooNormalizedPdf.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Jonas Rembser, CERN 2022
5 *
6 * Copyright (c) 2022, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#include "RooNormalizedPdf.h"
14#include "RooBatchCompute.h"
15
16/**
17 * \class RooNormalizedPdf
18 *
19 * A RooNormalizedPdf wraps a pdf divided by its integral for a given
20 * normalization set into a new self-normalized pdf.
21 */
22
23void RooNormalizedPdf::computeBatch(cudaStream_t *stream, double *output, size_t nEvents,
24 RooFit::Detail::DataMap const &dataMap) const
25{
26 auto nums = dataMap.at(_pdf);
27 auto integralSpan = dataMap.at(_normIntegral);
28
29 // We use the extraArgs as output parameter to count evaluation errors.
30 RooBatchCompute::ArgVector extraArgs{0.0, 0.0, 0.0};
31
33 dispatch->compute(stream, RooBatchCompute::NormalizedPdf, output, nEvents, {nums, integralSpan}, extraArgs);
34
35 std::size_t nEvalErrorsType0 = extraArgs[0];
36 std::size_t nEvalErrorsType1 = extraArgs[1];
37 std::size_t nEvalErrorsType2 = extraArgs[2];
38
39 for (std::size_t i = 0; i < nEvalErrorsType0; ++i) {
40 logEvalError("p.d.f normalization integral is zero or negative");
41 }
42 for (std::size_t i = 0; i < nEvalErrorsType1; ++i) {
43 logEvalError("p.d.f value is less than zero, trying to recover");
44 }
45 for (std::size_t i = 0; i < nEvalErrorsType2; ++i) {
46 logEvalError("p.d.f value is Not-a-Number");
47 }
48}
void logEvalError(const char *message, const char *serverValueString=nullptr) const
Log evaluation error message.
virtual void compute(cudaStream_t *, Computer, RestrictArr, size_t, const VarVector &, ArgVector &)=0
RooSpan< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
Definition DataMap.cxx:21
RooRealProxy _normIntegral
RooTemplateProxy< RooAbsPdf > _pdf
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
R__EXTERN RooBatchComputeInterface * dispatchCUDA
R__EXTERN RooBatchComputeInterface * dispatchCPU
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
std::vector< double > ArgVector
static void output()