// RooAbsSelfCachedReal is an abstract base class for functions whose
// output is cached in terms of a histogram in all observables between
// getVal() and evaluate(). For certain p.d.f.s that are very
// expensive to calculate it may be beneficial to implement them as a
// RooAbsSelfCachedReal rather than a RooAbsReal. Class
// RooAbsSelfCachedReal is designed to have its interface identical to
// that of RooAbsReal, so any p.d.f can make use of its caching
// functionality by merely switching its base class. Existing
// RooAbsReal objects can also be cached a posteriori with the
// RooCachedReal wrapper function that takes any RooAbsReal object as
// input.
// END_HTML
#include "Riostream.h"
#include "RooFit.h"
#include "RooAbsSelfCachedReal.h"
#include "RooAbsReal.h"
#include "RooMsgService.h"
#include "RooDataHist.h"
#include "RooHistPdf.h"
using namespace std ;
ClassImp(RooAbsSelfCachedReal)
RooAbsSelfCachedReal::RooAbsSelfCachedReal(const char *name, const char *title, Int_t ipOrder) :
RooAbsCachedReal(name,title,ipOrder)
{
}
RooAbsSelfCachedReal::RooAbsSelfCachedReal(const RooAbsSelfCachedReal& other, const char* name) :
RooAbsCachedReal(other,name)
{
}
RooAbsSelfCachedReal::~RooAbsSelfCachedReal()
{
}
void RooAbsSelfCachedReal::fillCacheObject(RooAbsCachedReal::FuncCacheElem& cache) const
{
RooDataHist& cacheHist = *cache.hist() ;
RooArgSet* cloneSet = (RooArgSet*) RooArgSet(*this).snapshot(kTRUE) ;
RooAbsSelfCachedReal* clone2 = (RooAbsSelfCachedReal*) cloneSet->find(GetName()) ;
clone2->disableCache(kTRUE) ;
clone2->attachDataSet(cacheHist) ;
for (Int_t i=0 ; i<cacheHist.numEntries() ; i++) {
const RooArgSet* obs = cacheHist.get(i) ;
Double_t wgt = clone2->getVal(obs) ;
cacheHist.set(wgt) ;
}
delete cloneSet ;
}
RooArgSet* RooAbsSelfCachedReal::actualObservables(const RooArgSet& nset) const
{
RooArgSet servers ;
TIterator* siter = serverIterator() ;
siter->Reset() ;
RooAbsArg* server ;
while((server=(RooAbsArg*)siter->Next())) {
servers.add(*server) ;
}
return (RooArgSet*) servers.selectCommon(nset) ;
}
RooArgSet* RooAbsSelfCachedReal::actualParameters(const RooArgSet& nset) const
{
RooArgSet *servers = new RooArgSet ;
TIterator* siter = serverIterator() ;
siter->Reset() ;
RooAbsArg* server ;
while((server=(RooAbsArg*)siter->Next())) {
servers->add(*server) ;
}
servers->remove(nset,kTRUE,kTRUE) ;
return servers ;
}
RooAbsSelfCachedReal.cxx:1 RooAbsSelfCachedReal.cxx:2 RooAbsSelfCachedReal.cxx:3 RooAbsSelfCachedReal.cxx:4 RooAbsSelfCachedReal.cxx:5 RooAbsSelfCachedReal.cxx:6 RooAbsSelfCachedReal.cxx:7 RooAbsSelfCachedReal.cxx:8 RooAbsSelfCachedReal.cxx:9 RooAbsSelfCachedReal.cxx:10 RooAbsSelfCachedReal.cxx:11 RooAbsSelfCachedReal.cxx:12 RooAbsSelfCachedReal.cxx:13 RooAbsSelfCachedReal.cxx:14 RooAbsSelfCachedReal.cxx:15 RooAbsSelfCachedReal.cxx:16 RooAbsSelfCachedReal.cxx:17 RooAbsSelfCachedReal.cxx:18 RooAbsSelfCachedReal.cxx:19 RooAbsSelfCachedReal.cxx:20 RooAbsSelfCachedReal.cxx:21 RooAbsSelfCachedReal.cxx:22 RooAbsSelfCachedReal.cxx:23 RooAbsSelfCachedReal.cxx:24 RooAbsSelfCachedReal.cxx:25 RooAbsSelfCachedReal.cxx:26 RooAbsSelfCachedReal.cxx:27 RooAbsSelfCachedReal.cxx:28 RooAbsSelfCachedReal.cxx:29 RooAbsSelfCachedReal.cxx:30 RooAbsSelfCachedReal.cxx:31 RooAbsSelfCachedReal.cxx:32 RooAbsSelfCachedReal.cxx:33 RooAbsSelfCachedReal.cxx:34 RooAbsSelfCachedReal.cxx:35 RooAbsSelfCachedReal.cxx:36 RooAbsSelfCachedReal.cxx:37 RooAbsSelfCachedReal.cxx:38 RooAbsSelfCachedReal.cxx:39 RooAbsSelfCachedReal.cxx:40 RooAbsSelfCachedReal.cxx:41 RooAbsSelfCachedReal.cxx:42 RooAbsSelfCachedReal.cxx:43 RooAbsSelfCachedReal.cxx:44 RooAbsSelfCachedReal.cxx:45 RooAbsSelfCachedReal.cxx:46 RooAbsSelfCachedReal.cxx:47 RooAbsSelfCachedReal.cxx:48 RooAbsSelfCachedReal.cxx:49 RooAbsSelfCachedReal.cxx:50 RooAbsSelfCachedReal.cxx:51 RooAbsSelfCachedReal.cxx:52 RooAbsSelfCachedReal.cxx:53 RooAbsSelfCachedReal.cxx:54 RooAbsSelfCachedReal.cxx:55 RooAbsSelfCachedReal.cxx:56 RooAbsSelfCachedReal.cxx:57 RooAbsSelfCachedReal.cxx:58 RooAbsSelfCachedReal.cxx:59 RooAbsSelfCachedReal.cxx:60 RooAbsSelfCachedReal.cxx:61 RooAbsSelfCachedReal.cxx:62 RooAbsSelfCachedReal.cxx:63 RooAbsSelfCachedReal.cxx:64 RooAbsSelfCachedReal.cxx:65 RooAbsSelfCachedReal.cxx:66 RooAbsSelfCachedReal.cxx:67 RooAbsSelfCachedReal.cxx:68 RooAbsSelfCachedReal.cxx:69 RooAbsSelfCachedReal.cxx:70 RooAbsSelfCachedReal.cxx:71 RooAbsSelfCachedReal.cxx:72 RooAbsSelfCachedReal.cxx:73 RooAbsSelfCachedReal.cxx:74 RooAbsSelfCachedReal.cxx:75 RooAbsSelfCachedReal.cxx:76 RooAbsSelfCachedReal.cxx:77 RooAbsSelfCachedReal.cxx:78 RooAbsSelfCachedReal.cxx:79 RooAbsSelfCachedReal.cxx:80 RooAbsSelfCachedReal.cxx:81 RooAbsSelfCachedReal.cxx:82 RooAbsSelfCachedReal.cxx:83 RooAbsSelfCachedReal.cxx:84 RooAbsSelfCachedReal.cxx:85 RooAbsSelfCachedReal.cxx:86 RooAbsSelfCachedReal.cxx:87 RooAbsSelfCachedReal.cxx:88 RooAbsSelfCachedReal.cxx:89 RooAbsSelfCachedReal.cxx:90 RooAbsSelfCachedReal.cxx:91 RooAbsSelfCachedReal.cxx:92 RooAbsSelfCachedReal.cxx:93 RooAbsSelfCachedReal.cxx:94 RooAbsSelfCachedReal.cxx:95 RooAbsSelfCachedReal.cxx:96 RooAbsSelfCachedReal.cxx:97 RooAbsSelfCachedReal.cxx:98 RooAbsSelfCachedReal.cxx:99 RooAbsSelfCachedReal.cxx:100 RooAbsSelfCachedReal.cxx:101 RooAbsSelfCachedReal.cxx:102 RooAbsSelfCachedReal.cxx:103 RooAbsSelfCachedReal.cxx:104 RooAbsSelfCachedReal.cxx:105 RooAbsSelfCachedReal.cxx:106 RooAbsSelfCachedReal.cxx:107 RooAbsSelfCachedReal.cxx:108 RooAbsSelfCachedReal.cxx:109 RooAbsSelfCachedReal.cxx:110 RooAbsSelfCachedReal.cxx:111 RooAbsSelfCachedReal.cxx:112 RooAbsSelfCachedReal.cxx:113 RooAbsSelfCachedReal.cxx:114 RooAbsSelfCachedReal.cxx:115 RooAbsSelfCachedReal.cxx:116 RooAbsSelfCachedReal.cxx:117 RooAbsSelfCachedReal.cxx:118 RooAbsSelfCachedReal.cxx:119 RooAbsSelfCachedReal.cxx:120 RooAbsSelfCachedReal.cxx:121 RooAbsSelfCachedReal.cxx:122 RooAbsSelfCachedReal.cxx:123 RooAbsSelfCachedReal.cxx:124 RooAbsSelfCachedReal.cxx:125 RooAbsSelfCachedReal.cxx:126 RooAbsSelfCachedReal.cxx:127 RooAbsSelfCachedReal.cxx:128 RooAbsSelfCachedReal.cxx:129 RooAbsSelfCachedReal.cxx:130 RooAbsSelfCachedReal.cxx:131 RooAbsSelfCachedReal.cxx:132 RooAbsSelfCachedReal.cxx:133 RooAbsSelfCachedReal.cxx:134 RooAbsSelfCachedReal.cxx:135 RooAbsSelfCachedReal.cxx:136 RooAbsSelfCachedReal.cxx:137 RooAbsSelfCachedReal.cxx:138 RooAbsSelfCachedReal.cxx:139 RooAbsSelfCachedReal.cxx:140 RooAbsSelfCachedReal.cxx:141 RooAbsSelfCachedReal.cxx:142 RooAbsSelfCachedReal.cxx:143 RooAbsSelfCachedReal.cxx:144 RooAbsSelfCachedReal.cxx:145 RooAbsSelfCachedReal.cxx:146