Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooRealSumFunc.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooRealSumFunc.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_FUNC
17 #define ROO_REAL_SUM_FUNC
18 
19 #include "RooAbsPdf.h"
20 #include "RooListProxy.h"
21 #include "RooAICRegistry.h"
22 #include "RooObjCacheManager.h"
23 
24 class RooRealSumFunc : public RooAbsReal {
25 public:
26  RooRealSumFunc();
27  RooRealSumFunc(const char *name, const char *title);
28  RooRealSumFunc(const char *name, const char *title, const RooArgList &funcList, const RooArgList &coefList);
29  RooRealSumFunc(const char *name, const char *title, RooAbsReal &func1, RooAbsReal &func2, RooAbsReal &coef1);
30  RooRealSumFunc(const RooRealSumFunc &other, const char *name = 0);
31  virtual TObject *clone(const char *newname) const { return new RooRealSumFunc(*this, newname); }
32  virtual ~RooRealSumFunc();
33 
34  Double_t evaluate() const;
35  virtual Bool_t checkObservables(const RooArgSet *nset) const;
36 
37  virtual Bool_t forceAnalyticalInt(const RooAbsArg &arg) const { return arg.isFundamental(); }
38  Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet,
39  const char *rangeName = 0) const;
40  Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName = 0) const;
41 
42  const RooArgList &funcList() const { return _funcList; }
43  const RooArgList &coefList() const { return _coefList; }
44 
45  void printMetaArgs(std::ostream &os) const;
46 
47  virtual std::list<Double_t> *binBoundaries(RooAbsRealLValue & /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const;
48  virtual std::list<Double_t> *plotSamplingHint(RooAbsRealLValue & /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const;
49  Bool_t isBinnedDistribution(const RooArgSet &obs) const;
50 
51  void setFloor(Bool_t flag) { _doFloor = flag; }
52  Bool_t getFloor() const { return _doFloor; }
53  static void setFloorGlobal(Bool_t flag) { _doFloorGlobal = flag; }
54  static Bool_t getFloorGlobal() { return _doFloorGlobal; }
55 
56  virtual CacheMode canNodeBeCached() const { return RooAbsArg::NotAdvised; };
57  virtual void setCacheAndTrackHints(RooArgSet &);
58 
59 protected:
60  class CacheElem : public RooAbsCacheElement {
61  public:
62  CacheElem(){};
63  virtual ~CacheElem(){};
64  virtual RooArgList containedArgs(Action)
65  {
66  RooArgList ret(_funcIntList);
67  ret.add(_funcNormList);
68  return ret;
69  }
70  RooArgList _funcIntList;
71  RooArgList _funcNormList;
72  };
73  mutable RooObjCacheManager _normIntMgr; // The integration cache manager
74 
75  Bool_t _haveLastCoef;
76 
77  RooListProxy _funcList; // List of component FUNCs
78  RooListProxy _coefList; // List of coefficients
79  TIterator *_funcIter; //! Iterator over FUNC list
80  TIterator *_coefIter; //! Iterator over coefficient list
81 
82  Bool_t _doFloor; // Introduce floor at zero in pdf
83  static Bool_t _doFloorGlobal; // Global flag for introducing floor at zero in pdf
84 
85 private:
86  ClassDef(RooRealSumFunc, 3) // PDF constructed from a sum of (non-pdf) functions
87 };
88 
89 #endif