Logo ROOT  
Reference Guide
Go to the documentation of this file.
1 /*****************************************************************************
2 * Project: RooFit *
3 * *
4 * Simple Poisson PDF
5 * author: Kyle Cranmer <cranmer@cern.ch>
6 * *
7 *****************************************************************************/
10#define ROOPOISSON
12#include "RooAbsPdf.h"
13#include "RooRealProxy.h"
14#include "RooCategoryProxy.h"
15#include "RooAbsReal.h"
16#include "RooAbsCategory.h"
17#include "RooTrace.h"
19class RooPoisson : public RooAbsPdf {
21 RooPoisson() { _noRounding = false ; } ;
22 RooPoisson(const char *name, const char *title, RooAbsReal& _x, RooAbsReal& _mean, bool noRounding=false);
23 RooPoisson(const RooPoisson& other, const char* name=nullptr) ;
24 TObject* clone(const char* newname) const override { return new RooPoisson(*this,newname); }
25 inline ~RooPoisson() override { }
27 Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=nullptr) const override;
28 double analyticalIntegral(Int_t code, const char* rangeName=nullptr) const override;
30 Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const override;
31 void generateEvent(Int_t code) override;
33 /// Switch off/on rounding of `x` to the nearest integer.
34 void setNoRounding(bool flag = true) {_noRounding = flag;}
35 /// Switch on or off protection against negative means.
36 void protectNegativeMean(bool flag = true) {_protectNegative = flag;}
38 /// Get the x variable.
39 RooAbsReal const& getX() const { return x.arg(); }
41 /// Get the mean parameter.
42 RooAbsReal const& getMean() const { return mean.arg(); }
49 bool _protectNegative{true};
51 double evaluate() const override;
52 void computeBatch(cudaStream_t*, double* output, size_t nEvents, RooFit::Detail::DataMap const&) const override;
53 inline bool canComputeBatchWithCuda() const override { return true; }
55 ClassDefOverride(RooPoisson,3) // A Poisson PDF
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
char name[80]
Definition: TGX11.cxx:110
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
Poisson pdf.
Definition: RooPoisson.h:19
RooRealProxy x
Definition: RooPoisson.h:46
void computeBatch(cudaStream_t *, double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Compute multiple values of the Poisson distribution.
Definition: RooPoisson.cxx:67
bool _noRounding
Definition: RooPoisson.h:48
bool canComputeBatchWithCuda() const override
Definition: RooPoisson.h:53
RooAbsReal const & getX() const
Get the x variable.
Definition: RooPoisson.h:39
~RooPoisson() override
Definition: RooPoisson.h:25
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Definition: RooPoisson.cxx:86
bool _protectNegative
Definition: RooPoisson.h:49
void setNoRounding(bool flag=true)
Switch off/on rounding of x to the nearest integer.
Definition: RooPoisson.h:34
void generateEvent(Int_t code) override
Implement internal generator using TRandom::Poisson.
Definition: RooPoisson.cxx:160
void protectNegativeMean(bool flag=true)
Switch on or off protection against negative means.
Definition: RooPoisson.h:36
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const override
Advertise internal generator in x.
Definition: RooPoisson.cxx:151
TObject * clone(const char *newname) const override
Definition: RooPoisson.h:24
double evaluate() const override
Implementation in terms of the TMath::Poisson() function.
Definition: RooPoisson.cxx:54
RooRealProxy mean
Definition: RooPoisson.h:47
RooAbsReal const & getMean() const
Get the mean parameter.
Definition: RooPoisson.h:42
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Definition: RooPoisson.cxx:77
const T & arg() const
Return reference to object held in proxy.
Mother of all ROOT objects.
Definition: TObject.h:41
static void output()