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 "RooNameSet.h"
25#include "RooObjCacheManager.h"
26
28public:
29
30 RooAddModel() ;
31 RooAddModel(const char *name, const char *title, const RooArgList& pdfList, const RooArgList& coefList, Bool_t ownPdfList=kFALSE) ;
32 RooAddModel(const RooAddModel& other, const char* name=0) ;
33 virtual TObject* clone(const char* newname) const { return new RooAddModel(*this,newname) ; }
35 virtual ~RooAddModel() ;
36
37 Double_t evaluate() const ;
38 virtual Bool_t checkObservables(const RooArgSet* nset) const ;
39
40 virtual Int_t basisCode(const char* name) const ;
41
42 virtual Bool_t forceAnalyticalInt(const RooAbsArg& /*dep*/) const {
43 // Force RooRealIntegral to offer all observables for internal integration
44 return kTRUE ;
45 }
46 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
47 Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
48 virtual Bool_t selfNormalized() const {
49 // Model is self normalized when used as p.d.f
50 return _basisCode==0 ? kTRUE : kFALSE ;
51 }
52
53 virtual ExtendMode extendMode() const {
54 // Return extended mode capabilities
56 }
57 virtual Double_t expectedEvents(const RooArgSet* nset) const ;
58 virtual Double_t expectedEvents(const RooArgSet& nset) const {
59 // Return expected number of events for extended likelihood calculation
60 // which is the sum of all coefficients
61 return expectedEvents(&nset) ;
62 }
63
64 const RooArgList& pdfList() const {
65 // Return list of component p.d.fs
66 return _pdfList ;
67 }
68 const RooArgList& coefList() const {
69 // Return list of coefficients of component p.d.f.s
70 return _coefList ;
71 }
72
73 Bool_t isDirectGenSafe(const RooAbsArg& arg) const ;
74
75 Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
76 void generateEvent(Int_t code);
77
78
79 void fixCoefNormalization(const RooArgSet& refCoefNorm) ;
80 void fixCoefRange(const char* rangeName) ;
81 virtual void resetErrorCounters(Int_t resetValue=10) ;
82
83 void printMetaArgs(std::ostream& os) const ;
84
85protected:
86
87 friend class RooAddGenContext ;
88 virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=0,
89 const RooArgSet* auxProto=0, Bool_t verbose= kFALSE) const ;
90
91 virtual void selectNormalization(const RooArgSet* depSet=0, Bool_t force=kFALSE) ;
92 virtual void selectNormalizationRange(const char* rangeName=0, Bool_t force=kFALSE) ;
93
94 mutable RooSetProxy _refCoefNorm ; //! Reference observable set for coefficient interpretation
95 mutable TNamed* _refCoefRangeName ; //! Reference range name for coefficient interpreation
96
97 Bool_t _projectCoefs ; // If true coefficients need to be projected for use in evaluate()
98 mutable Double_t* _coefCache ; //! Transiet cache with transformed values of coefficients
99
100
102 public:
103 virtual ~CacheElem() {} ;
104
105 RooArgList _suppNormList ; // Supplemental normalization list
106
107 RooArgList _projList ; // Projection integrals to be multiplied with coefficients
108 RooArgList _suppProjList ; // Projection integrals to be multiplied with coefficients for supplemental normalization terms
109 RooArgList _refRangeProjList ; // Range integrals to be multiplied with coefficients (reference range)
110 RooArgList _rangeProjList ; // Range integrals to be multiplied with coefficients (target range)
111
113
114 } ;
115 mutable RooObjCacheManager _projCacheMgr ; // Manager of cache with coefficient projections and transformations
116 CacheElem* getProjCache(const RooArgSet* nset, const RooArgSet* iset=0, const char* rangeName=0) const ;
117 void updateCoefficients(CacheElem& cache, const RooArgSet* nset) const ;
118
120 void getCompIntList(const RooArgSet* nset, const RooArgSet* iset, pRooArgList& compIntList, Int_t& code, const char* isetRangeName) const ;
122 public:
123 virtual ~IntCacheElem() {} ;
124 RooArgList _intList ; // List of component integrals
126 } ;
127
128 mutable RooObjCacheManager _intCacheMgr ; // Manager of cache with integrals
129
130 mutable RooAICRegistry _codeReg ; //! Registry of component analytical integration codes
131
132 RooListProxy _pdfList ; // List of component PDFs
133 RooListProxy _coefList ; // List of coefficients
134 mutable RooArgList* _snormList{nullptr}; //! List of supplemental normalization factors
135
136 Bool_t _haveLastCoef ; // Flag indicating if last PDFs coefficient was supplied in the ctor
137 Bool_t _allExtendable ; // Flag indicating if all PDF components are extendable
138
139 mutable Int_t _coefErrCount ; //! Coefficient error counter
140
141 mutable RooArgSet _ownedComps ; //! Owned components
142
143private:
144
145 ClassDef(RooAddModel,1) // Resolution model representing a sum of resolution models
146};
147
148#endif
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#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:72
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:232
@ CanNotBeExtended
Definition RooAbsPdf.h:232
RooAddGenContext is an efficient implementation of the generator context specific for RooAddPdf PDFs.
Transiet cache with transformed values of coefficients.
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:27
Double_t evaluate() const
Calculate the current value.
virtual Double_t expectedEvents(const RooArgSet &nset) const
Return expected number of events to be used in calculation of extended likelihood.
Definition RooAddModel.h:58
RooAICRegistry _codeReg
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
Retrieve cache element with for calculation of p.d.f value with normalization set nset and integrated...
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:64
RooSetProxy _refCoefNorm
Definition RooAddModel.h:94
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:42
RooArgSet _ownedComps
Coefficient error counter.
virtual ~RooAddModel()
Destructor.
const RooArgList & coefList() const
Definition RooAddModel.h:68
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 the number of expected events, which is either the sum of all coefficients or the sum of the c...
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:97
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:95
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:33
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:53
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:48
Double_t * _coefCache
Definition RooAddModel.h:98
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:33
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:37