Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooProjectedPdf.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * *
4 * Copyright (c) 2000-2005, Regents of the University of California *
5 * and Stanford University. All rights reserved. *
6 * *
7 * Redistribution and use in source and binary forms, *
8 * with or without modification, are permitted according to the terms *
9 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
10 *****************************************************************************/
11
12#ifndef ROOPROJECTEDPDF
13#define ROOPROJECTEDPDF
14
15#include "RooAbsPdf.h"
16#include "RooRealProxy.h"
17#include "RooAbsReal.h"
18#include "RooObjCacheManager.h"
19#include "RooSetProxy.h"
20
21class RooProjectedPdf : public RooAbsPdf {
22public:
23
25 RooProjectedPdf(const char *name, const char *title, RooAbsReal& _intpdf, const RooArgSet& intObs);
26 RooProjectedPdf(const RooProjectedPdf& other, const char* name=nullptr) ;
27 TObject* clone(const char* newname) const override { return new RooProjectedPdf(*this,newname); }
28
29 // Analytical integration support
30 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
31 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
32 bool forceAnalyticalInt(const RooAbsArg& dep) const override ;
33
34 void initGenerator(Int_t /*code*/) override {} ; // optional pre-generation initialization
35
36 bool selfNormalized() const override { return true ; }
37
38 // Handle projection of projection explicitly
39 RooAbsPdf* createProjection(const RooArgSet& iset) override ;
40
41 void printMetaArgs(std::ostream& os) const override ;
42
43 std::unique_ptr<RooAbsArg> compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override;
44
45 // Handle case of projecting an Extended pdf
46 double expectedEvents(const RooArgSet* nset) const override { return static_cast<RooAbsPdf*>(intpdf.absArg())->expectedEvents(nset); }
47 ExtendMode extendMode() const override { return static_cast<RooAbsPdf*>(intpdf.absArg())->extendMode(); }
48
49
50protected:
51
52 RooRealProxy intpdf ; ///< p.d.f that is integrated
53 RooSetProxy intobs ; ///< observables that p.d.f is integrated over
54 RooSetProxy deps ; ///< dependents of this p.d.f
55
57 public:
58 // Payload
59 std::unique_ptr<RooAbsReal> _projection;
60 // Cache management functions
62 void printCompactTreeHook(std::ostream&, const char *, Int_t, Int_t) override ;
63 } ;
64 mutable RooObjCacheManager _cacheMgr ; ///<! The cache manager
65
66 bool redirectServersHook(const RooAbsCollection& newServerList, bool /*mustReplaceAll*/, bool /*nameChange*/, bool /*isRecursive*/) override ;
67
68 const RooAbsReal* getProjection(const RooArgSet* iset, const RooArgSet* nset, const char* rangeName, int& code) const ;
69 double evaluate() const override ;
70
71private:
72
73 ClassDefOverride(RooProjectedPdf,1) // Operator p.d.f calculating projection of another p.d.f
74};
75
76#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:79
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
Abstract container object that can hold multiple RooAbsArg 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
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooAbsArg * absArg() const
Return pointer to contained argument.
Definition RooArgProxy.h:46
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Implementation of a RooCacheManager<RooAbsCacheElement> that specializes in the storage of cache elem...
RooArgList containedArgs(Action) override
Return RooAbsArg elements contained in projection cache element.
void printCompactTreeHook(std::ostream &, const char *, Int_t, Int_t) override
Print contents of cache when printing self as part of object tree.
std::unique_ptr< RooAbsReal > _projection
A RooAbsPdf implementation that represent a projection of a given input p.d.f and the object returned...
ExtendMode extendMode() const override
Returns ability of PDF to provide extended likelihood terms.
RooRealProxy intpdf
p.d.f that is integrated
bool selfNormalized() const override
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
RooObjCacheManager _cacheMgr
! The cache manager
TObject * clone(const char *newname) const override
double evaluate() const override
Evaluate projected p.d.f.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Return analytical integral represent by appropriate element of projection cache.
bool forceAnalyticalInt(const RooAbsArg &dep) const override
Force RooRealIntegral to relegate integration of all observables to internal logic.
bool redirectServersHook(const RooAbsCollection &newServerList, bool, bool, bool) override
Intercept a server redirection all and update list of dependents if necessary Specifically update the...
RooAbsPdf * createProjection(const RooArgSet &iset) override
Special version of RooAbsReal::createProjection that deals with projections of projections.
double expectedEvents(const RooArgSet *nset) const override
Return expected number of events to be used in calculation of extended likelihood.
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooProjectedPdf()
Default constructor.
void initGenerator(Int_t) override
Interface for one-time initialization to setup the generator for the specified code.
const RooAbsReal * getProjection(const RooArgSet *iset, const RooArgSet *nset, const char *rangeName, int &code) const
Retrieve object representing projection integral of input p.d.f over observables iset,...
RooSetProxy intobs
observables that p.d.f is integrated over
RooSetProxy deps
dependents of this p.d.f
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Mark all requested variables as internally integrated.
Mother of all ROOT objects.
Definition TObject.h:41