Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
27class RooRealVar;
28class RooArgList;
29
31public:
32
34 PiecewiseInterpolation(const char *name, const char *title, const RooAbsReal &nominal, const RooArgList &lowSet,
35 const RooArgList &highSet, const RooArgList &paramSet);
36 ~PiecewiseInterpolation() override ;
37
38 PiecewiseInterpolation(const PiecewiseInterpolation& other, const char *name = nullptr);
39 TObject* clone(const char* newname) const override { return new PiecewiseInterpolation(*this, newname); }
40
41 /// Return pointer to the nominal hist function.
42 const RooAbsReal* nominalHist() const {
43 return &_nominal.arg();
44 }
45
46 // virtual double defaultErrorLevel() const ;
47
48 // void printMetaArgs(std::ostream& os) const ;
49
50 const RooArgList& lowList() const { return _lowSet ; }
51 const RooArgList& highList() const { return _highSet ; }
52 const RooArgList& paramList() const { return _paramSet ; }
53 const std::vector<int>& interpolationCodes() const { return _interpCode; }
54
55 //virtual bool forceAnalyticalInt(const RooAbsArg&) const { return true ; }
56 bool setBinIntegrator(RooArgSet& allVars) ;
57
58 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet,const char* rangeName=nullptr) const override ;
59 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
60
61 void setPositiveDefinite(bool flag=true){_positiveDefinite=flag;}
62 bool positiveDefinite() const {return _positiveDefinite;}
63
64 void setInterpCode(RooAbsReal& param, int code, bool silent=true);
65 void setAllInterpCodes(int code);
67
68 std::list<double>* binBoundaries(RooAbsRealLValue& /*obs*/, double /*xlo*/, double /*xhi*/) const override ;
69 std::list<double>* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const override ;
70 bool isBinnedDistribution(const RooArgSet& obs) const override ;
71
72protected:
73
75 public:
76 CacheElem() {} ;
79 ret.add(_lowIntList);
80 ret.add(_highIntList);
81 return ret ;
82 }
86 // will want std::vector<RooRealVar*> for low and high also
87 } ;
88 mutable RooObjCacheManager _normIntMgr ; ///<! The integration cache manager
89
90 RooRealProxy _nominal; ///< The nominal value
91 RooArgList _ownedList ; ///< List of owned components
92 RooListProxy _lowSet ; ///< Low-side variation
93 RooListProxy _highSet ; ///< High-side variation
94 RooListProxy _paramSet ; ///< interpolation parameters
95 RooListProxy _normSet ; ///< interpolation parameters
96 bool _positiveDefinite = false; ///< protect against negative and 0 bins.
97
98 std::vector<int> _interpCode;
99
100 double evaluate() const override;
101 void doEval(RooFit::EvalContext &) const override;
102
103private:
104
105 void setInterpCodeForParam(int iParam, int code);
106
107 ClassDefOverride(PiecewiseInterpolation,4) // Sum of RooAbsReal objects
108};
109
110#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
char name[80]
Definition TGX11.cxx:110
RooArgList containedArgs(Action) override
The PiecewiseInterpolation is a class that can morph distributions into each other,...
const RooArgList & highList() const
bool _positiveDefinite
protect against negative and 0 bins.
const RooAbsReal * nominalHist() const
Return pointer to the nominal hist function.
RooListProxy _lowSet
Low-side variation.
RooListProxy _highSet
High-side variation.
bool isBinnedDistribution(const RooArgSet &obs) const override
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
const RooArgList & lowList() const
~PiecewiseInterpolation() override
Destructor.
void setInterpCodeForParam(int iParam, int code)
TObject * clone(const char *newname) const override
void setInterpCode(RooAbsReal &param, int code, bool silent=true)
RooListProxy _normSet
interpolation parameters
void setPositiveDefinite(bool flag=true)
RooObjCacheManager _normIntMgr
! The integration cache manager
const RooArgList & paramList() const
bool setBinIntegrator(RooArgSet &allVars)
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Advertise that all integrals can be handled internally.
RooListProxy _paramSet
interpolation parameters
const std::vector< int > & interpolationCodes() const
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
RooArgList _ownedList
List of owned components.
RooRealProxy _nominal
The nominal value.
double evaluate() const override
Calculate and return current value of self.
void doEval(RooFit::EvalContext &) const override
Interpolate between input distributions for all values of the observable in evalData.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Implementation of a RooCacheManager<RooAbsCacheElement> that specializes in the storage of cache elem...
Variable that can be changed from the outside.
Definition RooRealVar.h:37
const T & arg() const
Return reference to object held in proxy.
Mother of all ROOT objects.
Definition TObject.h:41