library: libRooFit #include "RooAddModel.h"

# RooAddModel

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

## class RooAddModel : public RooResolutionModel

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

        public:

                                      RooAddModel(const char* name, const char* title, const RooArgList& modelList, const RooArgList& coefList)
                                      RooAddModel(const RooAddModel& other, const char* name = "0")
                              virtual ~RooAddModel()
                     virtual Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName = "0") const
                        virtual Int_t basisCode(const char* name) const
                       virtual Bool_t checkObservables(const RooArgSet* nset) const
                       static TClass* Class()
                     virtual TObject* clone(const char* newname) const
          virtual RooResolutionModel* convolution(RooFormulaVar* basis, RooAbsArg* owner) const
                     virtual Double_t evaluate() 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 getNorm(const RooArgSet* nset = 0) const
                         virtual void initGenerator(Int_t code)
                      virtual TClass* IsA() const
                       virtual Bool_t isDirectGenSafe(const RooAbsArg& arg) const
                         virtual void normLeafServerList(RooArgSet& list) const
                       virtual Bool_t selfNormalized() const
                         virtual void ShowMembers(TMemberInspector& insp, char* parent)
                         virtual void Streamer(TBuffer& b)
                                 void StreamerNVirtual(TBuffer& b)
                       virtual Bool_t syncNormalization(const RooArgSet* nset, Bool_t adjustProxies = kTRUE) const

### Data Members

        protected:

          RooNormSetCache _nsetCache       Normalization set cache
           RooAICRegistry _codeReg         ! Registry of component analytical integration codes
           RooAICRegistry _genReg          ! Registry of component generator codes
                Double_t* _genThresh       ! Generator fraction thresholds
             const Int_t* _genSubCode      ! Subgenerator code mapping (owned by _genReg) ;
                   Bool_t _isCopy          Flag set if we own our components
             RooRealProxy _dummyProxy      Dummy proxy to hold current normalization set
                    TList _modelProxyList  List of component resolution models
                    TList _coefProxyList   List of coefficients
               TIterator* _modelProxyIter  ! Iterator over list of models
               TIterator* _coefProxyIter   ! Iterator over list of coefficients

## Class Description

      ADDMODEL = c_1*MODEL_1 + c_2*MODEL_2 + ... (1-sum(c_1...c_n-1))*MODEL_n

     The coefficients c_i weight the component models by their full integral
     (-inf to +inf) over the convolution variable, regardless of the fit limits
     defined in the convolution variable. (the RooAbsAnaConvPdf using the resolution
     model will honour those limits in its own normalization).

     A RooAddModel only supports basis functions that are supported by all its
     components. Each component model must be independent (i.e. not share any
     servers) with its coefficient variable.

     RooAddModel is, like any other RooResolutionModel, also usable as a PDF. When
     used as such, it functions like RooAddPdf but it doesn't support any of its
     extended likelihood configurations.

RooAddModel(const char *name, const char *title, const RooArgList& modelList, const RooArgList& coefList) : RooResolutionModel(name,title,((RooResolutionModel*)modelList.at(0))->convVar()), _nsetCache(10), _codeReg(10), _genReg(10), _genThresh(0), _isCopy(kFALSE), _dummyProxy("dummyProxy","dummy proxy",this,(RooRealVar&)RooRealConstant::value(0)), _modelProxyIter(_modelProxyList.MakeIterator()), _coefProxyIter(_coefProxyList.MakeIterator())

     Constructor from list of PDFs and list of coefficients.
     Each model list element (i) is paired with coefficient list element (i).
     The number of coefficients must be one less than the number of PDFs.

     All modelss must inherit from RooResolutionModel. All
     coefficients must inherit from RooAbsReal

RooAddModel(const RooAddModel& other, const char* name) : RooResolutionModel(other,name), _nsetCache(10), _codeReg(other._codeReg), _genReg(other._genReg), _genThresh(0), _isCopy(kTRUE), _dummyProxy("dummyProxy",this,other._dummyProxy), _modelProxyIter(_modelProxyList.MakeIterator()), _coefProxyIter(_coefProxyList.MakeIterator())

     Copy constructor

~RooAddModel()

     Destructor

RooResolutionModel* convolution(RooFormulaVar* basis, RooAbsArg* owner) const

     Instantiate a clone of this resolution model representing a convolution with given
     basis function. The owners object name is incorporated in the clones name
     to avoid multiple convolution objects with the same name in complex PDF structures.

     RooAddModel will clone all the component models to create a composite convolution object

Int_t basisCode(const char* name) const

     Return code for basis function representing by 'name' string.
     The basis code of the first component model will be returned,
     if the basis is supported by all components. Otherwise 0
     is returned

Double_t evaluate() const

     Calculate current value of object

     MODEL = sum(i=0,n-1) coef_i * model_i + (1 - sum(i=0,n-1) coef_i) * model_n

Double_t getNorm(const RooArgSet* nset) const

     Calculate current normalization of object

     Norm = sum(i=0,n-1) coef_i * norm(model_i) + (1 - sum(i=0,n-1)coef_i) * norm(model_n)

Bool_t checkObservables(const RooArgSet* set) const

     Check if model is valid with dependent configuration given by specified data set
     Each model may not share any dependents with its coefficient

void normLeafServerList(RooArgSet& list) const

     Fill list with leaf server nodes of normalization integral

Bool_t syncNormalization(const RooArgSet* nset, Bool_t adjustProxies) const

     Fan out syncNormalization call to component models

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

     Force analytical integration of all dependents for non-convoluted resolution models

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

     RooAddModel queries each component model for its analytical integration capability of the requested
     set ('allVars'). It finds the largest common set of variables that can be integrated
     by all 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 RooAddModel.

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

     Return analytical integral defined by given scenario code

Bool_t isDirectGenSafe(const RooAbsArg& arg) const

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

     Ask all the components what they can generate

void initGenerator(Int_t code)

     Setup fraction threshold table

void generateEvent(Int_t /*code*/)

     Throw a random number to determine which component to generate

### Inline Functions

               TObject* clone(const char* newname) const
                 Bool_t selfNormalized() const
                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:10:40 2005
Copyright (c) 2000-2005, Regents of the University of California *