Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAddModel.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAddPdf.h,v 1.46 2007/07/12 20:30:28 wouter Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_ADD_MODEL
17#define ROO_ADD_MODEL
18
19#include "RooResolutionModel.h"
20#include "RooListProxy.h"
21#include "RooSetProxy.h"
22#include "RooAICRegistry.h"
23#include "RooNormSetCache.h"
24#include "RooObjCacheManager.h"
25
27public:
28
29 RooAddModel() ;
30 RooAddModel(const char *name, const char *title, const RooArgList& pdfList, const RooArgList& coefList, Bool_t ownPdfList=kFALSE) ;
31 RooAddModel(const RooAddModel& other, const char* name=0) ;
32 virtual TObject* clone(const char* newname) const { return new RooAddModel(*this,newname) ; }
34 virtual ~RooAddModel() ;
35
36 Double_t evaluate() const ;
37 virtual Bool_t checkObservables(const RooArgSet* nset) const ;
38
39 virtual Int_t basisCode(const char* name) const ;
40
41 virtual Bool_t forceAnalyticalInt(const RooAbsArg& /*dep*/) const {
42 // Force RooRealIntegral to offer all observables for internal integration
43 return kTRUE ;
44 }
45 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
46 Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
47 virtual Bool_t selfNormalized() const {
48 // Model is self normalized when used as p.d.f
49 return _basisCode==0 ? kTRUE : kFALSE ;
50 }
51
52 virtual ExtendMode extendMode() const {
53 // Return extended mode capabilities
55 }
56 /// Return expected number of events for extended likelihood calculation, which
57 /// is the sum of all coefficients.
58 virtual Double_t expectedEvents(const RooArgSet* nset) const ;
59
60 const RooArgList& pdfList() const {
61 // Return list of component p.d.fs
62 return _pdfList ;
63 }
64 const RooArgList& coefList() const {
65 // Return list of coefficients of component p.d.f.s
66 return _coefList ;
67 }
68
69 Bool_t isDirectGenSafe(const RooAbsArg& arg) const ;
70
71 Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
72 void generateEvent(Int_t code);
73
74
75 void fixCoefNormalization(const RooArgSet& refCoefNorm) ;
76 void fixCoefRange(const char* rangeName) ;
77 virtual void resetErrorCounters(Int_t resetValue=10) ;
78
79 void printMetaArgs(std::ostream& os) const ;
80
81protected:
82
83 friend class RooAddGenContext ;
84 virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=0,
85 const RooArgSet* auxProto=0, Bool_t verbose= kFALSE) const ;
86
87 virtual void selectNormalization(const RooArgSet* depSet=0, Bool_t force=kFALSE) ;
88 virtual void selectNormalizationRange(const char* rangeName=0, Bool_t force=kFALSE) ;
89
90 mutable RooSetProxy _refCoefNorm ; //! Reference observable set for coefficient interpretation
91 mutable TNamed* _refCoefRangeName ; //! Reference range name for coefficient interpreation
92
93 Bool_t _projectCoefs ; // If true coefficients need to be projected for use in evaluate()
94 mutable Double_t* _coefCache ; //! Transiet cache with transformed values of coefficients
95
96
98 public:
99 virtual ~CacheElem() {} ;
100
101 RooArgList _suppNormList ; // Supplemental normalization list
102
103 RooArgList _projList ; // Projection integrals to be multiplied with coefficients
104 RooArgList _suppProjList ; // Projection integrals to be multiplied with coefficients for supplemental normalization terms
105 RooArgList _refRangeProjList ; // Range integrals to be multiplied with coefficients (reference range)
106 RooArgList _rangeProjList ; // Range integrals to be multiplied with coefficients (target range)
107
109
110 } ;
111 mutable RooObjCacheManager _projCacheMgr ; //! Manager of cache with coefficient projections and transformations
112 CacheElem* getProjCache(const RooArgSet* nset, const RooArgSet* iset=0, const char* rangeName=0) const ;
113 void updateCoefficients(CacheElem& cache, const RooArgSet* nset) const ;
114
116 void getCompIntList(const RooArgSet* nset, const RooArgSet* iset, pRooArgList& compIntList, Int_t& code, const char* isetRangeName) const ;
118 public:
119 virtual ~IntCacheElem() {} ;
120 RooArgList _intList ; // List of component integrals
122 } ;
123
124 mutable RooObjCacheManager _intCacheMgr ; //! Manager of cache with integrals
125
126 mutable RooAICRegistry _codeReg ; //! Registry of component analytical integration codes
127
128 RooListProxy _pdfList ; // List of component PDFs
129 RooListProxy _coefList ; // List of coefficients
130 mutable RooArgList* _snormList{nullptr}; //! List of supplemental normalization factors
131
132 Bool_t _haveLastCoef ; // Flag indicating if last PDFs coefficient was supplied in the ctor
133 Bool_t _allExtendable ; // Flag indicating if all PDF components are extendable
134
135 mutable Int_t _coefErrCount ; //! Coefficient error counter
136
137 mutable RooArgSet _ownedComps ; //! Owned components
138
139private:
140
141 ClassDef(RooAddModel,2) // Resolution model representing a sum of resolution models
142};
143
144#endif
const Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
RooAICRegistry is a utility class for operator p.d.f classes that keeps track of analytical integrati...
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:69
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
@ MustBeExtended
Definition RooAbsPdf.h:256
@ CanNotBeExtended
Definition RooAbsPdf.h:256
RooAddGenContext is an efficient implementation of the generator context specific for RooAddPdf PDFs.
Transiet cache with transformed values of coefficients.
Definition RooAddModel.h:97
RooArgList _refRangeProjList
virtual RooArgList containedArgs(Action)
List all RooAbsArg derived contents in this cache element.
virtual RooArgList containedArgs(Action)
List all RooAbsArg derived contents in this cache element.
RooAddModel is an efficient implementation of a sum of PDFs of the form.
Definition RooAddModel.h:26
Double_t evaluate() const
Calculate the current value.
RooAICRegistry _codeReg
Manager of cache with integrals.
RooArgList * _snormList
RooObjCacheManager _projCacheMgr
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Return analytical integral defined by given scenario code.
CacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=0, const char *rangeName=0) const
Manager of cache with coefficient projections and transformations.
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
Return specialized context to efficiently generate toy events from RooAddModels.
void getCompIntList(const RooArgSet *nset, const RooArgSet *iset, pRooArgList &compIntList, Int_t &code, const char *isetRangeName) const
Check if this configuration was created before.
const RooArgList & pdfList() const
Definition RooAddModel.h:60
RooSetProxy _refCoefNorm
Definition RooAddModel.h:90
virtual RooResolutionModel * convolution(RooFormulaVar *basis, RooAbsArg *owner) const
Instantiate a clone of this resolution model representing a convolution with given basis function.
virtual void selectNormalizationRange(const char *rangeName=0, Bool_t force=kFALSE)
Interface function used by test statistics to freeze choice of range for interpretation of fraction c...
Int_t _coefErrCount
void updateCoefficients(CacheElem &cache, const RooArgSet *nset) const
Update the coefficient values in the given cache element: calculate new remainder fraction,...
virtual Bool_t forceAnalyticalInt(const RooAbsArg &) const
Definition RooAddModel.h:41
RooArgSet _ownedComps
Coefficient error counter.
virtual ~RooAddModel()
Destructor.
const RooArgList & coefList() const
Definition RooAddModel.h:64
virtual void resetErrorCounters(Int_t resetValue=10)
Reset error counter to given value, limiting the number of future error messages for this pdf to 'res...
RooListProxy _coefList
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=0) const
Variant of getAnalyticalIntegral that is also passed the normalization set that should be applied to ...
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events for extended likelihood calculation, which is the sum of all coeffic...
RooListProxy _pdfList
Registry of component analytical integration codes.
RooObjCacheManager _intCacheMgr
void fixCoefNormalization(const RooArgSet &refCoefNorm)
By default the interpretation of the fraction coefficients is performed in the contextual choice of o...
virtual void selectNormalization(const RooArgSet *depSet=0, Bool_t force=kFALSE)
Interface function used by test statistics to freeze choice of observables for interpretation of frac...
void generateEvent(Int_t code)
This function should never be called as RooAddModel implements a custom generator context.
Bool_t _projectCoefs
Reference range name for coefficient interpreation.
Definition RooAddModel.h:93
void fixCoefRange(const char *rangeName)
By default the interpretation of the fraction coefficients is performed in the default range.
TNamed * _refCoefRangeName
Reference observable set for coefficient interpretation.
Definition RooAddModel.h:91
virtual Bool_t checkObservables(const RooArgSet *nset) const
Check if PDF is valid for given normalization set.
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooAddModel to more intuitively reflect the contents of the pro...
RooArgList * pRooArgList
Bool_t _haveLastCoef
List of supplemental normalization factors.
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Return pseud-code that indicates if all components can do internal generation (1) or not (0)
Bool_t isDirectGenSafe(const RooAbsArg &arg) const
Direct generation is safe if all components say so.
Bool_t _allExtendable
virtual TObject * clone(const char *newname) const
Definition RooAddModel.h:32
virtual Int_t basisCode(const char *name) const
Return code for basis function representing by 'name' string.
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
Definition RooAddModel.h:52
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 RooAddModel.h:47
Double_t * _coefCache
Definition RooAddModel.h:94
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:35
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:36
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
RooListProxy is the concrete proxy for RooArgList objects.
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
const RooFormulaVar & basis() const
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition RooSetProxy.h:23
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41