Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <RooAICRegistry.h>
20#include <RooAbsCacheElement.h>
21#include <RooAbsPdf.h>
22#include <RooArgList.h>
23#include <RooCategoryProxy.h>
24#include <RooGlobalFunc.h>
25#include <RooObjCacheManager.h>
26#include <RooRealProxy.h>
27#include <RooSetProxy.h>
28
29#include <TList.h>
30
31#include <map>
32#include <string>
33
35class RooFitResult ;
36class RooPlot ;
37class RooAbsData ;
38class RooLinkedList ;
39class RooSuperCategory ;
40
41class RooSimultaneous : public RooAbsPdf {
42public:
43
44 /// Internal struct used for initialization.
46
48
49 void addPdf(const RooAbsPdf &pdf, std::string const &catLabel);
50
51 std::vector<RooAbsPdf const *> finalPdfs;
52 std::vector<std::string> finalCatLabels;
54 std::unique_ptr<RooSuperCategory> superIndex;
55 };
56
57 // Constructors, assignment etc
58 inline RooSimultaneous() : _partIntMgr(this,10) {}
59 RooSimultaneous(const char *name, const char *title, RooAbsCategoryLValue& indexCat) ;
60 RooSimultaneous(const char *name, const char *title, std::map<std::string,RooAbsPdf*> pdfMap, RooAbsCategoryLValue& inIndexCat) ;
61 RooSimultaneous(const char *name, const char *title, RooFit::Detail::FlatMap<std::string,RooAbsPdf*> const &pdfMap, RooAbsCategoryLValue& inIndexCat);
62 RooSimultaneous(const char *name, const char *title, const RooArgList& pdfList, RooAbsCategoryLValue& indexCat) ;
63 RooSimultaneous(const RooSimultaneous& other, const char* name=nullptr);
64 TObject* clone(const char* newname) const override { return new RooSimultaneous(*this,newname) ; }
65 ~RooSimultaneous() override ;
66
67 double evaluate() const override ;
68 bool selfNormalized() const override { return true ; }
69 bool addPdf(const RooAbsPdf& pdf, const char* catLabel) ;
70
71 ExtendMode extendMode() const override ;
72
73 double expectedEvents(const RooArgSet* nset) const override ;
74
75 bool forceAnalyticalInt(const RooAbsArg&) const override { return true ; }
76 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
77 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
78
79 using RooAbsPdf::plotOn ;
81 const RooCmdArg& arg1 , const RooCmdArg& arg2={},
82 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
83 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
84 const RooCmdArg& arg7={}, const RooCmdArg& arg8={},
85 const RooCmdArg& arg9={}, const RooCmdArg& arg10={}) const override {
86 return RooAbsReal::plotOn(frame,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) ;
87 }
88 RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const override ;
89
90 RooAbsPdf* getPdf(RooStringView catName) const ;
91 const RooAbsCategoryLValue& indexCat() const { return (RooAbsCategoryLValue&) _indexCat.arg() ; }
92
93
94 RooFit::OwningPtr<RooDataSet> generateSimGlobal(const RooArgSet& whatVars, Int_t nEvents) override ;
95
96 virtual RooDataHist* fillDataHist(RooDataHist *hist, const RooArgSet* nset, double scaleFactor,
97 bool correctForBinVolume=false, bool showProgress=false) const ;
98
99 void wrapPdfsInBinSamplingPdfs(RooAbsData const &data, double precision);
101 std::map<std::string, double> const& precisions,
102 bool useCategoryNames=false);
103
104 RooAbsGenContext* autoGenContext(const RooArgSet &vars, const RooDataSet* prototype=nullptr, const RooArgSet* auxProto=nullptr,
105 bool verbose=false, bool autoBinned=true, const char* binnedTag="") const override ;
106 RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr,
107 const RooArgSet* auxProto=nullptr, bool verbose= false) const override ;
108
109 std::unique_ptr<RooAbsArg> compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override;
110
111protected:
112
113 void selectNormalization(const RooArgSet* depSet=nullptr, bool force=false) override ;
114 void selectNormalizationRange(const char* rangeName=nullptr, bool force=false) override ;
115
116 RooArgSet const& flattenedCatList() const;
117
119 const TNamed* _plotCoefNormRange = nullptr;
120
122 public:
125 } ;
126 mutable RooObjCacheManager _partIntMgr ; ///<! Component normalization manager
127
128
129 friend class RooSimGenContext ;
131
132 RooCategoryProxy _indexCat ; ///< Index category
133 TList _pdfProxyList ; ///< List of PDF proxies (named after applicable category state)
134 Int_t _numPdf = 0; ///< Number of registered PDFs
135
136private:
137
138 /// Private internal constructor.
139 RooSimultaneous(const char *name, const char *title, InitializationOutput && initInfo);
140
141 static std::unique_ptr<RooSimultaneous::InitializationOutput>
142 initialize(std::string const& name, RooAbsCategoryLValue &inIndexCat,
143 std::map<std::string, RooAbsPdf *> const &pdfMap);
144
145 mutable std::unique_ptr<RooArgSet> _indexCatSet ; ///<! Index category wrapped in a RooArgSet if needed internally
146
147 ClassDefOverride(RooSimultaneous,3) // Simultaneous operator p.d.f, functions like C++ 'switch()' on input p.d.fs operating on index category5A
148};
149
150#endif
bool initialize()
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract base class for generator contexts of RooAbsPdf objects.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
Definition RooAbsPdf.h:124
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const
Plot (project) PDF on specified frame.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
Container class to hold N-dimensional binned data.
Definition RooDataHist.h:40
Container class to hold unbinned data.
Definition RooDataSet.h:57
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Implementation of a RooCacheManager<RooAbsCacheElement> that specializes in the storage of cache elem...
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:45
Efficient implementation of the generator context specific for RooSimultaneous PDFs when generating m...
Efficient implementation of the generator context specific for RooSimultaneous PDFs when generating m...
RooArgList containedArgs(Action) override
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
void selectNormalization(const RooArgSet *depSet=nullptr, bool force=false) override
Interface function used by test statistics to freeze choice of observables for interpretation of frac...
double evaluate() const override
Return the current value: the value of the PDF associated with the current index category state.
Int_t _numPdf
Number of registered PDFs.
void selectNormalizationRange(const char *rangeName=nullptr, bool force=false) override
Interface function used by test statistics to freeze choice of range for interpretation of fraction c...
TList _pdfProxyList
List of PDF proxies (named after applicable category state)
RooObjCacheManager _partIntMgr
! Component normalization manager
~RooSimultaneous() override
Destructor.
RooFit::OwningPtr< RooDataSet > generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents) override
Special generator interface for generation of 'global observables' – for RooStats tools.
RooArgSet const & flattenedCatList() const
Internal utility function to get a list of all category components for this RooSimultaneous.
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
ExtendMode extendMode() const override
Examine the pdf components and check if one of them can be extended or must be extended.
RooCategoryProxy _indexCat
Index category.
bool forceAnalyticalInt(const RooAbsArg &) const override
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Return analytical integration defined by given code.
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Forward determination of analytical integration capabilities to component p.d.f.s A unique code is as...
double expectedEvents(const RooArgSet *nset) const override
Return the number of expected events: If the index is in nset, then return the sum of the expected ev...
TObject * clone(const char *newname) const override
RooAbsGenContext * autoGenContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false, bool autoBinned=true, const char *binnedTag="") const override
RooAbsPdf * getPdf(RooStringView catName) const
Return the p.d.f associated with the given index category name.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
void wrapPdfsInBinSamplingPdfs(RooAbsData const &data, double precision)
Wraps the components of this RooSimultaneous in RooBinSamplingPdfs.
const TNamed * _plotCoefNormRange
RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false) const override
Return specialized generator context for simultaneous p.d.f.s.
std::unique_ptr< RooArgSet > _indexCatSet
! Index category wrapped in a RooArgSet if needed internally
bool addPdf(const RooAbsPdf &pdf, const char *catLabel)
Associate given PDF with index category state label 'catLabel'.
bool selfNormalized() const override
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
RooSetProxy _plotCoefNormSet
const RooAbsCategoryLValue & indexCat() const
virtual RooDataHist * fillDataHist(RooDataHist *hist, const RooArgSet *nset, double scaleFactor, bool correctForBinVolume=false, bool showProgress=false) const
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
Joins several RooAbsCategoryLValue objects into a single category.
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35
Internal struct used for initialization.
std::unique_ptr< RooSuperCategory > superIndex
std::vector< RooAbsPdf const * > finalPdfs
std::vector< std::string > finalCatLabels
void addPdf(const RooAbsPdf &pdf, std::string const &catLabel)