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
15/**
16 * \class RooNormalizedPdf
17 *
18 * A RooNormalizedPdf wraps a pdf divided by its integral for a given
19 * normalization set into a new self-normalized pdf.
20 */
21
22void RooNormalizedPdf::computeBatch(cudaStream_t * /*stream*/, double *output, size_t nEvents,
23 RooFit::Detail::DataMap const& dataMap) const
24{
25 auto nums = dataMap.at(_pdf);
26 auto integralSpan = dataMap.at(_normIntegral);
27
28 if (integralSpan.size() == 1) {
29 for (std::size_t i = 0; i < nEvents; ++i) {
30 output[i] = normalizeWithNaNPacking(nums[i], integralSpan[0]);
31 }
32 } else {
33 assert(integralSpan.size() == nEvents);
34 for (std::size_t i = 0; i < nEvents; ++i) {
35 output[i] = normalizeWithNaNPacking(nums[i], integralSpan[i]);
36 }
37 }
38}
double normalizeWithNaNPacking(double rawVal, double normVal) const
auto & at(RooAbsArg const *arg, RooAbsArg const *=nullptr)
Definition DataMap.h:88
RooRealProxy _normIntegral
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
static void output(int code)
Definition gifencode.c:226