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 
24 class RooRealSumPdf : public RooAbsPdf {
25 public:
26 
27  RooRealSumPdf() ;
28  RooRealSumPdf(const char *name, const char *title);
29  RooRealSumPdf(const char *name, const char *title, const RooArgList& funcList, const RooArgList& coefList, Bool_t extended=kFALSE) ;
30  RooRealSumPdf(const char *name, const char *title,
31  RooAbsReal& func1, RooAbsReal& func2, RooAbsReal& coef1) ;
32  RooRealSumPdf(const RooRealSumPdf& other, const char* name=0) ;
33  virtual TObject* clone(const char* newname) const { return new RooRealSumPdf(*this,newname) ; }
34  virtual ~RooRealSumPdf() ;
35 
36  Double_t evaluate() const ;
37  virtual Bool_t checkObservables(const RooArgSet* nset) const ;
38 
39  virtual Bool_t forceAnalyticalInt(const RooAbsArg& arg) const { return arg.isFundamental() ; }
40  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
41  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
42 
43  const RooArgList& funcList() const { return _funcList ; }
44  const RooArgList& coefList() const { return _coefList ; }
45 
46  virtual ExtendMode extendMode() const ;
47 
48  /// Return expected number of events for extended likelihood calculation, which
49  /// is the sum of all coefficients.
50  virtual Double_t expectedEvents(const RooArgSet* nset) const ;
51 
52  virtual Bool_t selfNormalized() const { return getAttribute("BinnedLikelihoodActive") ; }
53 
54  void printMetaArgs(std::ostream& os) const ;
55 
56 
57  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
58  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
59  Bool_t isBinnedDistribution(const RooArgSet& obs) const ;
60 
61  void setFloor(Bool_t flag) { _doFloor = flag ; }
62  Bool_t getFloor() const { return _doFloor ; }
63  static void setFloorGlobal(Bool_t flag) { _doFloorGlobal = flag ; }
64  static Bool_t getFloorGlobal() { return _doFloorGlobal ; }
65 
66  virtual CacheMode canNodeBeCached() const { return RooAbsArg::NotAdvised ; } ;
67  virtual void setCacheAndTrackHints(RooArgSet&) ;
68 
69 protected:
70  RooSpan<double> evaluateSpan(RooBatchCompute::RunContext& evalData, const RooArgSet* normSet) const;
71 
72  class CacheElem : public RooAbsCacheElement {
73  public:
74  CacheElem() {} ;
75  virtual ~CacheElem() {} ;
76  virtual RooArgList containedArgs(Action) { RooArgList ret(_funcIntList) ; ret.add(_funcNormList) ; return ret ; }
79  } ;
80  mutable RooObjCacheManager _normIntMgr ; // The integration cache manager
81 
82 
83  RooListProxy _funcList ; // List of component FUNCs
84  RooListProxy _coefList ; // List of coefficients
85  Bool_t _extended ; // Allow use as extended p.d.f.
86 
87  Bool_t _doFloor ; // Introduce floor at zero in pdf
88  mutable bool _haveWarned{false}; //!
89  static Bool_t _doFloorGlobal ; // Global flag for introducing floor at zero in pdf
90 
91 private:
92 
93  bool haveLastCoef() const {
94  return _funcList.size() == _coefList.size();
95  }
96 
97  ClassDef(RooRealSumPdf, 4) // PDF constructed from a sum of (non-pdf) functions
98 };
99 
100 #endif
RooRealSumPdf::setFloorGlobal
static void setFloorGlobal(Bool_t flag)
Definition: RooRealSumPdf.h:63
RooRealSumPdf::canNodeBeCached
virtual CacheMode canNodeBeCached() const
Definition: RooRealSumPdf.h:66
RooRealSumPdf::forceAnalyticalInt
virtual Bool_t forceAnalyticalInt(const RooAbsArg &arg) const
Definition: RooRealSumPdf.h:39
RooRealSumPdf::clone
virtual TObject * clone(const char *newname) const
Definition: RooRealSumPdf.h:33
RooRealSumPdf::_doFloor
Bool_t _doFloor
Definition: RooRealSumPdf.h:87
RooRealSumPdf::_extended
Bool_t _extended
Definition: RooRealSumPdf.h:85
RooRealSumPdf::RooRealSumPdf
RooRealSumPdf()
Default constructor coverity[UNINIT_CTOR].
Definition: RooRealSumPdf.cxx:72
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:359
RooRealSumPdf::getFloorGlobal
static Bool_t getFloorGlobal()
Definition: RooRealSumPdf.h:64
RooRealSumPdf::setCacheAndTrackHints
virtual void setCacheAndTrackHints(RooArgSet &)
Label OK'ed components of a RooRealSumPdf with cache-and-track.
Definition: RooRealSumPdf.cxx:630
RooRealSumPdf::extendMode
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
Definition: RooRealSumPdf.cxx:220
RooRealSumPdf::CacheElem
Definition: RooRealSumPdf.h:72
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
Check if all components that depend on obs are binned.
Definition: RooRealSumPdf.cxx:563
RooAbsArg::CacheMode
CacheMode
Definition: RooAbsArg.h:389
RooRealSumPdf::CacheElem::_funcIntList
RooArgList _funcIntList
Definition: RooRealSumPdf.h:77
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:74
RooRealSumPdf::evaluateSpan
RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const
Calculate the value for all values of the observable in evalData.
Definition: RooRealSumPdf.cxx:271
RooRealSumPdf::CacheElem::~CacheElem
virtual ~CacheElem()
Definition: RooRealSumPdf.h:75
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:582
RooRealSumPdf::coefList
const RooArgList & coefList() const
Definition: RooRealSumPdf.h:44
RooRealSumPdf::_normIntMgr
RooObjCacheManager _normIntMgr
Definition: RooRealSumPdf.h:80
RooAbsPdf::ExtendMode
ExtendMode
Definition: RooAbsPdf.h:230
RooRealSumPdf::_coefList
RooListProxy _coefList
Definition: RooRealSumPdf.h:84
RooAICRegistry.h
RooRealSumPdf::expectedEvents
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events for extended likelihood calculation, which is the sum of all coeffic...
Definition: RooRealSumPdf.cxx:507
RooRealSumPdf::_haveWarned
bool _haveWarned
Definition: RooRealSumPdf.h:88
RooAbsPdf.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooRealSumPdf::_funcList
RooListProxy _funcList
Definition: RooRealSumPdf.h:83
RooRealSumPdf::CacheElem::containedArgs
virtual RooArgList containedArgs(Action)
Definition: RooRealSumPdf.h:76
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:455
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:214
RooRealSumPdf::haveLastCoef
bool haveLastCoef() const
Definition: RooRealSumPdf.h:93
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:646
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
RooRealSumPdf::_doFloorGlobal
static Bool_t _doFloorGlobal
Definition: RooRealSumPdf.h:89
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:413
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:330
RooRealSumPdf::funcList
const RooArgList & funcList() const
Definition: RooRealSumPdf.h:43
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:52
RooObjCacheManager
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
Definition: RooObjCacheManager.h:30
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:389
name
char name[80]
Definition: TGX11.cxx:110
RooRealSumPdf::setFloor
void setFloor(Bool_t flag)
Definition: RooRealSumPdf.h:61
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:519
RooAbsPdf
Definition: RooAbsPdf.h:41
RooRealSumPdf::CacheElem::_funcNormList
RooArgList _funcNormList
Definition: RooRealSumPdf.h:78
RooRealSumPdf::getFloor
Bool_t getFloor() const
Definition: RooRealSumPdf.h:62
RooRealSumPdf::~RooRealSumPdf
virtual ~RooRealSumPdf()
Destructor.
Definition: RooRealSumPdf.cxx:209
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:24
RooRealSumPdf::evaluate
Double_t evaluate() const
Calculate the current value.
Definition: RooRealSumPdf.cxx:231
RooBatchCompute::RunContext
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:31
RooSpan
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
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