Logo ROOT  
Reference Guide
RooRealSumPdf.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooRealSumPdf.h,v 1.10 2007/05/11 09:11:30 verkerke 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_REAL_SUM_PDF
17 #define ROO_REAL_SUM_PDF
18 
19 #include "RooAbsPdf.h"
20 #include "RooListProxy.h"
21 #include "RooAICRegistry.h"
22 #include "RooObjCacheManager.h"
23 #include <list>
24 
25 class RooRealSumPdf : public RooAbsPdf {
26 public:
27 
28  RooRealSumPdf() ;
29  RooRealSumPdf(const char *name, const char *title);
30  RooRealSumPdf(const char *name, const char *title, const RooArgList& funcList, const RooArgList& coefList, Bool_t extended=kFALSE) ;
31  RooRealSumPdf(const char *name, const char *title,
32  RooAbsReal& func1, RooAbsReal& func2, RooAbsReal& coef1) ;
33  RooRealSumPdf(const RooRealSumPdf& other, const char* name=0) ;
34  virtual TObject* clone(const char* newname) const { return new RooRealSumPdf(*this,newname) ; }
35  virtual ~RooRealSumPdf() ;
36 
37  Double_t evaluate() const ;
38  virtual Bool_t checkObservables(const RooArgSet* nset) const ;
39 
40  virtual Bool_t forceAnalyticalInt(const RooAbsArg& arg) const { return arg.isFundamental() ; }
41  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
42  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
43 
44  const RooArgList& funcList() const { return _funcList ; }
45  const RooArgList& coefList() const { return _coefList ; }
46 
47  virtual ExtendMode extendMode() const ;
48 
49  virtual Double_t expectedEvents(const RooArgSet* nset) const ;
50  virtual Double_t expectedEvents(const RooArgSet& nset) const {
51  // Return expected number of events for extended likelihood calculation
52  // which is the sum of all coefficients
53  return expectedEvents(&nset) ;
54  }
55 
56  virtual Bool_t selfNormalized() const { return getAttribute("BinnedLikelihoodActive") ; }
57 
58  void printMetaArgs(std::ostream& os) const ;
59 
60 
61  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
62  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
63  Bool_t isBinnedDistribution(const RooArgSet& obs) const ;
64 
65  void setFloor(Bool_t flag) { _doFloor = flag ; }
66  Bool_t getFloor() const { return _doFloor ; }
67  static void setFloorGlobal(Bool_t flag) { _doFloorGlobal = flag ; }
68  static Bool_t getFloorGlobal() { return _doFloorGlobal ; }
69 
70  virtual CacheMode canNodeBeCached() const { return RooAbsArg::NotAdvised ; } ;
71  virtual void setCacheAndTrackHints(RooArgSet&) ;
72 
73 protected:
74 
75  class CacheElem : public RooAbsCacheElement {
76  public:
77  CacheElem() {} ;
78  virtual ~CacheElem() {} ;
79  virtual RooArgList containedArgs(Action) { RooArgList ret(_funcIntList) ; ret.add(_funcNormList) ; return ret ; }
82  } ;
83  mutable RooObjCacheManager _normIntMgr ; // The integration cache manager
84 
85 
86  RooListProxy _funcList ; // List of component FUNCs
87  RooListProxy _coefList ; // List of coefficients
88  Bool_t _extended ; // Allow use as extended p.d.f.
89 
90  Bool_t _doFloor ; // Introduce floor at zero in pdf
91  mutable bool _haveWarned{false}; //!
92  static Bool_t _doFloorGlobal ; // Global flag for introducing floor at zero in pdf
93 
94 private:
95 
96  bool haveLastCoef() const {
97  return _funcList.size() == _coefList.size();
98  }
99 
100  ClassDef(RooRealSumPdf, 4) // PDF constructed from a sum of (non-pdf) functions
101 };
102 
103 #endif
RooRealSumPdf::setFloorGlobal
static void setFloorGlobal(Bool_t flag)
Definition: RooRealSumPdf.h:67
RooRealSumPdf::canNodeBeCached
virtual CacheMode canNodeBeCached() const
Definition: RooRealSumPdf.h:70
RooRealSumPdf::forceAnalyticalInt
virtual Bool_t forceAnalyticalInt(const RooAbsArg &arg) const
Definition: RooRealSumPdf.h:40
RooRealSumPdf::clone
virtual TObject * clone(const char *newname) const
Definition: RooRealSumPdf.h:34
RooRealSumPdf::_doFloor
Bool_t _doFloor
Definition: RooRealSumPdf.h:90
RooRealSumPdf::_extended
Bool_t _extended
Definition: RooRealSumPdf.h:88
RooRealSumPdf::RooRealSumPdf
RooRealSumPdf()
Default constructor coverity[UNINIT_CTOR].
Definition: RooRealSumPdf.cxx:71
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooRealSumPdf::getAnalyticalIntegralWN
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
Definition: RooRealSumPdf.cxx:307
RooRealSumPdf::getFloorGlobal
static Bool_t getFloorGlobal()
Definition: RooRealSumPdf.h:68
RooRealSumPdf::setCacheAndTrackHints
virtual void setCacheAndTrackHints(RooArgSet &)
Label OK'ed components of a RooRealSumPdf with cache-and-track.
Definition: RooRealSumPdf.cxx:581
RooRealSumPdf::extendMode
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
Definition: RooRealSumPdf.cxx:219
RooRealSumPdf::CacheElem
Definition: RooRealSumPdf.h:75
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooRealSumPdf::isBinnedDistribution
Bool_t isBinnedDistribution(const RooArgSet &obs) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: RooRealSumPdf.cxx:512
RooAbsArg::CacheMode
CacheMode
Definition: RooAbsArg.h:387
RooRealSumPdf::CacheElem::_funcIntList
RooArgList _funcIntList
Definition: RooRealSumPdf.h:80
RooAbsCacheElement
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Definition: RooAbsCacheElement.h:26
RooRealSumPdf::CacheElem::CacheElem
CacheElem()
Definition: RooRealSumPdf.h:77
RooRealSumPdf::CacheElem::~CacheElem
virtual ~CacheElem()
Definition: RooRealSumPdf.h:78
bool
RooRealSumPdf::plotSamplingHint
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
Definition: RooRealSumPdf.cxx:533
RooRealSumPdf::coefList
const RooArgList & coefList() const
Definition: RooRealSumPdf.h:45
RooRealSumPdf::_normIntMgr
RooObjCacheManager _normIntMgr
Definition: RooRealSumPdf.h:83
RooAbsPdf::ExtendMode
ExtendMode
Definition: RooAbsPdf.h:232
RooRealSumPdf::expectedEvents
virtual Double_t expectedEvents(const RooArgSet &nset) const
Return expected number of events to be used in calculation of extended likelihood.
Definition: RooRealSumPdf.h:50
RooRealSumPdf::_coefList
RooListProxy _coefList
Definition: RooRealSumPdf.h:87
RooAICRegistry.h
RooRealSumPdf::expectedEvents
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
Definition: RooRealSumPdf.cxx:456
RooRealSumPdf::_haveWarned
bool _haveWarned
Definition: RooRealSumPdf.h:91
RooAbsPdf.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooRealSumPdf::_funcList
RooListProxy _funcList
Definition: RooRealSumPdf.h:86
RooRealSumPdf::CacheElem::containedArgs
virtual RooArgList containedArgs(Action)
Definition: RooRealSumPdf.h:79
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:437
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:155
RooRealSumPdf::haveLastCoef
bool haveLastCoef() const
Definition: RooRealSumPdf.h:96
RooRealSumPdf::printMetaArgs
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealSumPdf to more intuitively reflect the contents of the p...
Definition: RooRealSumPdf.cxx:597
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
RooRealSumPdf::_doFloorGlobal
static Bool_t _doFloorGlobal
Definition: RooRealSumPdf.h:92
RooObjCacheManager.h
RooAbsArg::isFundamental
virtual Bool_t isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
Definition: RooAbsArg.h:243
RooListProxy.h
RooRealSumPdf::analyticalIntegralWN
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implement analytical integrations by deferring integration of component functions to integrators of c...
Definition: RooRealSumPdf.cxx:361
Double_t
double Double_t
Definition: RtypesCore.h:59
RooRealSumPdf::checkObservables
virtual Bool_t checkObservables(const RooArgSet *nset) const
Check if FUNC is valid for given normalization set.
Definition: RooRealSumPdf.cxx:278
RooRealSumPdf::funcList
const RooArgList & funcList() const
Definition: RooRealSumPdf.h:44
RooRealSumPdf::selfNormalized
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: RooRealSumPdf.h:56
RooObjCacheManager
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
Definition: RooObjCacheManager.h:32
RooAbsCacheElement::Action
Action
Definition: RooAbsCacheElement.h:39
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooAbsArg::NotAdvised
@ NotAdvised
Definition: RooAbsArg.h:387
name
char name[80]
Definition: TGX11.cxx:110
RooRealSumPdf::setFloor
void setFloor(Bool_t flag)
Definition: RooRealSumPdf.h:65
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooRealSumPdf::binBoundaries
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Retrieve bin boundaries if this distribution is binned in obs.
Definition: RooRealSumPdf.cxx:468
RooAbsPdf
Definition: RooAbsPdf.h:43
RooRealSumPdf::CacheElem::_funcNormList
RooArgList _funcNormList
Definition: RooRealSumPdf.h:81
RooRealSumPdf::getFloor
Bool_t getFloor() const
Definition: RooRealSumPdf.h:66
RooRealSumPdf::~RooRealSumPdf
virtual ~RooRealSumPdf()
Destructor.
Definition: RooRealSumPdf.cxx:208
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooRealSumPdf
The class RooRealSumPdf implements a PDF constructed from a sum of functions:
Definition: RooRealSumPdf.h:25
RooRealSumPdf::evaluate
Double_t evaluate() const
Calculate the current value.
Definition: RooRealSumPdf.cxx:230
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
int
RooAbsArg::getAttribute
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Definition: RooAbsArg.cxx:314