ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id: RooRealSumPdf.h,v 1.10 2007/05/11 09:11:30 verkerke Exp $
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/
#ifndef ROO_REAL_SUM_PDF
#define ROO_REAL_SUM_PDF

#include "RooAbsPdf.h"
#include "RooListProxy.h"
#include "RooAICRegistry.h"
#include "RooObjCacheManager.h"

class RooRealSumPdf : public RooAbsPdf {
public:

  RooRealSumPdf() ;
  RooRealSumPdf(const char *name, const char *title);
  RooRealSumPdf(const char *name, const char *title, const RooArgList& funcList, const RooArgList& coefList, Bool_t extended=kFALSE) ;
  RooRealSumPdf(const char *name, const char *title,
		   RooAbsReal& func1, RooAbsReal& func2, RooAbsReal& coef1) ;
  RooRealSumPdf(const RooRealSumPdf& other, const char* name=0) ;
  virtual TObject* clone(const char* newname) const { return new RooRealSumPdf(*this,newname) ; }
  virtual ~RooRealSumPdf() ;

  Double_t evaluate() const ;
  virtual Bool_t checkObservables(const RooArgSet* nset) const ;	

  virtual Bool_t forceAnalyticalInt(const RooAbsArg&) const { return kTRUE ; }
  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;

  const RooArgList& funcList() const { return _funcList ; }
  const RooArgList& coefList() const { return _coefList ; }

  virtual ExtendMode extendMode() const ; 

  virtual Double_t expectedEvents(const RooArgSet* nset) const ;
  virtual Double_t expectedEvents(const RooArgSet& nset) const { 
    // Return expected number of events for extended likelihood calculation
    // which is the sum of all coefficients
    return expectedEvents(&nset) ; 
  }

  void printMetaArgs(ostream& os) const ;

protected:
  
  class CacheElem : public RooAbsCacheElement {
  public:
    CacheElem()  {} ;
    virtual ~CacheElem() {} ; 
    virtual RooArgList containedArgs(Action) { RooArgList ret(_funcIntList) ; ret.add(_funcNormList) ; return ret ; }
    RooArgList _funcIntList ;
    RooArgList _funcNormList ;
  } ;
  mutable RooObjCacheManager _normIntMgr ; // The integration cache manager

  Bool_t _haveLastCoef ;

  RooListProxy _funcList ;   //  List of component FUNCs
  RooListProxy _coefList ;  //  List of coefficients
  TIterator* _funcIter ;     //! Iterator over FUNC list
  TIterator* _coefIter ;    //! Iterator over coefficient list
  Bool_t _extended ;        // Allow use as extended p.d.f.
  
private:

  ClassDef(RooRealSumPdf,2) // PDF constructed from a sum of (non-pdf) functions
};

#endif
 RooRealSumPdf.h:1
 RooRealSumPdf.h:2
 RooRealSumPdf.h:3
 RooRealSumPdf.h:4
 RooRealSumPdf.h:5
 RooRealSumPdf.h:6
 RooRealSumPdf.h:7
 RooRealSumPdf.h:8
 RooRealSumPdf.h:9
 RooRealSumPdf.h:10
 RooRealSumPdf.h:11
 RooRealSumPdf.h:12
 RooRealSumPdf.h:13
 RooRealSumPdf.h:14
 RooRealSumPdf.h:15
 RooRealSumPdf.h:16
 RooRealSumPdf.h:17
 RooRealSumPdf.h:18
 RooRealSumPdf.h:19
 RooRealSumPdf.h:20
 RooRealSumPdf.h:21
 RooRealSumPdf.h:22
 RooRealSumPdf.h:23
 RooRealSumPdf.h:24
 RooRealSumPdf.h:25
 RooRealSumPdf.h:26
 RooRealSumPdf.h:27
 RooRealSumPdf.h:28
 RooRealSumPdf.h:29
 RooRealSumPdf.h:30
 RooRealSumPdf.h:31
 RooRealSumPdf.h:32
 RooRealSumPdf.h:33
 RooRealSumPdf.h:34
 RooRealSumPdf.h:35
 RooRealSumPdf.h:36
 RooRealSumPdf.h:37
 RooRealSumPdf.h:38
 RooRealSumPdf.h:39
 RooRealSumPdf.h:40
 RooRealSumPdf.h:41
 RooRealSumPdf.h:42
 RooRealSumPdf.h:43
 RooRealSumPdf.h:44
 RooRealSumPdf.h:45
 RooRealSumPdf.h:46
 RooRealSumPdf.h:47
 RooRealSumPdf.h:48
 RooRealSumPdf.h:49
 RooRealSumPdf.h:50
 RooRealSumPdf.h:51
 RooRealSumPdf.h:52
 RooRealSumPdf.h:53
 RooRealSumPdf.h:54
 RooRealSumPdf.h:55
 RooRealSumPdf.h:56
 RooRealSumPdf.h:57
 RooRealSumPdf.h:58
 RooRealSumPdf.h:59
 RooRealSumPdf.h:60
 RooRealSumPdf.h:61
 RooRealSumPdf.h:62
 RooRealSumPdf.h:63
 RooRealSumPdf.h:64
 RooRealSumPdf.h:65
 RooRealSumPdf.h:66
 RooRealSumPdf.h:67
 RooRealSumPdf.h:68
 RooRealSumPdf.h:69
 RooRealSumPdf.h:70
 RooRealSumPdf.h:71
 RooRealSumPdf.h:72
 RooRealSumPdf.h:73
 RooRealSumPdf.h:74
 RooRealSumPdf.h:75
 RooRealSumPdf.h:76
 RooRealSumPdf.h:77
 RooRealSumPdf.h:78
 RooRealSumPdf.h:79
 RooRealSumPdf.h:80
 RooRealSumPdf.h:81
 RooRealSumPdf.h:82