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() = default;
29 RooIntegralMorph(const char *name, const char *title,
30 RooAbsReal& _pdf1,
31 RooAbsReal& _pdf2,
32 RooAbsReal& _x,
33 RooAbsReal& _alpha, bool cacheAlpha=false);
34 RooIntegralMorph(const RooIntegralMorph& other, const char* name=nullptr) ;
35 TObject* clone(const char* newname) const override { return new RooIntegralMorph(*this,newname); }
36
37 bool selfNormalized() const override {
38 // P.d.f is self normalized
39 return true ;
40 }
41 void setCacheAlpha(bool flag) {
42 // Activate caching of p.d.f. shape for all values of alpha as well
44 }
45 bool cacheAlpha() const {
46 // If true caching of p.d.f for all alpha values is active
47 return _cacheAlpha ;
48 }
49
50 void preferredObservableScanOrder(const RooArgSet& obs, RooArgSet& orderedObs) const override ;
51
53 public:
55 ~MorphCacheElem() override ;
56 void calculate(TIterator* iter) ;
58
59 protected:
60
61 void findRange() ;
62 double calcX(double y, bool& ok) ;
63 Int_t binX(double x) ;
64 void fillGap(Int_t ixlo, Int_t ixhi,double splitPoint=0.5) ;
65 void interpolateGap(Int_t ixlo, Int_t ixhi) ;
66
68 std::unique_ptr<RooArgSet> _nset ;
69 RooAbsPdf* _pdf1 ; // PDF1
70 RooAbsPdf* _pdf2 ; // PDF2
71 RooRealVar* _x ; // X
72 RooAbsReal* _alpha ; // ALPHA
73 std::unique_ptr<RooAbsReal> _c1 ; // CDF of PDF 1
74 std::unique_ptr<RooAbsReal> _c2 ; // CDF of PDF 2
75 std::unique_ptr<RooAbsFunc> _cb1 ; // Binding of CDF1
76 std::unique_ptr<RooAbsFunc> _cb2 ; // Binding of CDF2
77 std::unique_ptr<RooBrentRootFinder> _rf1; // ROOT finder on CDF1
78 std::unique_ptr<RooBrentRootFinder> _rf2; // ROOT finder of CDF2 ;
79
80 std::vector<double> _yatX ; //
81 std::vector<double> _calcX; //
84
85 double _ycutoff ;
86
87 } ;
88
89protected:
90
91 friend class MorphCacheElem ;
92 PdfCacheElem* createCache(const RooArgSet* nset) const override ;
93 const char* inputBaseName() const override ;
94 RooFit::OwningPtr<RooArgSet> actualObservables(const RooArgSet& nset) const override ;
95 RooFit::OwningPtr<RooArgSet> actualParameters(const RooArgSet& nset) const override ;
96 void fillCacheObject(PdfCacheElem& cache) const override ;
97
98 RooRealProxy pdf1 ; // First input shape
99 RooRealProxy pdf2 ; // Second input shape
100 RooRealProxy x ; // Observable
101 RooRealProxy alpha ; // Interpolation parameter
102 bool _cacheAlpha ; // If true, both (x,alpha) are cached
103 mutable MorphCacheElem* _cache = nullptr; // Current morph cache element in use
104
105
106 double evaluate() const override ;
107
108private:
109
110 ClassDefOverride(RooIntegralMorph,1) // Linear shape interpolation operator p.d.f
111};
112
113#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
Abstract base class for p.d.f.s that need or want to cache their evaluate() output in a RooHistPdf de...
RooObjCacheManager _cacheMgr
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
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
Implement the abstract 1-dimensional root finding interface using the Brent-Decker method.
std::unique_ptr< RooBrentRootFinder > _rf1
std::unique_ptr< RooAbsReal > _c1
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::unique_ptr< RooAbsFunc > _cb2
void fillGap(Int_t ixlo, Int_t ixhi, double splitPoint=0.5)
Fill all empty histogram bins between bins ixlo and ixhi.
std::unique_ptr< RooArgSet > _nset
void findRange()
Determine which range of y values can be mapped to x values from the numeric inversion of the input c...
std::unique_ptr< RooAbsFunc > _cb1
std::unique_ptr< RooBrentRootFinder > _rf2
RooArgList containedArgs(Action) override
Return all RooAbsArg components contained in this cache.
std::unique_ptr< RooAbsReal > _c2
double calcX(double y, bool &ok)
Calculate the x value of the output p.d.f at the given cdf value y.
Int_t binX(double x)
Return the bin number enclosing the given x value.
Class RooIntegralMorph is an implementation of the histogram interpolation technique described by Ale...
bool cacheAlpha() const
RooIntegralMorph()=default
RooFit::OwningPtr< RooArgSet > actualObservables(const RooArgSet &nset) const override
Observable to be cached for given choice of normalization.
bool selfNormalized() const override
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
PdfCacheElem * createCache(const RooArgSet *nset) const override
Create and return a derived MorphCacheElem.
const char * inputBaseName() const override
Return base name component for cache components in this case a string encoding the names of both end ...
void preferredObservableScanOrder(const RooArgSet &obs, RooArgSet &orderedObs) const override
Indicate to the RooAbsCachedPdf base class that for the filling of the cache the traversal of the x s...
void fillCacheObject(PdfCacheElem &cache) const override
Fill the cache with the interpolated shape.
void setCacheAlpha(bool flag)
TObject * clone(const char *newname) const override
double evaluate() const override
Dummy.
RooFit::OwningPtr< RooArgSet > actualParameters(const RooArgSet &nset) const override
Parameters of the cache.
MorphCacheElem * _cache
void sterilize() override
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:37
1-D histogram with a double per channel (see TH1 documentation)}
Definition TH1.h:620
Iterator abstract base class.
Definition TIterator.h:30
Mother of all ROOT objects.
Definition TObject.h:41
Double_t y[n]
Definition legend1.C:17
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:43