Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooIntegralMorph.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * *
4 * Copyright (c) 2000-2007, 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 ROOLINEARMORPH
13#define ROOLINEARMORPH
14
15#include "RooAbsCachedPdf.h"
16#include "RooRealProxy.h"
17#include "RooCategoryProxy.h"
18#include "RooAbsReal.h"
19#include "RooAbsCategory.h"
20#include <vector>
21
23
24class TH1D;
25
27public:
28 RooIntegralMorph() : _cache(nullptr) {
29 // coverity[UNINIT_CTOR]
30 } ;
31 RooIntegralMorph(const char *name, const char *title,
32 RooAbsReal& _pdf1,
33 RooAbsReal& _pdf2,
34 RooAbsReal& _x,
36 RooIntegralMorph(const RooIntegralMorph& other, const char* name=0) ;
37 virtual TObject* clone(const char* newname) const { return new RooIntegralMorph(*this,newname); }
38 inline virtual ~RooIntegralMorph() { }
39
41 // P.d.f is self normalized
42 return kTRUE ;
43 }
44 void setCacheAlpha(Bool_t flag) {
45 // Activate caching of p.d.f. shape for all values of alpha as well
47 }
49 // If true caching of p.d.f for all alpha values is active
50 return _cacheAlpha ;
51 }
52
53 virtual void preferredObservableScanOrder(const RooArgSet& obs, RooArgSet& orderedObs) const ;
54
56 public:
59 void calculate(TIterator* iter) ;
61
62 protected:
63
64 void findRange() ;
67 void fillGap(Int_t ixlo, Int_t ixhi,Double_t splitPoint=0.5) ;
68 void interpolateGap(Int_t ixlo, Int_t ixhi) ;
69
72 RooAbsPdf* _pdf1 ; // PDF1
73 RooAbsPdf* _pdf2 ; // PDF2
74 RooRealVar* _x ; // X
75 RooAbsReal* _alpha ; // ALPHA
76 RooAbsReal* _c1 ; // CDF of PDF 1
77 RooAbsReal* _c2 ; // CDF of PDF 2
78 RooAbsFunc* _cb1 ; // Binding of CDF1
79 RooAbsFunc* _cb2 ; // Binding of CDF2
80 RooBrentRootFinder* _rf1 ; // ROOT finder on CDF1
81 RooBrentRootFinder* _rf2 ; // ROOT finder of CDF2 ;
82
83 std::vector<Double_t> _yatX ; //
84 std::vector<Double_t> _calcX; //
87
89
90 } ;
91
92protected:
93
94 friend class MorphCacheElem ;
95 virtual PdfCacheElem* createCache(const RooArgSet* nset) const ;
96 virtual const char* inputBaseName() const ;
97 virtual RooArgSet* actualObservables(const RooArgSet& nset) const ;
98 virtual RooArgSet* actualParameters(const RooArgSet& nset) const ;
99 virtual void fillCacheObject(PdfCacheElem& cache) const ;
100
101 RooRealProxy pdf1 ; // First input shape
102 RooRealProxy pdf2 ; // Second input shape
103 RooRealProxy x ; // Observable
104 RooRealProxy alpha ; // Interpolation parameter
105 Bool_t _cacheAlpha ; // If true, both (x,alpha) are cached
106 mutable MorphCacheElem* _cache ; // Current morph cache element in use
107
108
109 Double_t evaluate() const ;
110
111private:
112
113 ClassDef(RooIntegralMorph,1) // Linear shape interpolation operator p.d.f
114};
115
116#endif
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
RooObjCacheManager _cacheMgr
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition RooAbsFunc.h:27
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:61
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
Implement the abstract 1-dimensional root finding interface using the Brent-Decker method.
void fillGap(Int_t ixlo, Int_t ixhi, Double_t splitPoint=0.5)
Fill all empty histogram bins between bins ixlo and ixhi.
void calculate(TIterator *iter)
Calculate shape of p.d.f for x,alpha values defined by dIter iterator over cache histogram.
void interpolateGap(Int_t ixlo, Int_t ixhi)
Fill empty histogram bins between ixlo and ixhi with values obtained from linear interpolation of ixl...
std::vector< Double_t > _yatX
Int_t binX(Double_t x)
Return the bin number enclosing the given x value.
void findRange()
Determine which range of y values can be mapped to x values from the numeric inversion of the input c...
virtual RooArgList containedArgs(Action)
Return all RooAbsArg components contained in this cache.
std::vector< Double_t > _calcX
Double_t calcX(Double_t y, Bool_t &ok)
Calculate the x value of the output p.d.f at the given cdf value y.
Class RooIntegralMorph is an implementation of the histogram interpolation technique described by Ale...
Double_t evaluate() const
Dummy.
Bool_t cacheAlpha() const
void setCacheAlpha(Bool_t flag)
virtual ~RooIntegralMorph()
virtual PdfCacheElem * createCache(const RooArgSet *nset) const
Create and return a derived MorphCacheElem.
virtual RooArgSet * actualParameters(const RooArgSet &nset) const
Parameters of the cache.
virtual void preferredObservableScanOrder(const RooArgSet &obs, RooArgSet &orderedObs) const
Indicate to the RooAbsCachedPdf base class that for the filling of the cache the traversal of the x s...
virtual const char * inputBaseName() const
Return base name component for cache components in this case a string encoding the names of both end ...
virtual TObject * clone(const char *newname) const
virtual void fillCacheObject(PdfCacheElem &cache) const
Fill the cache with the interpolated shape.
Bool_t selfNormalized() const
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
virtual RooArgSet * actualObservables(const RooArgSet &nset) const
Observable to be cached for given choice of normalization.
MorphCacheElem * _cache
void sterilize()
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets.
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
1-D histogram with a double per channel (see TH1 documentation)}
Definition TH1.h:618
Iterator abstract base class.
Definition TIterator.h:30
Mother of all ROOT objects.
Definition TObject.h:37
Double_t y[n]
Definition legend1.C:17