Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooProjectedPdf.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * *
4  * Copyright (c) 2000-2005, Regents of the University of California *
5  * and Stanford University. All rights reserved. *
6  * *
7  * Redistribution and use in source and binary forms, *
8  * with or without modification, are permitted according to the terms *
9  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
10  *****************************************************************************/
11 
12 #ifndef ROOPROJECTEDPDF
13 #define ROOPROJECTEDPDF
14 
15 #include "RooAbsPdf.h"
16 #include "RooRealProxy.h"
17 #include "RooAbsReal.h"
18 #include "RooObjCacheManager.h"
19 #include "RooSetProxy.h"
20 
21 class RooProjectedPdf : public RooAbsPdf {
22 public:
23 
24  RooProjectedPdf() ;
25  RooProjectedPdf(const char *name, const char *title, RooAbsReal& _intpdf, const RooArgSet& intObs);
26  RooProjectedPdf(const RooProjectedPdf& other, const char* name=0) ;
27  virtual TObject* clone(const char* newname) const { return new RooProjectedPdf(*this,newname); }
28  inline virtual ~RooProjectedPdf() { }
29 
30  // Analytical integration support
31  virtual Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName=0) const ;
32  virtual Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
33  virtual Bool_t forceAnalyticalInt(const RooAbsArg& dep) const ;
34 
35  virtual Double_t getValV(const RooArgSet* set=0) const ;
36 
37  Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
38  void initGenerator(Int_t /*code*/) {} ; // optional pre-generation initialization
39  void generateEvent(Int_t code);
40 
41  virtual Bool_t selfNormalized() const { return kTRUE ; }
42 
43  // Handle projection of projection explicitly
44  virtual RooAbsPdf* createProjection(const RooArgSet& iset) ;
45 
46  void printMetaArgs(std::ostream& os) const ;
47 
48 
49 protected:
50 
51  RooRealProxy intpdf ; // p.d.f that is integrated
52  RooSetProxy intobs ; // observables that p.d.f is integrated over
53  RooSetProxy deps ; // dependents of this p.d.f
54 
55  class CacheElem : public RooAbsCacheElement {
56  public:
57  virtual ~CacheElem() { delete _projection ; } ;
58  // Payload
59  RooAbsReal* _projection ;
60  // Cache management functions
61  virtual RooArgList containedArgs(Action) ;
62  virtual void printCompactTreeHook(std::ostream&, const char *, Int_t, Int_t) ;
63  } ;
64  mutable RooObjCacheManager _cacheMgr ; //! The cache manager
65 
66  Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t /*mustReplaceAll*/, Bool_t /*nameChange*/, Bool_t /*isRecursive*/) ;
67 
68  mutable RooArgSet* _curNormSet ; //!
69 
70  const RooAbsReal* getProjection(const RooArgSet* iset, const RooArgSet* nset, const char* rangeName, int& code) const ;
71  Double_t evaluate() const ;
72 
73 private:
74 
75  ClassDef(RooProjectedPdf,1) // Operator p.d.f calculating projection of another p.d.f
76 };
77 
78 #endif