Logo ROOT  
Reference Guide
PiecewiseInterpolation.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: PiecewiseInterpolation.h,v 1.3 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_PIECEWISEINTERPOLATION
17 #define ROO_PIECEWISEINTERPOLATION
18 
19 #include "RooAbsReal.h"
20 #include "RooRealProxy.h"
21 #include "RooListProxy.h"
22 
23 #include "RooObjCacheManager.h"
24 #include <vector>
25 #include <list>
26 
27 class RooRealVar;
28 class RooArgList;
29 
31 public:
32 
34  PiecewiseInterpolation(const char *name, const char *title, const RooAbsReal& nominal, const RooArgList& lowSet, const RooArgList& highSet, const RooArgList& paramSet, Bool_t takeOwnerShip=kFALSE) ;
35  virtual ~PiecewiseInterpolation() ;
36 
37  PiecewiseInterpolation(const PiecewiseInterpolation& other, const char* name = 0);
38  virtual TObject* clone(const char* newname) const { return new PiecewiseInterpolation(*this, newname); }
39 
40  /// Return pointer to the nominal hist function.
41  const RooAbsReal* nominalHist() const {
42  return &_nominal.arg();
43  }
44 
45  // virtual Double_t defaultErrorLevel() const ;
46 
47  // void printMetaArgs(std::ostream& os) const ;
48 
49  const RooArgList& lowList() const { return _lowSet ; }
50  const RooArgList& highList() const { return _highSet ; }
51  const RooArgList& paramList() const { return _paramSet ; }
52 
53  //virtual Bool_t forceAnalyticalInt(const RooAbsArg&) const { return kTRUE ; }
55 
56  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet,const char* rangeName=0) const ;
57  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
58 
59  void setPositiveDefinite(bool flag=true){_positiveDefinite=flag;}
60 
61  void setInterpCode(RooAbsReal& param, int code);
62  void setAllInterpCodes(int code);
63  void printAllInterpCodes();
64 
65  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
66  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const ;
67  virtual Bool_t isBinnedDistribution(const RooArgSet& obs) const ;
68 
69 protected:
70 
71  class CacheElem : public RooAbsCacheElement {
72  public:
73  CacheElem() {} ;
74  virtual ~CacheElem() {} ;
76  RooArgList ret(_funcIntList) ;
77  ret.add(_lowIntList);
78  ret.add(_highIntList);
79  return ret ;
80  }
84  // will want std::vector<RooRealVar*> for low and high also
85  } ;
86  mutable RooObjCacheManager _normIntMgr ; // The integration cache manager
87 
88  RooRealProxy _nominal; // The nominal value
89  RooArgList _ownedList ; // List of owned components
90  RooListProxy _lowSet ; // Low-side variation
91  RooListProxy _highSet ; // High-side varaition
92  RooListProxy _paramSet ; // interpolation parameters
93  RooListProxy _normSet ; // interpolation parameters
94  Bool_t _positiveDefinite; // protect against negative and 0 bins.
95 
96  std::vector<int> _interpCode;
97 
98  Double_t evaluate() const;
99  RooSpan<double> evaluateSpan(RooBatchCompute::RunContext& evalData, const RooArgSet* normSet) const;
100 
101  ClassDef(PiecewiseInterpolation,3) // Sum of RooAbsReal objects
102 };
103 
104 #endif
PiecewiseInterpolation::CacheElem::CacheElem
CacheElem()
Definition: PiecewiseInterpolation.h:73
RooAbsReal.h
PiecewiseInterpolation::CacheElem::_highIntList
RooArgList _highIntList
Definition: PiecewiseInterpolation.h:83
PiecewiseInterpolation::analyticalIntegralWN
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
Definition: PiecewiseInterpolation.cxx:560
RooTemplateProxy::arg
const T & arg() const
Return reference to object held in proxy.
Definition: RooTemplateProxy.h:290
PiecewiseInterpolation::paramList
const RooArgList & paramList() const
Definition: PiecewiseInterpolation.h:51
PiecewiseInterpolation::_normIntMgr
RooObjCacheManager _normIntMgr
Definition: PiecewiseInterpolation.h:86
PiecewiseInterpolation::setInterpCode
void setInterpCode(RooAbsReal &param, int code)
Definition: PiecewiseInterpolation.cxx:743
PiecewiseInterpolation::CacheElem::_funcIntList
RooArgList _funcIntList
Definition: PiecewiseInterpolation.h:81
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
PiecewiseInterpolation::_normSet
RooListProxy _normSet
Definition: PiecewiseInterpolation.h:93
PiecewiseInterpolation::clone
virtual TObject * clone(const char *newname) const
Definition: PiecewiseInterpolation.h:38
PiecewiseInterpolation::CacheElem::~CacheElem
virtual ~CacheElem()
Definition: PiecewiseInterpolation.h:74
PiecewiseInterpolation::CacheElem::_lowIntList
RooArgList _lowIntList
Definition: PiecewiseInterpolation.h:82
PiecewiseInterpolation::isBinnedDistribution
virtual Bool_t isBinnedDistribution(const RooArgSet &obs) const
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
Definition: PiecewiseInterpolation.cxx:786
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
PiecewiseInterpolation::setPositiveDefinite
void setPositiveDefinite(bool flag=true)
Definition: PiecewiseInterpolation.h:59
RooAbsCacheElement
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Definition: RooAbsCacheElement.h:26
PiecewiseInterpolation::_ownedList
RooArgList _ownedList
Definition: PiecewiseInterpolation.h:89
PiecewiseInterpolation::setBinIntegrator
Bool_t setBinIntegrator(RooArgSet &allVars)
Definition: PiecewiseInterpolation.cxx:448
PiecewiseInterpolation::_lowSet
RooListProxy _lowSet
Definition: PiecewiseInterpolation.h:90
bool
PiecewiseInterpolation::_positiveDefinite
Bool_t _positiveDefinite
Definition: PiecewiseInterpolation.h:94
PiecewiseInterpolation::CacheElem
Definition: PiecewiseInterpolation.h:71
PiecewiseInterpolation::plotSamplingHint
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
Definition: PiecewiseInterpolation.cxx:795
PiecewiseInterpolation::_nominal
RooRealProxy _nominal
Definition: PiecewiseInterpolation.h:88
PiecewiseInterpolation::CacheElem::containedArgs
virtual RooArgList containedArgs(Action)
Definition: PiecewiseInterpolation.h:75
PiecewiseInterpolation::nominalHist
const RooAbsReal * nominalHist() const
Return pointer to the nominal hist function.
Definition: PiecewiseInterpolation.h:41
PiecewiseInterpolation::lowList
const RooArgList & lowList() const
Definition: PiecewiseInterpolation.h:49
PiecewiseInterpolation::PiecewiseInterpolation
PiecewiseInterpolation()
Definition: PiecewiseInterpolation.cxx:50
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
PiecewiseInterpolation::highList
const RooArgList & highList() const
Definition: PiecewiseInterpolation.h:50
RooRealProxy.h
PiecewiseInterpolation::evaluate
Double_t evaluate() const
Calculate and return current value of self.
Definition: PiecewiseInterpolation.cxx:172
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:455
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
RooObjCacheManager.h
PiecewiseInterpolation::getAnalyticalIntegralWN
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
Definition: PiecewiseInterpolation.cxx:466
RooListProxy.h
RooTemplateProxy< RooAbsReal >
PiecewiseInterpolation::_paramSet
RooListProxy _paramSet
Definition: PiecewiseInterpolation.h:92
PiecewiseInterpolation::evaluateSpan
RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const
Interpolate between input distributions for all values of the observable in evalData.
Definition: PiecewiseInterpolation.cxx:319
Double_t
double Double_t
Definition: RtypesCore.h:59
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
name
char name[80]
Definition: TGX11.cxx:110
PiecewiseInterpolation::~PiecewiseInterpolation
virtual ~PiecewiseInterpolation()
Destructor.
Definition: PiecewiseInterpolation.cxx:161
PiecewiseInterpolation::setAllInterpCodes
void setAllInterpCodes(int code)
Definition: PiecewiseInterpolation.cxx:758
PiecewiseInterpolation::binBoundaries
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
Definition: PiecewiseInterpolation.cxx:777
PiecewiseInterpolation::_highSet
RooListProxy _highSet
Definition: PiecewiseInterpolation.h:91
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
PiecewiseInterpolation::_interpCode
std::vector< int > _interpCode
Definition: PiecewiseInterpolation.h:96
RooBatchCompute::RunContext
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:31
PiecewiseInterpolation
The PiecewiseInterpolation is a class that can morph distributions into each other,...
Definition: PiecewiseInterpolation.h:30
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
PiecewiseInterpolation::printAllInterpCodes
void printAllInterpCodes()
Definition: PiecewiseInterpolation.cxx:767