Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
28
29////////////////////////////////////////////////////////////////////////////////
30/// Constructs the product of the PDF `inPdf` with the efficiency function
31/// `inEff`.
32
33RooEffProd::RooEffProd(const char *name, const char *title,
34 RooAbsPdf& inPdf, RooAbsReal& inEff) :
35 RooAbsPdf(name,title),
36 _pdf("pdf","pre-efficiency pdf", this,inPdf),
37 _eff("eff","efficiency function",this,inEff)
38{
39}
40
41
42////////////////////////////////////////////////////////////////////////////////
43/// Copy constructor
44
45RooEffProd::RooEffProd(const RooEffProd& other, const char* name) :
46 RooAbsPdf(other, name),
47 _pdf("pdf",this,other._pdf),
48 _eff("acc",this,other._eff)
49{
50}
51
52
53////////////////////////////////////////////////////////////////////////////////
54/// Calculate and return 'raw' unnormalized value of p.d.f
55
57{
59}
60
61
62////////////////////////////////////////////////////////////////////////////////
63/// Return specialized generator context for RooEffProds that implements generation
64/// in a more efficient way than can be done for generic correlated products
65
67 const RooArgSet* auxProto, bool verbose) const
68{
69 return new RooEffGenContext(*this,
70 static_cast<RooAbsPdf const&>(_pdf.arg()),
71 static_cast<RooAbsReal const&>(_eff.arg()),
72 vars,prototype,auxProto,verbose) ;
73}
74
76{
77 ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::effProd", _eff, _pdf));
78}
char name[80]
Definition TGX11.cxx:110
Abstract base class for generator contexts of RooAbsPdf objects.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Container class to hold unbinned data.
Definition RooDataSet.h:57
Specialized generator context for p.d.fs represented by class RooEffProd, which are p....
The class RooEffProd implements the product of a PDF with an efficiency function.
Definition RooEffProd.h:19
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
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...
RooRealProxy _pdf
Probability Density function.
Definition RooEffProd.h:38
RooRealProxy _eff
Efficiency function.
Definition RooEffProd.h:39
double evaluate() const override
Calculate and return 'raw' unnormalized value of p.d.f.
A class to maintain the context for squashing of RooFit models into code.
std::string buildCall(std::string const &funcname, Args_t const &...args)
Build the code to call the function with name funcname, passing some arguments.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
const T & arg() const
Return reference to object held in proxy.
double effProd(double eff, double pdf)
Definition MathFuncs.h:316