/*****************************************************************************
 * Project: RooFit                                                           *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/

#ifndef ROOCACHEDPDF
#define ROOCACHEDPDF

#include "RooAbsCachedPdf.h"
#include "RooRealProxy.h"
#include "RooAbsReal.h"


class RooCachedPdf : public RooAbsCachedPdf {
public:
  RooCachedPdf() {} ;
  RooCachedPdf(const char *name, const char *title, RooAbsPdf& _pdf, const RooArgSet& cacheObs);
  RooCachedPdf(const char *name, const char *title, RooAbsPdf& _pdf);
  RooCachedPdf(const RooCachedPdf& other, const char* name=0) ;
  virtual TObject* clone(const char* newname) const { return new RooCachedPdf(*this,newname); }
  virtual ~RooCachedPdf() ;

  virtual void preferredObservableScanOrder(const RooArgSet& obs, RooArgSet& orderedObs) const ;

protected:

  virtual const char* inputBaseName() const { 
    // Return the base name for cache objects, in this case the name of the cached p.d.f
    return pdf.arg().GetName() ; 
  } ;
  virtual RooArgSet* actualObservables(const RooArgSet& nset) const ;
  virtual RooArgSet* actualParameters(const RooArgSet& nset) const ;
  virtual void fillCacheObject(PdfCacheElem& cachePdf) const ;
  virtual Double_t evaluate() const { 
    // Dummy evaluate, it is never called
    return 0 ; 
  }

  virtual const char* payloadUniqueSuffix() const { return pdf.arg().aggregateCacheUniqueSuffix() ; }
  
  RooRealProxy pdf ;       // Proxy to p.d.f being cached
  RooSetProxy  _cacheObs ; // Observable to be cached

private:

  ClassDef(RooCachedPdf,1) // P.d.f class that wraps another p.d.f and caches its output 

};
 
#endif
 RooCachedPdf.h:1
 RooCachedPdf.h:2
 RooCachedPdf.h:3
 RooCachedPdf.h:4
 RooCachedPdf.h:5
 RooCachedPdf.h:6
 RooCachedPdf.h:7
 RooCachedPdf.h:8
 RooCachedPdf.h:9
 RooCachedPdf.h:10
 RooCachedPdf.h:11
 RooCachedPdf.h:12
 RooCachedPdf.h:13
 RooCachedPdf.h:14
 RooCachedPdf.h:15
 RooCachedPdf.h:16
 RooCachedPdf.h:17
 RooCachedPdf.h:18
 RooCachedPdf.h:19
 RooCachedPdf.h:20
 RooCachedPdf.h:21
 RooCachedPdf.h:22
 RooCachedPdf.h:23
 RooCachedPdf.h:24
 RooCachedPdf.h:25
 RooCachedPdf.h:26
 RooCachedPdf.h:27
 RooCachedPdf.h:28
 RooCachedPdf.h:29
 RooCachedPdf.h:30
 RooCachedPdf.h:31
 RooCachedPdf.h:32
 RooCachedPdf.h:33
 RooCachedPdf.h:34
 RooCachedPdf.h:35
 RooCachedPdf.h:36
 RooCachedPdf.h:37
 RooCachedPdf.h:38
 RooCachedPdf.h:39
 RooCachedPdf.h:40
 RooCachedPdf.h:41
 RooCachedPdf.h:42
 RooCachedPdf.h:43
 RooCachedPdf.h:44
 RooCachedPdf.h:45
 RooCachedPdf.h:46
 RooCachedPdf.h:47
 RooCachedPdf.h:48
 RooCachedPdf.h:49
 RooCachedPdf.h:50
 RooCachedPdf.h:51
 RooCachedPdf.h:52
 RooCachedPdf.h:53
 RooCachedPdf.h:54
 RooCachedPdf.h:55
 RooCachedPdf.h:56