MINT2
RooEffResModel.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * File: $Id: RooGaussModel.h,v 1.21 2007/05/11 09:13:07 verkerke Exp $
5  * Authors: *
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  * 2012-08-24 imported from G. Raven's p2vv git repository - M. Schiller *
11  * 2012-09-08 re-import from upstream, with some substantial modifications *
12  * to ensure that the code does not leak memory (Manuel Schiller) *
13  * 2012-10-04 re-import from upstream, with some experimental changes, which *
14  * which are disabled by default for now... *
15  *****************************************************************************/
16 #ifndef ROO_EFF_RES_MODEL
17 #define ROO_EFF_RES_MODEL
18 
19 #include <map>
20 
21 #include "RooRealProxy.h"
22 #include "RooSetProxy.h"
23 #include "RooObjCacheManager.h"
24 #include "RooAbsEffResModel.h"
25 #include "RooResolutionModel.h"
26 
27 class RooAbsAnaConvPdf;
28 
29 class RooEffResModel : public RooResolutionModel, public RooAbsEffResModel {
30  public:
31  // Constructors, assignment etc
32  inline RooEffResModel() { }
33  RooEffResModel(const char *name, const char *title,
34  RooResolutionModel& model, RooAbsReal& eff);
35  RooEffResModel(const RooEffResModel& other, const char* name = 0);
36  virtual RooEffResModel* clone(const char* newname) const;
37  virtual ~RooEffResModel();
38 
39  virtual Int_t basisCode(const char* name) const;
40  virtual Int_t getAnalyticalIntegral(
41  RooArgSet& allVars, RooArgSet& analVars,
42  const char* rangeName=0) const;
43  virtual Double_t analyticalIntegral(
44  Int_t code, const char* rangeName) const;
45  virtual Bool_t forceAnalyticalInt(const RooAbsArg& dep) const;
46 
47  virtual Int_t getGenerator(
48  const RooArgSet& directVars, RooArgSet &generateVars,
49  Bool_t staticInitOK = kTRUE) const;
50  virtual void initGenerator(Int_t code);
51  virtual void generateEvent(Int_t code);
52 
53  virtual RooAbsGenContext* modelGenContext(
54  const RooAbsAnaConvPdf& convPdf, const RooArgSet &vars,
55  const RooDataSet *prototype = 0, const RooArgSet* auxProto = 0,
56  Bool_t verbose= kFALSE) const;
57 
59  virtual RooAbsReal* efficiency() const;
60 
62  virtual std::vector<RooAbsReal*> efficiencies() const;
63 
64  virtual RooResolutionModel& model() const;
65 
67  virtual RooArgSet* observables() const;
68 
69  const RooArgList& getIntegralRanges(
70  const RooArgSet& iset, const char* rangeName = 0) const;
71 
72  protected:
73  friend class RooMultiEffResModel;
74  virtual Double_t evaluate() const;
75  virtual RooEffResModel* convolution(
76  RooFormulaVar* inBasis, RooAbsArg* owner) const;
77 
78  private:
79  class CacheElem : public RooAbsCacheElement
80  {
81  public:
82  CacheElem(const RooEffResModel& parent, const RooArgSet& iset,
83  const TNamed *rangeName);
84  virtual ~CacheElem();
85 
86  virtual RooArgList containedArgs(Action);
87  Double_t getVal(const RooArgSet* nset = 0) const;
88 
89  private:
90  // Payload
91  std::vector<double> _bounds;
92  RooRealVar* _x; // variable in which we parametrise
93  RooAbsReal* _eff; // efficiency as function of _x
94  RooRealVar* _xmin; // model integral low bound
95  RooRealVar* _xmax; // model integral high bound
96  RooAbsReal* _int; // integral of model
97  mutable Double_t _val;
98  };
99 
101  const RooArgSet* iset, const TNamed* rangeName = 0) const;
102 
103  // Pointers to our underlying components
104  RooSetProxy _observables;
105  RooRealProxy _model; // RooResolutionModel
106  RooRealProxy _eff; // RooAbsReal
107 
108  typedef std::map<std::string, RooArgList*> RangeMap;
109  mutable RangeMap _ranges;
110 
111  mutable RooObjCacheManager _cacheMgr;
112 
113  //ClassDef(RooEffResModel, 2) // EffResian Resolution Model
114 };
115 
116 #endif
virtual void generateEvent(Int_t code)
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
std::vector< double > _bounds
virtual RooArgSet * observables() const
Return pointer to pdf in product.
virtual RooResolutionModel & model() const
const RooArgList & getIntegralRanges(const RooArgSet &iset, const char *rangeName=0) const
virtual Double_t evaluate() const
virtual RooEffResModel * convolution(RooFormulaVar *inBasis, RooAbsArg *owner) const
std::map< std::string, RooArgList * > RangeMap
virtual Bool_t forceAnalyticalInt(const RooAbsArg &dep) const
virtual std::vector< RooAbsReal * > efficiencies() const
Return pointer to pdf in product.
virtual Int_t basisCode(const char *name) const
virtual RooEffResModel * clone(const char *newname) const
virtual void initGenerator(Int_t code)
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName) const
Double_t getVal(const RooArgSet *nset=0) const
RooRealProxy _model
virtual ~RooEffResModel()
CacheElem(const RooEffResModel &parent, const RooArgSet &iset, const TNamed *rangeName)
virtual RooAbsReal * efficiency() const
Return pointer to pdf in product.
virtual RooArgList containedArgs(Action)
RooSetProxy _observables
friend class RooMultiEffResModel
virtual RooAbsGenContext * modelGenContext(const RooAbsAnaConvPdf &convPdf, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
CacheElem * getCache(const RooArgSet *iset, const TNamed *rangeName=0) const
RooRealProxy _eff
RooObjCacheManager _cacheMgr
virtual Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const