Logo ROOT  
Reference Guide
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 
21 class RooProjectedPdf : public RooAbsPdf {
22 public:
23 
24  RooProjectedPdf() ;
25  RooProjectedPdf(const char *name, const char *title, RooAbsReal& _intpdf, const RooArgSet& intObs);
26  RooProjectedPdf(const RooProjectedPdf& other, const char* name=0) ;
27  virtual TObject* clone(const char* newname) const { return new RooProjectedPdf(*this,newname); }
28  inline virtual ~RooProjectedPdf() { }
29 
30  // Analytical integration support
31  virtual Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName=0) const ;
32  virtual Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
33  virtual Bool_t forceAnalyticalInt(const RooAbsArg& dep) const ;
34 
35  Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
36  void initGenerator(Int_t /*code*/) {} ; // optional pre-generation initialization
37  void generateEvent(Int_t code);
38 
39  virtual Bool_t selfNormalized() const { return kTRUE ; }
40 
41  // Handle projection of projection explicitly
42  virtual RooAbsPdf* createProjection(const RooArgSet& iset) ;
43 
44  void printMetaArgs(std::ostream& os) const ;
45 
46 
47 protected:
48 
49  RooRealProxy intpdf ; // p.d.f that is integrated
50  RooSetProxy intobs ; // observables that p.d.f is integrated over
51  RooSetProxy deps ; // dependents of this p.d.f
52 
53  class CacheElem : public RooAbsCacheElement {
54  public:
55  virtual ~CacheElem() { delete _projection ; } ;
56  // Payload
58  // Cache management functions
59  virtual RooArgList containedArgs(Action) ;
60  virtual void printCompactTreeHook(std::ostream&, const char *, Int_t, Int_t) ;
61  } ;
62  mutable RooObjCacheManager _cacheMgr ; //! The cache manager
63 
64  Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t /*mustReplaceAll*/, Bool_t /*nameChange*/, Bool_t /*isRecursive*/) ;
65 
66  const RooAbsReal* getProjection(const RooArgSet* iset, const RooArgSet* nset, const char* rangeName, int& code) const ;
67  Double_t evaluate() const ;
68 
69 private:
70 
71  ClassDef(RooProjectedPdf,1) // Operator p.d.f calculating projection of another p.d.f
72 };
73 
74 #endif
RooProjectedPdf::getProjection
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,...
Definition: RooProjectedPdf.cxx:108
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsReal.h
RooProjectedPdf::CacheElem::printCompactTreeHook
virtual void printCompactTreeHook(std::ostream &, const char *, Int_t, Int_t)
Print contents of cache when printing self as part of object tree.
Definition: RooProjectedPdf.cxx:301
RooSetProxy
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:23
RooProjectedPdf::createProjection
virtual RooAbsPdf * createProjection(const RooArgSet &iset)
Special version of RooAbsReal::createProjection that deals with projections of projections.
Definition: RooProjectedPdf.cxx:145
RooProjectedPdf::evaluate
Double_t evaluate() const
Evaluate projected p.d.f.
Definition: RooProjectedPdf.cxx:91
RooProjectedPdf::getGenerator
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
No internal generator is implemented.
Definition: RooProjectedPdf.cxx:217
RooProjectedPdf::RooProjectedPdf
RooProjectedPdf()
Default constructor.
Definition: RooProjectedPdf.cxx:48
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooProjectedPdf::CacheElem::containedArgs
virtual RooArgList containedArgs(Action)
Return RooAbsArg elements contained in projection cache element.
Definition: RooProjectedPdf.cxx:273
RooProjectedPdf::~RooProjectedPdf
virtual ~RooProjectedPdf()
Definition: RooProjectedPdf.h:28
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooSetProxy.h
RooAbsCacheElement
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Definition: RooAbsCacheElement.h:26
bool
RooProjectedPdf::generateEvent
void generateEvent(Int_t code)
No internal generator is implemented.
Definition: RooProjectedPdf.cxx:227
RooProjectedPdf::_cacheMgr
RooObjCacheManager _cacheMgr
Definition: RooProjectedPdf.h:62
RooProjectedPdf::getAnalyticalIntegralWN
virtual Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Mark all requested variables as internally integrated.
Definition: RooProjectedPdf.cxx:167
RooAbsPdf.h
RooRealProxy.h
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:31
RooProjectedPdf::forceAnalyticalInt
virtual Bool_t forceAnalyticalInt(const RooAbsArg &dep) const
Force RooRealIntegral to relegate integration of all observables to internal logic.
Definition: RooProjectedPdf.cxx:157
RooProjectedPdf::CacheElem
Definition: RooProjectedPdf.h:53
RooProjectedPdf::deps
RooSetProxy deps
Definition: RooProjectedPdf.h:51
RooObjCacheManager.h
RooProjectedPdf::CacheElem::_projection
RooAbsReal * _projection
Definition: RooProjectedPdf.h:55
RooProjectedPdf::initGenerator
void initGenerator(Int_t)
Interface for one-time initialization to setup the generator for the specified code.
Definition: RooProjectedPdf.h:36
RooTemplateProxy< RooAbsReal >
RooProjectedPdf::printMetaArgs
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
Definition: RooProjectedPdf.cxx:285
Double_t
double Double_t
Definition: RtypesCore.h:59
RooProjectedPdf::clone
virtual TObject * clone(const char *newname) const
Definition: RooProjectedPdf.h:27
RooProjectedPdf::intobs
RooSetProxy intobs
Definition: RooProjectedPdf.h:50
RooObjCacheManager
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
Definition: RooObjCacheManager.h:32
RooAbsCacheElement::Action
Action
Definition: RooAbsCacheElement.h:39
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
RooProjectedPdf::redirectServersHook
Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t, Bool_t, Bool_t)
The cache manager.
Definition: RooProjectedPdf.cxx:239
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooProjectedPdf::intpdf
RooRealProxy intpdf
Definition: RooProjectedPdf.h:49
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsPdf
Definition: RooAbsPdf.h:43
RooProjectedPdf
Class RooProjectedPdf is a RooAbsPdf implementation that represent a projection of a given input p....
Definition: RooProjectedPdf.h:21
RooProjectedPdf::selfNormalized
virtual Bool_t selfNormalized() const
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
Definition: RooProjectedPdf.h:39
RooProjectedPdf::CacheElem::~CacheElem
virtual ~CacheElem()
Definition: RooProjectedPdf.h:55
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
int
RooProjectedPdf::analyticalIntegralWN
virtual Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Return analytical integral represent by appropriate element of projection cache.
Definition: RooProjectedPdf.cxx:185