Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooEffProd.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * File: $Id: RooEffProd.h,v 1.2 2007/05/11 10:14:56 verkerke Exp $
5  * Authors: *
6  * GR, Gerhard Raven, NIKHEF/VU *
7  * *
8  * Redistribution and use in source and binary forms, *
9  * with or without modification, are permitted according to the terms *
10  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
11  *****************************************************************************/
12 #ifndef ROO_EFF_PROD
13 #define ROO_EFF_PROD
14 
15 #include "RooAbsPdf.h"
16 #include "RooAbsReal.h"
17 #include "RooRealProxy.h"
18 #include "RooObjCacheManager.h"
19 
20 class RooEffProd: public RooAbsPdf {
21 public:
22  // Constructors, assignment etc
23  inline RooEffProd() : _nset(0), _fixedNset(0) { };
24  virtual ~RooEffProd();
25  RooEffProd(const char *name, const char *title, RooAbsPdf& pdf, RooAbsReal& efficiency);
26  RooEffProd(const RooEffProd& other, const char* name=0);
27 
28  virtual TObject* clone(const char* newname) const { return new RooEffProd(*this,newname); }
29 
30  virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype,
31  const RooArgSet* auxProto, Bool_t verbose) const;
32 
33  virtual Double_t getValV(const RooArgSet* set=0) const ;
34 
35  virtual Bool_t forceAnalyticalInt(const RooAbsArg& /*dep*/) const {
36  // Return kTRUE to force RooRealIntegral to offer all observables for internal integration
37  return kTRUE ;
38  }
39  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
40  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
41 
42 protected:
43 
44  const RooAbsPdf* pdf() const {
45  // Return pointer to pdf in product
46  return (RooAbsPdf*) _pdf.absArg() ;
47  }
48  const RooAbsReal* eff() const {
49  // Return pointer to efficiency function in product
50  return (RooAbsReal*) _eff.absArg() ;
51  }
52 
53  // Function evaluation
54  virtual Double_t evaluate() const ;
55 
56  class CacheElem : public RooAbsCacheElement {
57  public:
58  CacheElem() : _clone(0), _int(0) {}
59  virtual ~CacheElem() { delete _int ; delete _clone ; }
60  // Payload
61  RooArgSet _intObs ;
62  RooEffProd* _clone ;
63  RooAbsReal* _int ;
64  // Cache management functions
65  virtual RooArgList containedArgs(Action) ;
66  } ;
67  mutable RooObjCacheManager _cacheMgr ; //! The cache manager
68 
69 
70  // the real stuff...
71  RooRealProxy _pdf ; // Probability Density function
72  RooRealProxy _eff; // Efficiency function
73  mutable const RooArgSet* _nset ; //! Normalization set to be used in evaluation
74 
75  RooArgSet* _fixedNset ; //! Fixed normalization set overriding default normalization set (if provided)
76 
77  ClassDef(RooEffProd,2) // Product operator p.d.f of (PDF x efficiency) implementing optimized generator context
78 };
79 
80 #endif