Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooSimultaneous.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooSimultaneous.h,v 1.42 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_SIMULTANEOUS
17 #define ROO_SIMULTANEOUS
18 
19 //#include "THashList.h"
20 #include "TList.h"
21 #include "RooAbsPdf.h"
22 #include "RooCategoryProxy.h"
23 #include "RooRealProxy.h"
24 #include "RooSetProxy.h"
25 #include "RooAICRegistry.h"
26 #include "RooObjCacheManager.h"
27 #include "RooAbsCacheElement.h"
28 #include "RooArgList.h"
29 #include <map>
30 #include <string>
31 class RooAbsCategoryLValue ;
32 class RooFitResult ;
33 class RooPlot ;
34 class RooAbsData ;
35 class RooLinkedList ;
36 
37 class RooSimultaneous : public RooAbsPdf {
38 public:
39 
40  // Constructors, assignment etc
41  inline RooSimultaneous() : _plotCoefNormRange(0) { }
42  RooSimultaneous(const char *name, const char *title, RooAbsCategoryLValue& indexCat) ;
43  RooSimultaneous(const char *name, const char *title, std::map<std::string,RooAbsPdf*> pdfMap, RooAbsCategoryLValue& inIndexCat) ;
44  RooSimultaneous(const char *name, const char *title, const RooArgList& pdfList, RooAbsCategoryLValue& indexCat) ;
45  RooSimultaneous(const RooSimultaneous& other, const char* name=0);
46  virtual TObject* clone(const char* newname) const { return new RooSimultaneous(*this,newname) ; }
47  virtual ~RooSimultaneous() ;
48 
49  virtual Double_t evaluate() const ;
50  virtual Bool_t selfNormalized() const { return kTRUE ; }
51  Bool_t addPdf(const RooAbsPdf& pdf, const char* catLabel) ;
52 
53  virtual ExtendMode extendMode() const ;
54 
55  virtual Double_t expectedEvents(const RooArgSet* nset) const ;
56  virtual Double_t expectedEvents(const RooArgSet& nset) const { return expectedEvents(&nset) ; }
57 
58  virtual Bool_t forceAnalyticalInt(const RooAbsArg&) const { return kTRUE ; }
59  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
60  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
61 
62  using RooAbsPdf::plotOn ;
63  virtual RooPlot* plotOn(RooPlot* frame,
64  const RooCmdArg& arg1 , const RooCmdArg& arg2=RooCmdArg(),
65  const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
66  const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(),
67  const RooCmdArg& arg7=RooCmdArg(), const RooCmdArg& arg8=RooCmdArg(),
68  const RooCmdArg& arg9=RooCmdArg(), const RooCmdArg& arg10=RooCmdArg()) const {
69  return RooAbsReal::plotOn(frame,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) ;
70  }
71  virtual RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const ;
72 
73  // Backward compatibility function
74  virtual RooPlot *plotOn(RooPlot *frame, Option_t* drawOptions, Double_t scaleFactor=1.0,
75  ScaleType stype=Relative, const RooAbsData* projData=0, const RooArgSet* projSet=0,
76  Double_t precision=1e-3, Bool_t shiftToZero=kFALSE, const RooArgSet* projDataSet=0,
77  Double_t rangeLo=0, Double_t rangeHi=0, RooCurve::WingMode wmode=RooCurve::Extended) const;
78 
79  RooAbsPdf* getPdf(const char* catName) const ;
80  const RooAbsCategoryLValue& indexCat() const { return (RooAbsCategoryLValue&) _indexCat.arg() ; }
81 
82 
83  virtual RooDataSet* generateSimGlobal(const RooArgSet& whatVars, Int_t nEvents) ;
84 
85  virtual RooDataHist* fillDataHist(RooDataHist *hist, const RooArgSet* nset, Double_t scaleFactor,
86  Bool_t correctForBinVolume=kFALSE, Bool_t showProgress=kFALSE) const ;
87 
88 protected:
89 
90  void initialize(RooAbsCategoryLValue& inIndexCat, std::map<std::string,RooAbsPdf*> pdfMap) ;
91 
92  virtual void selectNormalization(const RooArgSet* depSet=0, Bool_t force=kFALSE) ;
93  virtual void selectNormalizationRange(const char* rangeName=0, Bool_t force=kFALSE) ;
94  mutable RooSetProxy _plotCoefNormSet ;
95  const TNamed* _plotCoefNormRange ;
96 
97  class CacheElem : public RooAbsCacheElement {
98  public:
99  virtual ~CacheElem() {} ;
100  RooArgList containedArgs(Action) { return RooArgList(_partIntList) ; }
101  RooArgList _partIntList ;
102  } ;
103  mutable RooObjCacheManager _partIntMgr ; // Component normalization manager
104 
105 
106  friend class RooSimGenContext ;
107  friend class RooSimSplitGenContext ;
108  virtual RooAbsGenContext* autoGenContext(const RooArgSet &vars, const RooDataSet* prototype=0, const RooArgSet* auxProto=0,
109  Bool_t verbose=kFALSE, Bool_t autoBinned=kTRUE, const char* binnedTag="") const ;
110  virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=0,
111  const RooArgSet* auxProto=0, Bool_t verbose= kFALSE) const ;
112 
113  RooCategoryProxy _indexCat ; // Index category
114  TList _pdfProxyList ; // List of PDF proxies (named after applicable category state)
115  Int_t _numPdf ; // Number of registered PDFs
116 
117  ClassDef(RooSimultaneous,2) // Simultaneous operator p.d.f, functions like C++ 'switch()' on input p.d.fs operating on index category5A
118 };
119 
120 #endif