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 inline ~RooProjectedPdf() override { }
29
30 // Analytical integration support
31 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
32 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
33 bool forceAnalyticalInt(const RooAbsArg& dep) const override ;
34
35 void initGenerator(Int_t /*code*/) override {} ; // optional pre-generation initialization
36
37 bool selfNormalized() const override { return true ; }
38
39 // Handle projection of projection explicitly
40 RooAbsPdf* createProjection(const RooArgSet& iset) override ;
41
42 void printMetaArgs(std::ostream& os) const override ;
43
44 std::unique_ptr<RooAbsArg> compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override;
45
46 // Handle case of projecting an Extended pdf
47 double expectedEvents(const RooArgSet* nset) const override { return static_cast<RooAbsPdf*>(intpdf.absArg())->expectedEvents(nset); }
48 ExtendMode extendMode() const override { return static_cast<RooAbsPdf*>(intpdf.absArg())->extendMode(); }
49
50
51protected:
52
53 RooRealProxy intpdf ; ///< p.d.f that is integrated
54 RooSetProxy intobs ; ///< observables that p.d.f is integrated over
55 RooSetProxy deps ; ///< dependents of this p.d.f
56
58 public:
59 // Payload
60 std::unique_ptr<RooAbsReal> _projection;
61 // Cache management functions
63 void printCompactTreeHook(std::ostream&, const char *, Int_t, Int_t) override ;
64 } ;
65 mutable RooObjCacheManager _cacheMgr ; ///<! The cache manager
66
67 bool redirectServersHook(const RooAbsCollection& newServerList, bool /*mustReplaceAll*/, bool /*nameChange*/, bool /*isRecursive*/) override ;
68
69 const RooAbsReal* getProjection(const RooArgSet* iset, const RooArgSet* nset, const char* rangeName, int& code) const ;
70 double evaluate() const override ;
71
72private:
73
74 ClassDefOverride(RooProjectedPdf,1) // Operator p.d.f calculating projection of another p.d.f
75};
76
77#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:74
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:62
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:47
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
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
Class RooProjectedPdf is a RooAbsPdf implementation that represent a projection of a given input p....
~RooProjectedPdf() override
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