Logo ROOT  
Reference Guide
RooEffProd.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, NIKHEF
7 * GR, Gerhard Raven, NIKHEF/VU *
8 * *
9 * Redistribution and use in source and binary forms, *
10 * with or without modification, are permitted according to the terms *
11 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
12 *****************************************************************************/
13
14
15/////////////////////////////////////////////////////////////////////////////////////
16/// \class RooEffProd
17/// The class RooEffProd implements the product of a PDF with an efficiency function.
18/// The normalization integral of the product is calculated numerically, but the
19/// event generation is handled by a specialized generator context that implements
20/// the event generation in a more efficient for cases where the PDF has an internal
21/// generator that is smarter than accept reject.
22///
23
24#include "RooEffProd.h"
25#include "RooEffGenContext.h"
26#include "RooNameReg.h"
27#include "RooRealVar.h"
28
29
30////////////////////////////////////////////////////////////////////////////////
31/// Constructor of a a production of p.d.f inPdf with efficiency
32/// function inEff.
33
34RooEffProd::RooEffProd(const char *name, const char *title,
35 RooAbsPdf& inPdf, RooAbsReal& inEff) :
36 RooAbsPdf(name,title),
37 _pdf("pdf","pre-efficiency pdf", this,inPdf),
38 _eff("eff","efficiency function",this,inEff)
39{
40}
41
42
43////////////////////////////////////////////////////////////////////////////////
44/// Copy constructor
45
46RooEffProd::RooEffProd(const RooEffProd& other, const char* name) :
47 RooAbsPdf(other, name),
48 _pdf("pdf",this,other._pdf),
49 _eff("acc",this,other._eff)
50{
51}
52
53
54////////////////////////////////////////////////////////////////////////////////
55/// Calculate and return 'raw' unnormalized value of p.d.f
56
58{
59 return _eff * _pdf;
60}
61
62
63////////////////////////////////////////////////////////////////////////////////
64/// Return specialized generator context for RooEffProds that implements generation
65/// in a more efficient way than can be done for generic correlated products
66
68 const RooArgSet* auxProto, bool verbose) const
69{
70 return new RooEffGenContext(*this,
71 static_cast<RooAbsPdf const&>(_pdf.arg()),
72 static_cast<RooAbsReal const&>(_eff.arg()),
73 vars,prototype,auxProto,verbose) ;
74}
char name[80]
Definition: TGX11.cxx:110
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
friend class RooEffGenContext
Definition: RooAbsPdf.h:329
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:55
The class RooEffProd implements the product of a PDF with an efficiency function.
Definition: RooEffProd.h:20
RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype, const RooArgSet *auxProto, bool verbose) const override
Return specialized generator context for RooEffProds that implements generation in a more efficient w...
Definition: RooEffProd.cxx:67
RooEffProd(const char *name, const char *title, RooAbsPdf &pdf, RooAbsReal &efficiency)
Constructor of a a production of p.d.f inPdf with efficiency function inEff.
Definition: RooEffProd.cxx:34
RooRealProxy _pdf
Probability Density function.
Definition: RooEffProd.h:36
RooRealProxy _eff
Efficiency function.
Definition: RooEffProd.h:37
double evaluate() const override
Calculate and return 'raw' unnormalized value of p.d.f.
Definition: RooEffProd.cxx:57
const T & arg() const
Return reference to object held in proxy.