library: libRooFit #include "RooProdPdf.h"

# RooProdPdf

class description - source file - inheritance tree (.pdf)

## class RooProdPdf : public RooAbsPdf

| Inheritance Chart:
`TObject`
| <- | `TNamed`
`RooPrintable`
| <- | `RooAbsArg`
| <- | `RooAbsReal`
| <- | `RooAbsPdf`
| <- | `RooProdPdf` |

        protected:

                           Double_t calculate(const RooArgList* partIntList, const RooLinkedList* normSetList) const
                               void clearCache()
                               void factorizeProduct(const RooArgSet& normSet, const RooArgSet& intSet, RooLinkedList& termList, RooLinkedList& normList, RooLinkedList& impDepList, RooLinkedList& crossDepList, RooLinkedList& intList) const
                         RooArgSet* findPdfNSet(RooAbsPdf& pdf) const
          virtual RooAbsGenContext* genContext(const RooArgSet& vars, const RooDataSet* prototype = 0, const RooArgSet* auxProto = 0, Bool_t verbose = kFALSE) const
                               void getPartIntList(const RooArgSet* nset, const RooArgSet* iset, RooArgList*& partList, RooLinkedList*& nsetList, Int_t& code, const char* isetRangeName = "0") const
                               void groupProductTerms(RooLinkedList& groupedTerms, RooArgSet& outerIntDeps, const RooLinkedList& terms, const RooLinkedList& norms, const RooLinkedList& imps, const RooLinkedList& ints, const RooLinkedList& cross) const
                               void initializeFromCmdArgList(const RooArgSet& fullPdfSet, const RooLinkedList& l)
                        const char* makeRGPPName(const char* pfx, const RooArgSet& term, const RooArgSet& iset, const RooArgSet& nset, const char* isetRangeName) const
                       virtual void operModeHook()
                       virtual void printCompactTreeHook(ostream& os, const char* indent = "")
                        RooAbsReal* processProductTerm(const RooArgSet* nset, const RooArgSet* iset, const char* isetRangeName, const RooArgSet* term, const RooArgSet& termNSet, const RooArgSet& termISet, Bool_t& isOwned, Bool_t forceWrap = kFALSE) const
                     virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
                               void useDefaultGen(Bool_t flag = kTRUE)

        public:

                                        RooProdPdf(const char* name, const char* title, Double_t cutOff = 0)
                                        RooProdPdf(const char* name, const char* title, RooAbsPdf& pdf1, RooAbsPdf& pdf2, Double_t cutOff = 0)
                                        RooProdPdf(const char* name, const char* title, const RooArgList& pdfList, Double_t cutOff = 0)
                                        RooProdPdf(const char* name, const char* title, const RooArgSet& fullPdfSet, const RooLinkedList& cmdArgList)
                                        RooProdPdf(const char* name, const char* title, const RooArgSet& fullPdfSet, const RooCmdArg& arg1, const RooCmdArg& arg2 = RooCmdArg(), const RooCmdArg& arg3 = RooCmdArg(), const RooCmdArg& arg4 = RooCmdArg(), const RooCmdArg& arg5 = RooCmdArg(), const RooCmdArg& arg6 = RooCmdArg(), const RooCmdArg& arg7 = RooCmdArg(), const RooCmdArg& arg8 = RooCmdArg())
                                        RooProdPdf(const RooProdPdf& other, const char* name = "0")
                                virtual ~RooProdPdf()
                       virtual Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName = "0") const
                         virtual Bool_t checkObservables(const RooArgSet* nset) const
                         static TClass* Class()
                       virtual TObject* clone(const char* newname) const
                       virtual Double_t evaluate() const
                       virtual Double_t expectedEvents(const RooArgSet* nset = 0) const
          virtual RooAbsPdf::ExtendMode extendMode() const
                         virtual Bool_t forceAnalyticalInt(const RooAbsArg& dep) const
                           virtual void generateEvent(Int_t code)
                          virtual Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName = "0") const
                          virtual Int_t getGenerator(const RooArgSet& directVars, RooArgSet& generateVars, Bool_t staticInitOK = kTRUE) const
                       virtual Double_t getVal(const RooArgSet* set = 0) const
                           virtual void initGenerator(Int_t code)
                        virtual TClass* IsA() const
                         virtual Bool_t isDirectGenSafe(const RooAbsArg& arg) const
                      const RooArgList& pdfList() const
                         virtual Bool_t selfNormalized() const
                           virtual void ShowMembers(TMemberInspector& insp, char* parent)
                           virtual void Streamer(TBuffer& b)
                                   void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          RooNormListManager _partListMgr            Partial integral list manager
          RooNormListManager _partOwnedListMgr       Partial integral list manager for owned components
               RooLinkedList _partNormListCache[10]  Cache of normalization lists
              RooAICRegistry _genCode                Registry of composite direct generator codes
                  RooArgSet* _curNormSet             !
                    Double_t _cutOff                 Cutoff parameter for running product
                RooListProxy _pdfList                List of PDF components
               RooLinkedList _pdfNSetList            List of PDF component normalization sets
                  TIterator* _pdfIter                ! Iterator of PDF list
                       Int_t _extendedIndex          Index of extended PDF (if any)
                      Bool_t _useDefaultGen          Use default or distributed event generator

## Class Description

RooProdPdf(const char *name, const char *title, Double_t cutOff) : RooAbsPdf(name,title), _partListMgr(10), _partOwnedListMgr(10), _genCode(10), _cutOff(cutOff), _pdfList("_pdfList","List of PDFs",this), _extendedIndex(-1), _useDefaultGen(kFALSE)

     Dummy constructor

RooProdPdf(const char *name, const char *title, RooAbsPdf& pdf1, RooAbsPdf& pdf2, Double_t cutOff) : RooAbsPdf(name,title), _partListMgr(10), _partOwnedListMgr(10), _genCode(10), _cutOff(cutOff), _pdfList("_pdfList","List of PDFs",this), _pdfIter(_pdfList.createIterator()), _extendedIndex(-1), _useDefaultGen(kFALSE)

     Constructor with 2 PDFs (most frequent use case).

     The optional cutOff parameter can be used as a speed optimization if
     one or more of the PDF have sizable regions with very small values,
     which would pull the entire product of PDFs to zero in those regions.

     After each PDF multiplication, the running product is compared with
     the cutOff parameter. If the running product is smaller than the
     cutOff value, the product series is terminated and remaining PDFs
     are not evaluated.

     There is no magic value of the cutOff, the user should experiment
     to find the appropriate balance between speed and precision.
     If a cutoff is specified, the PDFs most likely to be small should
     be put first in the product. The default cutOff value is zero.

RooProdPdf(const char* name, const char* title, const RooArgList& pdfList, Double_t cutOff) : RooAbsPdf(name,title), _partListMgr(10), _partOwnedListMgr(10), _genCode(10), _cutOff(cutOff), _pdfList("_pdfList","List of PDFs",this), _pdfIter(_pdfList.createIterator()), _extendedIndex(-1), _useDefaultGen(kFALSE)

     Constructor from a list of PDFs

     The optional cutOff parameter can be used as a speed optimization if
     one or more of the PDF have sizable regions with very small values,
     which would pull the entire product of PDFs to zero in those regions.

     After each PDF multiplication, the running product is compared with
     the cutOff parameter. If the running product is smaller than the
     cutOff value, the product series is terminated and remaining PDFs
     are not evaluated.

     There is no magic value of the cutOff, the user should experiment
     to find the appropriate balance between speed and precision.
     If a cutoff is specified, the PDFs most likely to be small should
     be put first in the product. The default cutOff value is zero.

RooProdPdf(const char* name, const char* title, const RooArgSet& fullPdfSet, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8) : RooAbsPdf(name,title), _partListMgr(10), _partOwnedListMgr(10), _genCode(10), _cutOff(0), _pdfList("_pdfList","List of PDFs",this), _pdfIter(_pdfList.createIterator()), _extendedIndex(-1), _useDefaultGen(kFALSE)

     Constructor from named argument list

     fullPdf -- Set of 'regular' PDFS that are normalized over all their observables
     ConditionalPdf(pdfSet,depSet) -- Add PDF to product with condition that it
                                      only be normalized over specified observables
                                      any remaining observables will be conditional
                                      observables

     For example, given a PDF F(x,y) and G(y)

     RooProdPdf("P","P",G,Partial(F,x)) will construct a 2-dimensional PDF as follows:

       P(x,y) = G(y)/Int[y]G(y) * F(x,y)/Int[x]G(x,y)

     which is a well normalized and properly defined PDF, but different from the

      P'(x,y) = F(x,y)*G(y) / Int[x,y] F(x,y)*G(y)

     In the former case the y distribution of P is identical to that of G, while
     F only is used to determine the correlation between X and Y. In the latter
     case the Y distribution is defined by the product of F and G.

     This P(x,y) construction is analoguous to generating events from F(x,y) with
     a prototype dataset sampled from G(y)

RooProdPdf(const char* name, const char* title, const RooArgSet& fullPdfSet, const RooLinkedList& cmdArgList) : RooAbsPdf(name,title), _partListMgr(10), _partOwnedListMgr(10), _genCode(10), _cutOff(0), _pdfList("_pdfList","List of PDFs",this), _pdfIter(_pdfList.createIterator()), _extendedIndex(-1), _useDefaultGen(kFALSE)

       cout << "RooProdPdf::ctor" << endl ;
       cmdArgList.Print("v") ;

RooProdPdf(const RooProdPdf& other, const char* name) : RooAbsPdf(other,name), _partListMgr(other._partListMgr,kTRUE), _partOwnedListMgr(other._partOwnedListMgr,kTRUE), _genCode(other._genCode), _cutOff(other._cutOff), _pdfList("_pdfList",this,other._pdfList), _pdfIter(_pdfList.createIterator()), _extendedIndex(other._extendedIndex), _useDefaultGen(other._useDefaultGen)

     Copy constructor

void initializeFromCmdArgList(const RooArgSet& fullPdfSet, const RooLinkedList& l)

     Initialize RooProdPdf from a list of RooCmdArg configuration arguments

~RooProdPdf()

     Destructor

Double_t getVal(const RooArgSet* set) const

Double_t evaluate() const

     Calculate current unnormalized value of object

Double_t calculate(const RooArgList* partIntList, const RooLinkedList* normSetList) const

     Calculate running product of pdfs, skipping factorized components

void factorizeProduct(const RooArgSet& normSet, const RooArgSet& intSet, RooLinkedList& termList, RooLinkedList& normList, RooLinkedList& impDepList, RooLinkedList& crossDepList, RooLinkedList& intList) const

     Factorize product in irreducible terms for given choice of integration/normalization

void getPartIntList(const RooArgSet* nset, const RooArgSet* iset, pRooArgList& partList, pRooLinkedList& nsetList, Int_t& code, const char* isetRangeName) const

     Check if this configuration was created before

void groupProductTerms(RooLinkedList& groupedTerms, RooArgSet& outerIntDeps, const RooLinkedList& terms, const RooLinkedList& norms, const RooLinkedList& imps, const RooLinkedList& ints, const RooLinkedList& /*cross*/) const

     Start out with each term in its own group

RooAbsReal* processProductTerm(const RooArgSet* nset, const RooArgSet* iset, const char* isetRangeName, const RooArgSet* term,const RooArgSet& termNSet, const RooArgSet& termISet, Bool_t& isOwned, Bool_t forceWrap) const

     CASE I: factorizing term: term is integrated over all normalizing observables
     -----------------------------------------------------------------------------
     Check if all observbales of this term are integrated. If so the term cancels

const char* makeRGPPName(const char* pfx, const RooArgSet& term, const RooArgSet& iset, const RooArgSet& nset, const char* isetRangeName) const

     Make an appropriate name for a RooGenProdProj object in getPartIntList()

Bool_t forceAnalyticalInt(const RooAbsArg& /*dep*/) const

Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName) const

     Determine which part (if any) of given integral can be performed analytically.
     If any analytical integration is possible, return integration scenario code.

     RooProdPdf implements two strategies in implementing analytical integrals

     First, PDF components whose entire set of dependents are requested to be integrated
     can be dropped from the product, as they will integrate out to 1 by construction
    :
     Second, RooProdPdf queries each remaining component PDF for its analytical integration
     capability of the requested set ('allVars'). It finds the largest common set of variables
     that can be integrated by all remaining components. If such a set exists, it reconfirms that
     each component is capable of analytically integrating the common set, and combines the components
     individual integration codes into a single integration code valid for RooProdPdf.

Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName) const

     Return analytical integral defined by given scenario code

Bool_t checkObservables(const RooArgSet* /*nset*/) const

     Check that none of the PDFs have overlapping dependents

RooAbsPdf::ExtendMode extendMode() const

Double_t expectedEvents(const RooArgSet* nset) const

RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype, const RooArgSet* auxProto, Bool_t verbose) const

Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK) const

void initGenerator(Int_t code)

void generateEvent(Int_t code)

void operModeHook()

void clearCache()

       cout << "RooProdPdf::clearCache(" << GetName() << ") sterilizing cache content" << endl ;

Bool_t redirectServersHook(const RooAbsCollection& /*newServerList*/, Bool_t /*mustReplaceAll*/, Bool_t /*nameChange*/, Bool_t /*isRecursive*/)

     Throw away cache, as figuring out redirections on the cache is an unsolvable problem.

void printCompactTreeHook(ostream& os, const char* indent)

Bool_t isDirectGenSafe(const RooAbsArg& arg) const

     Only override base class behaviour if default generator method is enabled

RooArgSet* findPdfNSet(RooAbsPdf& pdf) const

     Look up user specified normalization set for given input PDF component

### Inline Functions

                     TObject* clone(const char* newname) const
                       Bool_t selfNormalized() const
            const RooArgList& pdfList() const
                         void useDefaultGen(Bool_t flag = kTRUE)
                      TClass* Class()
                      TClass* IsA() const
                         void ShowMembers(TMemberInspector& insp, char* parent)
                         void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

Last update: Tue Jun 28 18:14:35 2005
Copyright (c) 2000-2005, Regents of the University of California *